This program will be a Doggy Day Care. The menu should be Check in Dog Check Out Dog Exit

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

This program will be a Doggy Day Care. The menu should be

Check in Dog

Check Out Dog

Exit

If the user selects option 1 (Check in Dog), the program will take in all of the information for the dog and create a dog object (which will be stored in the array). All relevant input validation should be done for the information entered. Once the dog object is created, the program should tell the user how much it will be for the dog for the day. The Doggy Daycare can only contain up to 30 dogs. Before a new dog object is created, the program should check that the number of current dog objects is less than 30 (Hint: using the static field). If there are already 30 dogs, then if the user selects option 1, it should say “Sorry, the Doggy Day Care is at capacity”.

If the user selects option 2, it will ask for the owner’s name. It will search the array for that name and return the names of the dogs that the owner has checked in. This will check out those dogs (i.e. remove them from the array). Figure out how to deal with the holes this will create in the array.

When the user selects option 3, the program should write all the information for any dogs left in the array to a file named “YesterdaysLatePickups.txt”. Bonus if you can replace Yesterday with the actual date.

 

Image of my code is in attachment. Output of mine does option 1 only, i can keep on entering dog objects untill count 50 is reached, or if i choose 2 or 3 for which i need help a

thank you

Scanner keyboard = new Scanner(System.in);
GuzicDogl] dog = new GuzicDog[30];
while (true) {
System.out.print("Enter one of the choices from the menu: 1 to check in dog, 2 to check
out, and 3 to exit. ");
choice = keyboard.nextInt();
if (choice == 1) {
System.out.printin("enter dog and owner info below");
info = keyboard.nextLine();
System.out.print("Enter owner name: ");
ownerName = keyboard.nextLine():
System.out.print("Enter dog name: ");
dogName = keyboard.nextLine();
System.out.print("Enter dog breed: ");
breed = keyboard.nextLine();
System.out.print("Enter dog color: ");
color = keyboard.nextLine();
System.out.print("Enter dog weight. ");
dogSize = keyboard.nextDouble();
System.out.print("Enter dog age: ");
dogAge = keyboard.nextInt();
System.out.printin("Did guest bring their own food? Enter Y or N: ");
Transcribed Image Text:Scanner keyboard = new Scanner(System.in); GuzicDogl] dog = new GuzicDog[30]; while (true) { System.out.print("Enter one of the choices from the menu: 1 to check in dog, 2 to check out, and 3 to exit. "); choice = keyboard.nextInt(); if (choice == 1) { System.out.printin("enter dog and owner info below"); info = keyboard.nextLine(); System.out.print("Enter owner name: "); ownerName = keyboard.nextLine(): System.out.print("Enter dog name: "); dogName = keyboard.nextLine(); System.out.print("Enter dog breed: "); breed = keyboard.nextLine(); System.out.print("Enter dog color: "); color = keyboard.nextLine(); System.out.print("Enter dog weight. "); dogSize = keyboard.nextDouble(); System.out.print("Enter dog age: "); dogAge = keyboard.nextInt(); System.out.printin("Did guest bring their own food? Enter Y or N: ");
answer = keyboard.next().charAt(0);
%3D
"Y')
if (answer
{
food = true;
}
else if (answer == 'N')
{
food = false;
}
if(count<30){
dog[count] = new GuzicDog (dogSize, dogAge, dogName, ownerName, breed,
color, food, choice);
System.out.printin();
System.out.println("Owner of this dog is: "+ dog[count] getOwnerName();
System.out.println("Dog name is: "+ dog[count].getDogName());
System.out.printin("This dog is: "+ dog[count].getWeight() +
0 +""+
+ "size "
+ dog[count].getStage() + ""+ dog[count).getColor() +
dog[count].getBreed());
dog[count).setRate());
System.out.printin("Daily price for this dog day care is " +
System.out.printin():
count++;
}
else{
System.out.printin("Sorry, the Doggy Day Care is at capacity");
}
} / if end
else if(choice ==2)
{
Il code for input 2
Transcribed Image Text:answer = keyboard.next().charAt(0); %3D "Y') if (answer { food = true; } else if (answer == 'N') { food = false; } if(count<30){ dog[count] = new GuzicDog (dogSize, dogAge, dogName, ownerName, breed, color, food, choice); System.out.printin(); System.out.println("Owner of this dog is: "+ dog[count] getOwnerName(); System.out.println("Dog name is: "+ dog[count].getDogName()); System.out.printin("This dog is: "+ dog[count].getWeight() + 0 +""+ + "size " + dog[count].getStage() + ""+ dog[count).getColor() + dog[count].getBreed()); dog[count).setRate()); System.out.printin("Daily price for this dog day care is " + System.out.printin(): count++; } else{ System.out.printin("Sorry, the Doggy Day Care is at capacity"); } } / if end else if(choice ==2) { Il code for input 2
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

this answer hasnt cover all the questiion. Would you cover the all part of the question?

Solution
Bartleby Expert
SEE SOLUTION
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY