Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Due Date: Wednesday February 21, 2018 (by midnight) Weight: 2 points Obiectives: Simple Classes and Objects What to submit Consider the Account class given on

image text in transcribedimage text in transcribedimage text in transcribed

Due Date: Wednesday February 21, 2018 (by midnight) Weight: 2 points Obiectives: Simple Classes and Objects What to submit Consider the Account class given on slide 44 and the AccountTest class given on slides 46-47 of the "3 Classes, Objects, Methods and Strings" set of lecture notes. These two classes are reproduced below on page 2 and 3, respectively 1) Recreate these two classes and compile them using the following command: javac Account. java AccountTest.java If your compilation is successful, you should now have Account.class and AccountTest.class files in your folder Run this program using the following command java AccountTest 2) Modify the Account class as follows a) Replace balance with two instance variables: checkingBalance and savingsBalance and modify the constructor to take two arguments checking and savings. The constructor initializes the two instance variables with the values given by the two arguments. Don't forget to modify the test driver accordingly b) Replace the credit method with two methods: creditchecking and creditsavings. Also, Replace the getBalance method with two methods: getcheckingBalance and c) Add the following two new methods: debitchecking and debitsavings and their ra rac d) Add a method moveFromcheckingToSavings (double amount) Also, Add a method moveFromsavingsToChecking (double amount) *****You must implement these two methods using creditchecking, creditsavings, debitchecking and/or debitsavings as appropriate Always ensure that the resulting balances do not become negative. If an account is debited with an amount greater than the corresponding balance, then that balance should be left unchanged and the method debitchecking or debitsavings() should print a message indicating "Transaction amount exceeded checking balance" or "Transaction amount exceeded savings balance" as appropriate Modify class AccountTest to test ALL of these methods

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

Step: 3

blur-text-image

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

LO3 Name the seven categories of HR functions.

Answered: 1 week ago