Question: this is java: Main.javause onlinegdb.com to create the codeplease show the picture of the code Write a Person class with the following attributes: Name Age

this is java: Main.javause onlinegdb.com to create the codeplease show the picture of the code

Write a Person class with the following attributes: Name Age The class

Write a Person class with the following attributes: Name Age The class person should have constructors, get and set methods. Define two unchecked exceptions with constructors that take a message of String. It should pass the message to the super class. InvalidNameException InvalidAgeException Update the Person class so that set methods will check the values of the parameters. For example, the name must not be an empty string and the age must be a number between 0 and 130. If the name is empty, it should throw InvalidNameException. If the age is invalid, it should throw InvalidAgeException. The constructor should use these two set methods when initialize the instance variables with values of the parameters. Write a main class that prompts the user to create three person objects. It should handle any exceptions so that the user must enter only valid input. If an exception occurs, it should prompts for the information for that person again.

Step by Step Solution

3.39 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javautilScanner class InvalidNameException extends RuntimeException public InvalidNameExcepti... View full answer

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!