Question: Create a class Customer having following members: private int custNo private String custName private String custPhone Parameterized constructor to initialize all instance variables Getter methods

Create a class Customer having following members:
private int custNo
private String custName
private String custPhone
Parameterized constructor to initialize all instance variables
Getter methods for all instance variables
Perform following validations in the constructor
custNo must be 4 digit number
custPhone must be have 10 digits
When any of these validation fails then raise a user defined exception
InvalidCustNoException and InvalidPhoneException
Create a class TestCustomer having main method. Ask user to enter customer
details. Create an object of Customer and perform validations. Print details of
customer.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!