Question

Pseudocode and C# please

300 Assignment6B: Free flight to Europe? Credit card companies make money from you each month that you dont pay your bill in

0 0
Add a comment Improve this question Transcribed image text
Answer #1

In case of any query do comment. Please rate answer as well. Thanks

Pseudo Code:


class CreditCard
{
       //fields
int Balance
int PointsEarned
  
// Constructor
public CreditCard()
{
Initialize Balance to 0
Initialize PointsEarned to 0;
}

//methods
void Charge(int amount)
{
Add Amount to Balance
Add amount/100 to PointsEarned
}

void MakePayment(int amount)
{
Deduct Amount from Balance
}   
}
  
   =========Main Driver===========
  
   choice = GetChoice()
   //create an object of CreditCard
   CreditCard myCard = new CreditCard()
   //while loop till user quit
   While(choice != 4){
       SWITCH on Choice{
       Choice 1:
           INPUT AMount to Charge
           Call Charge Method on myCard
           Break;
       Choice 2:
           INPUT AMount to Make a payment
           Call MakePayment Method on myCard
           Break;
       Choice 3:
           Display balance
           Display Points Earned
           Break;
       }
   }
  
   int GetChoice(){
           Display("Would you like to: ");
Display("1) Charge");
Display("2) Make a payment");
Display("3) See current Balance");
Display("4) Quit");
           INPUT Choice
           Return Choice
   }

Code:

==========CreditCard.cs========

namespace CreditCardFunctionDisplay
{
    public class CreditCard
    {
        public int Balance { get; set; }

        public int PointsEarned { get; set; }

        /// <summary>
        /// Constructor
        /// </summary>
        public CreditCard()
        {
            this.Balance = 0;
            this.PointsEarned = 0;
        }

        /// <summary>
        /// Add charge to Credit Card and also add points earned
        /// </summary>
        /// <param name="amount"></param>
        public void Charge(int amount)
        {
            this.Balance += amount;
            //divide the amount by 100 and add these points to point earned
            this.PointsEarned += amount / 100;
        }

        public void MakePayment(int amount)
        {
            this.Balance -= amount;
        }       
    }
}

========Program.cs (driver program)============

using System;

namespace CreditCardFunctionDisplay
{
    class Program
    {
        static void Main(string[] args)
        {
            int choice = GetChoice();
            int amount = 0;
            CreditCard myCard = new CreditCard(); //create an object of Credit Card
            //run until user entered 4 for quit
            while(choice !=4)
            {
                switch (choice)
                {
                    case 1:
                        Console.WriteLine("Amount to charge:");
                        amount = int.Parse(Console.ReadLine());
                        myCard.Charge(amount); //charge the card with the amount entered
                        break;
                    case 2:
                        Console.WriteLine("Amount to pay:");
                        amount = int.Parse(Console.ReadLine());
                        myCard.MakePayment(amount); //make a payment from card
                        break;
                    case 3:
                        //display the balance
                        Console.WriteLine("Balance: {0}", myCard.Balance);
                        Console.WriteLine("Points: {0}", myCard.PointsEarned);
                        break;
                    default:
                        break;
                }
                Console.WriteLine();
                choice = GetChoice(); //take the choice again
            }            
        }

        /// <summary>
        /// to get the choice from user
        /// </summary>
        /// <returns></returns>
        public static int GetChoice()
        {
            int choice = -1;
            Console.WriteLine("Would you like to: ");
            Console.WriteLine("1) Charge");
            Console.WriteLine("2) Make a payment");
            Console.WriteLine("3) See current Balance");
            Console.WriteLine("4) Quit");
            choice = int.Parse(Console.ReadLine());
            return choice;
        }
    }
}

output:

C:\Abhishek Chegg\C#\Credit CardFunction Display Credit CardFunction Display\bin\Debug C Would you like to: 1) Charge 2) Make

Select C:\Abhishek Chegg\C#\Credit CardFunction Display Credit CardFunction Display\bin\Debug Credit CardFunction Display.exe

C:\Abhishek Chegg\C#\Credit CardFunction Display Credit CardFunction Display\bin\Debug C Would you like to: 1) Charge 2) Make a payment 3) See current Balance 4) Quit 1 Amount to charge: 300 Would you like to: 1) Charge 2) Make a payment 3) See current Balance 4) Quit 3 Balance: 300 Points: 3 Would you like to: 1) Charge 2) Make a payment 3) See current Balance 4) Quit 2 Amount to pay: 200 Would you like to: 1) Charge 2) Make a payment 3) See current Balance 4) Quit 3 Balance: 100 Points: 3 Would you like to: 1) Charge 2) Make a payment 3) See current Balance 4) Quit 4

