Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java, and please include main method setBalance - This is a set method used to set the account balance. Since the account number and counter

Java, and please include main method image text in transcribed
setBalance - This is a "set" method used to set the account balance. Since the account number and counter should not be modified manually, so there should be no set method for those two variables. deposit - This method should receive a double value as a parameter. The parameter indicates how much will be deposited into the account. The amount should be positive (otherwise it doesn't do anything and the program should print a message). The account balance should be updated accordingly. charge - This method should receive a double value as parameter. The parameter indicates how much will be charged to the account and the balance should be decreased accordingly. The charge amount should be positive (otherwise it doesn't do anything and the program should print a message). The new balance is allowed to be negative. transferin - this method allows transferring money from another Student Account. There are two parameters, an object of StudentAccount and the amount to be transferred in. The amount should be positive (otherwise it doesn't do anything). The balance of both accounts should be updated accordingly. The new balance is allowed to be negative. transferOut - this method allows a transfer from the current account to another Student Account. There are two parameters, an object of the other Student Account and the amount to be transferred out. The amount should be positive (otherwise it doesn't do anything). The balance of both accounts should be updated accordingly. The new balance is allowed to be negative. printInfo-this method takes no parameter. It displays the account information in the following format: Account number: Current balance: Overridden Methods The following method is inherited from the Object class, and you will need to overwrite it. toString - This method takes no parameters, and returns a String object. It returns a String object with the account information in the following format: Account number: Current balance: Other methods Your Account class should include the following method from the Comparable interface compare To - This method should have one parameter of StudentAccount type and return an integer (1, 0, or -1). The method is to test the order of two Student Account objects (the this object and the parameter) based on their account balance. If the balance of this object is higher, it returns 1; if the balances are the same, it retums 0, otherwise it returns - 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Database Security Applications And Trends

Authors: Michael Gertz, Sushil Jajodia

1st Edition

1441943056, 978-1441943057

More Books

Students also viewed these Databases questions

Question

understand the key issues concerning international assignments

Answered: 1 week ago