1 / 4

Evaluation

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.

senwe
Download Presentation

Evaluation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Evaluation

  2. 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. • 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).

  3. 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.

  4. 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

More Related