Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java project Project Person class. Thursday April 5 Write a Person class that encapsulates a person. The instance variables will be a string that will

Java project
image text in transcribed
Project Person class. Thursday April 5 Write a Person class that encapsulates a person. The instance variables will be a string that will hold the name and an integer that will hold the age. Person will have the following methods: read0. setName(String), setAge(int), setPerson(String, int), String getName0, int getAge), boolean equals(Person), boolean hasSameName(Person), boolean hasSameAge(Person), boolean isOlderThan(Person), toString).Methods read0. setAge(), setPerson) must guarantee that age is never less than zero. The read) method should use a while loop to reenter age and the other two use an if statement and use System.exit(0). Write a main that tests all of the methods you have written

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions