Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is for JAVA programming: Create a class named Puppy. Each Puppy has the following properties: Age-indicates the puppy's age in weeks Sex - either
This is for JAVA programming:
Create a class named Puppy. Each Puppy has the following properties: Age-indicates the puppy's age in weeks Sex - either male or female Price-sales price-shall not be lower than $100 or greater than $500 hasShots-a Boolean either true or false For each of these properties create a getter and setter method. Also create a Puppy method which will display all the values of the Puppy properties. In the setter method ensure that a puppy's age must be between O and 16 weeks. If the age is outside this range set the age to -1. Write a TestPuppy class. This class will create a Puppy object and prompt the user to enter the Puppy's age, sex, Price and hasShots indicator. Do not let the user proceed unless the price is between $100 and $500. Ensure that the only two acceptable entries for sex are "male" or "female". Use a while loop to ensure data entered is within the price and sex data limits. After all the data is entered, Display all the object's property valuesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started