40 likes | 163 Views
Evaluation. Evaluation. Write a Java class named Account that includes the following data members: -id: int the id of the account . #balance: double the account balance. # numTransactions number of transactions (deposit or withdraw) that occurred on the account.
E N D
Evaluation • Write a Java class named Account that includes the following data members: -id: int the id of the account. #balance: double the account balance. #numTransactionsnumber of transactions (deposit or withdraw) that occurred on the account. • The class also includes the following methods: • A constructor with two parameter that receives the id of the account and the account balance. • + deposit (in amount: double)deposit the given amount into the account. • + withdraw (in amount: double) withdraw the given amount from the account if the balance permits. • + displayAccountInfo()display all the information of the account (id, balance and number of transactions).
Evaluation • Write a Java class named CheckingAccountthat extends from class Account and includes the following data members: • overDraftLimit: double the maximum amount the account holder can withdraw below the balance. For example, if the overdraft limit is 500, then the balance is allowed to be -500 but not less. • The class also includes the following methods: • A constructor with three parameter that receives the id of the account ,the account balance and the overdraft limit. • + withdraw (in amount: double) withdraw the given amount from the account if the overdraft limit permits.
Evaluation • Write another Java class called TestAccountwith a main method that will test the class Account. The main method should do the following: • Ask the user whether the account is a regular or checking account. • Input the information of the account ID, balance, and overdraft limit (if it is a checking account). • Display the following menu then ask the user about her choice. The menu should be repeated until the user chooses ‘4’ to exit the program. 1- Deposit 2- Withdraw 3- Display account information 4- Exit