Question: Java API 1) Create a class in called BadDataException. Must inherit from the API classRuntimeException. Add a private String called message. Add two constructers (default

Java API

1) Create a class in called BadDataException. Must inherit from the API classRuntimeException. Add a private String called message. Add two constructers (default and the overloaded constructors).

2) Create a class called Student

-Two fields: String name and String StudentNumber

-A public getter and setter for each field

-Two constructors (defualt and overloaded). When default intial values are required, set name and studentNumber to "Unknown".

-Inside setName() throw a badDataException withand appropriate message for the following rules: String cannont be null, String cannon have a length of zero, String cannot consist of only White Space, String cannot contain a comma

-Inside the setStudentNumber() method throw a BadDataException with an apporpriate message for the following rules: String can only be made of digits 0-9, String must be five digits in length

-New class with a main mehtod called Lab5Tester

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 Databases Questions!