Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

String as a parameter and changes the nam on the account to be that string. Task 2 (40 points) File ManageAccounts.java that is available on

image text in transcribedimage text in transcribed

image text in transcribedimage text in transcribed

String as a parameter and changes the nam on the account to be that string. Task 2 (40 points) File ManageAccounts.java that is available on Moodle, contains a shell program that uses the Accoun class above. Save it to your directory, and complete it as indicated by the comments. Submission You need to implement all the required tasks above and upload your Java source files (.java) as a single Zip file into the available Moodle submission. 1 Task 1 (60 points) File Account.java that is available on Moodle, contains a partial definition for a class representing a bank account. Save it to your directory and study it to see what methods it contains. Then complete the Account class as described below. Note that you won't be able to test your methods until you write ManageAccounts in task #2. a. Fill in the code for the constructor Account, which initializes balance, owner, and account number. b. Fill in the code for method deposit, which should add the amount into balance. hs C. Fill in the code for method toString, which should return a string containing the name, account number, and balance for the account. d. Fill in the code for method charge Fee, which should deduct a service fee from the account. e. Modify chargeFee so that instead of returning void, it returns the new balance. Note that you will have to make changes in two places. f. Fill in the code for method changeName which takes a string as a parameter and changes the name on the account to be that string. Tack 21 noints 1/ ****** // Account.java ***** // A bank account class with methods to deposit to, Il change the name on, charge a fee to, and print a summary of the account. ******** public class Account { private double balance; private String name; private long acctNum; // // Constructor initializes balance, owner, and account number // public Account (double initBal, String owner, long number) { //add body of constructor } 17 // Adds deposit amount to balance. public void deposit(double amount) { 1/add body of deposit } // Returns balance. 17 public double getBalance() { return balance; } // // Returns a string containing the name, account number, and balance. 17 public String toString() { //add body of toString } // // Deducts $10 service fee 1/ Also, dont forget to modify for Task 1's item e. public void chargeFee() { //add body of chargeFee } // 1/ Changes the name on the account // public void changeName(String newName) { //add body of changeName } Aramak iin buraya yazn 10 4 - moodle.tedu.edu.tr/pluginfile.php Uygulamalar M Gmail YouTube Haritalar ******************************** **************** // ManageAccounts.java // Use Account class to create and manage Sally and Joe's 77 bank accounts 17 ************************ public class ManageAccounts ********* public public static void main(String[] args) Account accti, acct2; //create accounti for Sally with $1000 acct1 = new Account (1000, "Sally", 1111); // create account for Joe with $500 1/deposit $100 to Joe's account 1/print Joe's new balance (use getBalance()) 1/deposit $50 to Sally's account 1/print Sally's new balance (use getBalance()) // charge fees to both accounts 1/ change the name on Joe's account to Joseph //print summary for both accounts 7 O Aramak iin buraya yazn

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

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

What are creative bookkeeping techniques? Provide three examples.

Answered: 1 week ago