Select C:\Abhishek Chegg\C#\Credit CardFunction Display Credit CardFunction Display\bin\Debug Credit CardFunction Display.exe Would you like to: 1) Charge 2) Make a payment 3) See current Balance 4) Quit 3 Balance: © Points: 0 Would you like to: 1) Charge 2) Make a payment 3) See current Balance 4) Quit 1 Amount to charge: 5503 Would you like to: 1) Charge 2) Make a payment 3) See current Balance 4) Quit 3 Balance: 5503 Points: 55 Would you like to: 1) Charge 2) Make a payment 3) See current Balance 4) Quit 4

Add a comment
Know the answer?
Add Answer to:
Pseudocode and C# please 300 Assignment6B: Free flight to Europe? Credit card companies make money from...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C++ program to manage a credit card company with at least one ADT (Account)...

    Write a C++ program to manage a credit card company with at least one ADT (Account) with the following members: card number, customer name, credit limit, and balance. • The customer can pay the total amount of his/her balance or part of it. • The customer can make a purchase using the credit card. • The user can create, modify, and delete accounts. • All new accounts are created with $300 credit limit. • Customers’ data is stored in a...

  • if you are trying to build credit by using a credit card eah time you make a purchase with the credit card deduct that a...

    if you are trying to build credit by using a credit card eah time you make a purchase with the credit card deduct that amount from your checking account that way when your credit card is due you will have enough to pay the credit card off in full Kathy lehner is going to start doing this.she plans on paying her credit card bill in full this month.Hpw much does she owe with a 12% APR and the following transactions...

  • If you are trying to build credit by using a credit card each time you make...

    If you are trying to build credit by using a credit card each time you make a purchase with a credit card, deduct that amount from your checking account. that way when you your credit card bill is due you will have enough to pay the credit card in full. Kathy Lehner is going to start doing this. She plans on paying her credit card bill in full this month. How much does she owe with a 12% APR and...

  • If you are trying to build credit by using a credit card, each time you make...

    If you are trying to build credit by using a credit card, each time you make a purchase with the credit card, deduct that amount from your checking account. That way, when your credit card bill is due, you will have enough to pay the credit card off in full. Kathy Lehner is going to start doing this. She plans on paying her credit card bill in full this month. How much does she owe with a 9% APR and...

  • C++ code and also provide comments explaining everything Credit Card Debt The True Cost of Paying...

    C++ code and also provide comments explaining everything Credit Card Debt The True Cost of Paying Minimum Payment Write a C++ program to output the monthly payment schedule for a credit card debt, when each month nothing more is charged to the account but only the minimum payment is paid. The output stops when the balance is fully paid - remaining balance = 0. Input: Data input must be done in a separate function. Input the following: credit card balance,...

  • 1. Assume you owe $5,000 on a credit card on June 1st. Assume the company uses the average daily balance to compute...

    1. Assume you owe $5,000 on a credit card on June 1st. Assume the company uses the average daily balance to compute interest, at the rate of 20 %. Assume that these transactions occur during the month of June: On June 5th, you charge another $200 on the card. On June 13, you pay $500. On June 17th, you charge another $300. On June 25th, you charge another $500. At the end of the month, how much money do you...

  • Please help use this credit card table to answer the following questions. directions Use the credit...

    Please help use this credit card table to answer the following questions. directions Use the credit card statement below to answer these questions: 1. What is the date of the statement? 2. What is the Annual Percentage Rate (APR)? 3. What is the corresponding periodic rate? 4. What is the new balance? 5. What was the previous balance? 6. How many charges were made during the billing cycle? 7. How many credits and payments were made during the billing cycle?...

  • Suppose you owe ​$600 on your credit card and you decide to make no new purchases...

    Suppose you owe ​$600 on your credit card and you decide to make no new purchases and to make the minimum monthly payment on the account. Assuming that the interest rate on your card is 1​% per month on the unpaid balance and that the minimum payment is 2​% of the total​ (balance plus​ interest), your balance after t months is given by ​B(t)=600​(0.9898t​). Find your balance at each of the given times. Complete parts​ (a) through​ (e) below. ​(a)...

  • If you are trying to build credit by using a credit card

    If you are trying to build credit by using a credit card, each time you make a purchase with the credit card, deduct that amount from your checking account. That way, when your credit card bill is due, you will have enough to pay the credit card off in full. Kathy Lehner is going to start doing this. She plans on paying her credit card bill in full this month. How much does she owe with a 9% APR and...

  • Accounting Spreadsheet Assignment Credit Card You went on a binge. You've heard the old saying, "If...

    Accounting Spreadsheet Assignment Credit Card You went on a binge. You've heard the old saying, "If you play, you're going to have to pay." The day of reckoning has arrived. Your current credit card balance is $10,000 с D E A 1 Your Name 2 Credit Card Payment Schedule 3 Date 4 5 Interest Rate XX% 6 7 Monthly Pymt SXXX.XX 8 9 Monthly 10 Month Payment 11 0 12 1 SXXX.XX Interest Principal Card Balance 10,000.00 XXX.XX $ $XXX...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT