Question: Programming in python. Assume you have a millage award credit card that will earn points with an airline company. When you first open the credit

Programming in python. Programming in python. Assume you have a millage award credit card that

Assume you have a millage award credit card that will earn points with an airline company. When you first open the credit card, you will get a 30,000 bonus points. Then for every dollar you spend on a restaurant, you will get 2 points and for every dollar spend on a gas station you will get 3 points. For anything else, you get one point for each dollar spend. When this card is used to buy something, a Transaction instance is created which records each spending activity with proper category and the addTransaction method will be called using the Transaction instance as the real parameter. The addTransaction method updates balance and points correctly. The balance is the money the credit card company has paid merchandizes for you, and the points are the accumulative points you have earned so far. You want to know what the total balance is, and what your total awarding points are. You also want to know how many points earned from each category. Please implement following classes and test them Please fill the blanks below in main() method Purchasing category Category of Transaction Points earned per dollar other RestaurantGas station 2 2 CreditCard -_name String -spendings: List balance: double +CreditCard( String name) //initialize spendings to an empty list, balance to 0 + getName(): String setName(String name: void + addTransaction (Transaction t)://update-spendings,balance + makePayment(double payAmount): void + getBalance(): double +toString):String (a string representation for name and balance Transaction + amount: double +category: int MilageAwardCard _points : double Transaction (double dollars, int c) + toString() : String MilageAwardCard(String name) + addTransaction (Transaction t): void + totalPointsByRestaurant(): int + totalPointsByGasStation(): int + totalPointsByOthers(): int toString() : String Assume you have a millage award credit card that will earn points with an airline company. When you first open the credit card, you will get a 30,000 bonus points. Then for every dollar you spend on a restaurant, you will get 2 points and for every dollar spend on a gas station you will get 3 points. For anything else, you get one point for each dollar spend. When this card is used to buy something, a Transaction instance is created which records each spending activity with proper category and the addTransaction method will be called using the Transaction instance as the real parameter. The addTransaction method updates balance and points correctly. The balance is the money the credit card company has paid merchandizes for you, and the points are the accumulative points you have earned so far. You want to know what the total balance is, and what your total awarding points are. You also want to know how many points earned from each category. Please implement following classes and test them Please fill the blanks below in main() method Purchasing category Category of Transaction Points earned per dollar other RestaurantGas station 2 2 CreditCard -_name String -spendings: List balance: double +CreditCard( String name) //initialize spendings to an empty list, balance to 0 + getName(): String setName(String name: void + addTransaction (Transaction t)://update-spendings,balance + makePayment(double payAmount): void + getBalance(): double +toString):String (a string representation for name and balance Transaction + amount: double +category: int MilageAwardCard _points : double Transaction (double dollars, int c) + toString() : String MilageAwardCard(String name) + addTransaction (Transaction t): void + totalPointsByRestaurant(): int + totalPointsByGasStation(): int + totalPointsByOthers(): int toString() : String

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!