Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this homework assignment I want you to create a class of BankAccount. Specifications for the class BankAccount: A BankAccount object has three pieces of

image text in transcribed
In this homework assignment I want you to create a class of BankAccount. Specifications for the class BankAccount: A BankAccount object has three pieces of data: - owner which is a String - account Number which is an int - balance which is a double The constructor for the BankAccount object will take the owner as a String and accountNumber as an int. Example: BankAccount account1 = new BankAccount("Sally Ride", 123456); The default value for the balance is zero. There are two methods in the BankAccount class, toString and adjust. . The method to String returns a string of the BankAccount object in the following format: owner owns the account account with the balance of $balance Here is an example of what it would output: Sally Ride owns the account 123456 with the balance of $0.00 The method adjust takes a double as an input and will add it to the balance. Example: account1 adjust(1000.00); You must create a file called BankAccount.java with your source code. You can test your code by creating a file called Test.java with the following code: class Test { public static void main(String[] args) { BankAccount accountOne = new BankAccount ("Sally Ride", 123456); System.out.println(accountOne); accountOne. adjust(1000.00); System.out.println(accountOne); accountOne.adjust(-500.00); System.out.println(accountOne); } }

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

Intelligent Information And Database Systems 12th Asian Conference ACIIDS 2020 Phuket Thailand March 23 26 2020 Proceedings

Authors: Pawel Sitek ,Marcin Pietranik ,Marek Krotkiewicz ,Chutimet Srinilta

1st Edition

9811533792, 978-9811533792

More Books

Students also viewed these Databases questions

Question

Question Can a Keogh plan fund be reached by the owners creditors?

Answered: 1 week ago

Question

Question What happens to my plan if I die?

Answered: 1 week ago