Question: import java.util Scanner; public class Dog extends Pet { I / declare instance Variables public int dogSpaceNumber; / / public integer public dolang / ming:

import java.util Scanner;
public class Dog extends Pet {
I/declare instance Variables
public int dogSpaceNumber; // public integer
public dolang/ming: /pubic olean true = yes or false = no
Il initialized the base characteristics of the Pet class, so that the I/ Dog class can inherit its features.
public Dog String petName, int petAge, int dogSpaces, int daysStay,
int dogSpaceNumber, double dogWeight, boolean grooming){
Il set cat spaces and amount due to zero, irrelevant to Dog Class and/or assignment.
HRering io ine member of curent bets from wihin the istance method or constructor.
// I don't understand how to describe this. But,
// public int petType = "dog";
Il is equivalent to
// this.petType = "dog";
I| Also using "this" to call other constructors in the same class (explicit constructor invocation) throughout.
this.petType = "dog";
this.petName = petName;
this.petAge = petAge;
this.dogSpaces = dogSpaces;
this.daysStay = daysStay;
this.dogSpaceNumber = dogSpaceNumber;
this.dogWeight = dogWeight;
this.grooming = false;
}
Il constructor is called with no arguments, 3 default fields will populate.
public Dog({
this.dogWeight =0;
this.dogWeight =0;
this.grooming = false;
Il constructor called with 2 arguments, 1 default field.
public Dog(int dogSpaceNumber, double dogWeight){
this.dogSpaceNumber = dogSpaceNumber;
this.dog Weight = dogWeight;
this.grooming = false;
Il assessor method for dogSpaceNumber, returns dogSpaceNumber.
public int getDogSpaceNumber {
return dogSpaceNumber;
}
Il mutator method for dogSpaceNumber, with parameter new value of dogSpaceNumber.
public void setDogSpaceNumber(int dogSpaceNumber){
this.dogSpaceNumber = dogSpaceNumber;
// Validates user input. If space numbers less than 0 or greater than 30 are called,
I/ an error message will be displayed. Additionally, the space number selected is displayed.
Il Zero is a default place holder.
if (this.dogSpaceNumber <0){
System.out.println"ERROR: Enter a valid space number. InMust be between 1-30.");
System.out.printin("Dog Space Number Selected: "+ this.dog SpaceNumber);
} else if (this.dogSpaceNumber >31){
System.out.printin("ERROR: Enter a valid space number. InMust be between 1-30.");
System.out.print/n("Dog Space Number Selected: "+ this.dogSpaceNumber);
Il default is set to zero, if empty constructor DOG() is called.
} else if (this.dogSpaceNumber ==0){
System.out.printin("Default Space Number. InSet space number between 1-30");
} else if (this.dogSpaceNumber >0 && this.dogSpaceNumber <31){
System.out.printin("Dog Space Number Selected: "+ this.dogSpaceNumber);
Il assessor method for dogWeight, returns dogWeight.
public double getDog Weight){
return dogWeight;
}
Il mutator method for dogweight, with parameter new value of dogWeight.
oublic void setDogWeight(double dogWeight){
this.dogWeight = dogWeight;
Il validates weight input. Outputs string with daily boarding fee and grooming fee to user.
I/ displays error message for weights less than 0.
if(this.dogWeight <0){
System.out.println("ERROR: Enter valid weight.");
else if (this.dogWeight >0.0 && this.dogWeight <20.0)<
Il unsure if this is appropriate for the pet check-in process, the specification document is Il unclear. But it makes sense to only have to have this done here to me. With the boolean Il being set in "isgrooming" if daysStay >2. amountDue +=(28.00* daysStay);
if (isGrooming)){
amountDue +=19.95;
}
System.out.println("Boarding fee: $28.00 a day. InGrooming fee: $15.95");
else if (this.dogWeight >19 && this.dogWeight <31){ amountDue +=(29.00* daysStay);
if (isGrooming)){
amountDue +=28.95;
System.out.println"Boarding fee: $29.00 a day. InGrooming fee: $28.95");
else if (this.dogWeight >30){ amountDue +=(34.00* daysStay);
if (isGrooming)){
amountDue +=29.95;
System.out.print/n("Boarding fee: $34.00 a day. InGrooming fee: $29.95");
Il assessor method for isgrooming, returns grooming (if true or false).
public boolean isGrooming){
return this.grooming;
Il mutator method for grooming, with parameter new value of grooming.
public void setGrooming(String selectGrooming, int daysStay){
Il if (this.grooming){
// If the daysStay is greater than 1 and the petType is equivalent to dog
Il (ignores String case) then move on to next if statement. Else if I/ the petType isn't DOG or the daysStay is less than 2, OUTPUT I/ grooming not available to user.
if (daysStay >1) && (petType.equalsIgnoreCase("dog"))){
// If user typed in "yes" for String selectGrooming (ignores case), then this.grooming
// is set to true. Confirmation is then OUTPUT to the user. Else if this.grooming
// is set to false. Message is the OUTPUT to user that grooming was declined.
IITODO this isn't working properly, pets class isn't complete and daysStay is I/TODO collected in the Pet Class file.
System.out.printin("Grooming Available.In Enter \"yes" to select groom

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!