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
Ideclare instance Variables
public int dogSpaceNumber; public integer
public dolangming: 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 andor 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, default fields will populate.
public Dog
this.dogWeight ;
this.dogWeight ;
this.grooming false;
Il constructor called with arguments, default field.
public Dogint 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 setDogSpaceNumberint dogSpaceNumber
this.dogSpaceNumber dogSpaceNumber;
Validates user input. If space numbers less than or greater than are called,
I an error message will be displayed. Additionally, the space number selected is displayed.
Il Zero is a default place holder.
if thisdogSpaceNumber
System.out.println"ERROR: Enter a valid space number. InMust be between ;
System.out.printinDog Space Number Selected: this.dog SpaceNumber;
else if thisdogSpaceNumber
System.out.printinERROR: Enter a valid space number. InMust be between ;
System.out.printnDog Space Number Selected: this.dogSpaceNumber;
Il default is set to zero, if empty constructor DOG is called.
else if thisdogSpaceNumber
System.out.printinDefault Space Number. InSet space number between ;
else if thisdogSpaceNumber && this.dogSpaceNumber
System.out.printinDog 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 setDogWeightdouble 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
ifthisdogWeight
System.out.printlnERROR: Enter valid weight.";
else if thisdogWeight && this.dogWeight
Il unsure if this is appropriate for the pet checkin 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 amountDue daysStay;
if isGrooming
amountDue ;
System.out.printlnBoarding fee: $ a day. InGrooming fee: $;
else if thisdogWeight && this.dogWeight amountDue daysStay;
if isGrooming
amountDue ;
System.out.println"Boarding fee: $ a day. InGrooming fee: $;
else if thisdogWeight amountDue daysStay;
if isGrooming
amountDue ;
System.out.printnBoarding fee: $ a day. InGrooming fee: $;
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 setGroomingString selectGrooming, int daysStay
Il if thisgrooming
If the daysStay is greater than 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 OUTPUT I grooming not available to user.
if daysStay && petTypeequalsIgnoreCasedog
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 ITODO collected in the Pet Class file.
System.out.printinGrooming 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
