...
Create a new IntelliJ project and paste in the attached file
Cutomer.java
.Look at the class definition and notice (only notice, follow the instructions below to actually fill the code in) the comments that indicate where you should add your code. Notice that the existing constructor takes a single argument to set the customer’s name, and does not update the account number. Every customer will have their account set to zero.
Create a
CustomerApplication.java
class with a main method. Create a couple of instances of Customer class and test how they work. Anything surprising?In the
Customer
class definition, declare another private instance variable to hold the customer's status aschar
, provide an accessor method -isHeld()
- which returnstrue
if the status is equal to 'H', otherwisefalse
. Also providegetStatus()
method that returns thechar
.Define a second constructor that has two arguments to initialise the customer’s status as well as their name. If the value received is not ‘A’ or ‘I’ or ‘H’ (for active, inactive or on-hold), then set it to ‘H’. Remember that you can use
this()
to avoid duplicating code in multiple constructors. Modify the first constructor (which does not receive a char argument) to set the status to ‘A’.Save the project and fix any compiler errors before proceeding. Write up some code in your
main
method to prove that your code is working correctly.
...