Create an account object and make sure it has values

Assignment Help JAVA Programming
Reference no: EM132077783

1. Define Customer.java according to the following class diagram and information.

Customer
- customerID: int
- firstName: String
- lastName: String

+ Customer()
+ Customer(int, String, String)
+ getCustomerID(): String
+ setCustomerID(String)
+ getFirstName(): String
+ setFirstName(String)
+ getLastName(): String
+ setLastName(String)
+ toString(): String


• the first constructor doesn't have any parameter and sets each of three instance variables to 0, null, and null, respectively;
• the second constructor uses three passed-in parameters to update values of the instance variables.
• toString() method return a String value for all instance variables of a Customer object. A sample return value of toString() for a Customer object is as follows.
Customer ID: 4838156\nName: John Smith

2) Define Account.java according to the following class diagram and information.

Account

- accountNo: int-

customer: Customer-

balance: double

+ Account(int, Customer, double)

+ getAccountNo(): int

+ setAccountNo(int)

+ getCustomer(): Customer

+ setCustomer(Customer)

+ getBalance(): double

+ setBalance(double)

+ deposit(double)

+ withdraw(double): boolean

+ toString(): String

• the constructor uses three parameters to update values for accountNo, customer, and balance.
• deposit(double) uses value from the input parameter to update the existing balance (by adding the parameter's amount to the existing balance).
• withdraw(double) reduces the current balance by the value of the input parameter. Return true if the current balance is not less than the parameter's value and then reduces the existing balance accordingly; otherwise, return false and do not update the existing balance.
• toString() returns a String for all instance variable values of an Account object. A sample return value of toString() for an Order object is as follows.
Customer ID: 4838156\nName: John Smith\nAccount Number: 5820389\nBalance: $5,280.05


3) Define AccountApp.java according to following requirements to interact with the Customer and Account classes. (6 points)
• create a Customer object and make sure it has values for all its instance variables. Tip: you don't need to use Scanner to collect input from keyboard. For simplicity, you can use hard-code values for parameters.
• call toString() method of Customer class and use system.out.println() to print out the returned value.
• create an Account object and make sure it has values for all its instance variables. Similarly, you can use hard-code parameter values.
• call deposit and withdraw methods of the Account object. Similarly, you can use hard-code parameter values as deposit and withdrawal amounts.
• call toString() method of Account class and use system.out.println() to print out the returned value.


4) In the following class diagram, Account was defined in the above step 2). Now define SavingAccount.java in which (8 points)
• the constructor uses four passed-in parameters to update values of all instance variables.
• toString() returns a String for all instance variable values of an SavingAccount object. A sample return value of toString() for an SavingAccount object is as follows. The interest rate has three decimal places.
Customer ID: 4838156\nName: John Smith\nAccount Number: 5820389\nBalance: $5,280.05\Interest Rate: 2.750%

Account
- accountNo: int
- customer: Customer
- balance: double


+ Account(int, Customer, double)
+ getAccountNo(): int
+ setAccountNo(int)
+ getCustomer(): Customer
+ setCustomer(Customer)
+ getBalance(): double
+ setBalance(double)
+ deposit(double)
+ withdraw(double): boolean
+ toString(): String


SavingAccount
- interestRate: double
+ SavingAccount (int, String, String, double)
+ getInterestRate(): double
+ setInterestRate(double)
+ toString(): String

Reference no: EM132077783

Questions Cloud

Find all of the different stores that are in the central : How would i find all of the different stores that are in the 'central' district?.
Prepare a job claim statement : ACC703 Accounting Information - King’s Own Institute - You may contact the employer and get the position description to contain a more in depth description
Define and test these two python functions : Define and test these two Python functions. You must use recursion to define them: you are not allowed to use loops or local variables.
Make an interface that allows the user to search for an item : Make an interface that allows the user to search for an item with a nice background photo.
Create an account object and make sure it has values : Create an Account object and make sure it has values for all its instance variables. Similarly, you can use hard-code parameter values.
What is the maximum profit : How many pounds of each blend should she make to maximize profits? What is the maximum profit?
Write a method to recursively computer ackermann function : Write a method to recursively computer the Ackermann function. Note that the Ackermann function grows extremely quickly for even small values of m and n.
Find the first derivative of f(x) : Let f(x)=e^e^x. Answer the following questions. 1. Find the first derivative of f(x).
Write a program that reads the data from the file produced : Write a program that reads the data from the file produced in Part A, and produces a report showing the courses taught .

Reviews

Write a Review

JAVA Programming Questions & Answers

  Difference between string and stringbuilder

What is the difference between string and StringBuilder? What are the advantages and disadvantages of a StringBuilder

  What are the tools available and limitations

You have found out that your team is not familiar with the Active Directory Tools. What are the tools available and limitations.

  Problem regarding the java bytecode analysis

One property of a Java program that is checked by the veri?er is that each object must be properly initialized before it is used. This property is fairly dif?cult to check. One relatively simple part of the analysis, however, is to guarantee that ..

  Create java program to find number of days left in that year

Create a Java program called "DaysLeftInYear.java" that outputs the number of days left in that year. use the calendar class to represent dates. Use the DateFormat class to display the current date in the output.

  Evaluate the sorting algorithms

Create an Evaluator class that will evaluate the sorting algorithms you learned about in this chapter - evaluate each sorting algorithm with each of the 3 array

  What are the benefits of the improvements made to program

Write a 1-2 page paper explaining what are the benefits of the improvements made to the program and the meaning behind each improvement. Please do not forget to include any references if used.

  Write a program that assigns seats on an airplane

Prepare a program that teaches arithmetic to a young child. The program tests subtraction and addition. Write a program that assigns seats on an airplane.

  Create a class that represents a toaster

Create a class that represents a Toaster - Is there something in the slots?

  Develop the simplified p2p file sharing system

develop the simplified P2P file sharing system - A peer needs to ignore the requests from itself because by default IP multicast sends a message to every peer

  Prepare demo program that implements all of above method

Specify, design, and implement a class that can be used in a program that simulates a combination lock.

  Java socket hello i need to this assignment done in net

hello i need to this assignment done in net beans . and i want comment in code .also screen shots of running program

  Write a list of animal and its characteristics to a database

Write a list of animal and its characteristics to a database using JDBC. Display the characteristics of an animal when that animal is selected.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd