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 the instance variables to 0, null, and null;
- the second constructor uses three passed-in parameters to update values of the instance
- toString() method return a String value for all instance variables of a Customer object. A sample value of toString() for a Customer object is as
Customer ID: 4838156 Name: John Smith
Define Account.java according to the following class diagram and information
- the constructor uses three parameters to update values for account number, customer, and
- deposit(double) uses value from the input parameter to update the existing balance (by adding the parameter’s amount to existing balance).
- withdraw(double) reduces the current balance by the value of the 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
- toString()returns a String for all instance variable values of an Order object. A sample value of toString() for an Order object is as
Customer ID: 4838156 Name: John Smith Account Number: 5820389 Balance: $5,280.05
Define AccountApp.java according to following requirements to interact with the Customer and Account classes
- create a Customer object and make sure it has values for all its instance variables-you can use hard-code values for the
- call toString() method of Customer class and use system.out.println() to print out the returned
- create an Account object and make sure it has values for all its instance variables. Similarly, you can use hard-code parameter
- call deposit and withdraw methods of the Account object. Similarly, you can use hard-code parameter
- call toString() method of Account class and print out the returned
Need assistance with this?