weight = 18

Assignment

Your love of dogs and software meet up in this assignment in which you will create software to manage your fledgling dog walking hobby. Your program will simulate one day of walking three dogs. The user will enter how many times they would like to walk two or more dogs. The program will then simulate taking that many dog walks, and then report a summary of the results for the day.

Your solution will consist of three classes: Dog, DogWalkingService, and Lab8.

Dog
-name: String {readOnly}
-prefersFastWalks: boolean {readOnly}
-solidProductionRate: int {readOnly}
-totalPees: int
-totalPoops: int
-descriptionOfLastWalk: String
+Dog(name: String)
+Dog(name: String, prefersFastWalks: boolean, solidProductionRate: int)
+getName(): String
+walk(lengthInMinutes: int, isFast: boolean): boolean
+getNumberOfWalks(): int
+getTotalTimesPeed(): int
+getTotalTimesPooped(): int
+getDescriptionOfLastWalk(): String
+toString(): String

DogWalkingService
-dog1: Dog {readOnly}
-dog2: Dog {readOnly}
-dog3: Dog {readOnly}
-successCount: int
-numberOfWalks: int
-descriptionOfLastWalk: String
-totalMinutes: int
+DogWalkingService(dog1: Dog, dog2: Dog, dog3: Dog)
+walk2Dogs(lengthInMinutes: int): boolean
+walk2Dogs(lengthInMinutes: int, isFast: boolean): boolean
+walkAllDogs(lengthInMinutes: int): boolean
+walkAllDogs(lengthInMinutes: int, isFast: boolean): boolean
+getNumberOfWalks(): int
+getTotalMinutesWalked(): int
+getNumberOfSuccessfulWalks(): int
+getDescriptionOfLastWalk(): String
+getSummary(): String
See the javadoc comments for the Dog and DogWalkingService classes. Your implementations must follow the requirements described in the documentation.

You must design the Lab8 class that:

  1. Creates three dogs
  2. Adds them to a DogWalkingService object
  3. Asks the user how many walks they plan to take
  4. Conducts the desired number of walks, randomly attempting to walk either two or three dogs each time
  5. Displays a summary of the results

Your program output should look very similar to this:

How many walks do you want to take today? (Each walk will be between 10 and 45 minutes.)
3
Walk 1:
Spot went on a fast 41 minute walk and even pooped.
Spotless went on a fast 41 minute walk.
Yippee is a slow walker and refused to go on this fast walk.
Walk 2:
Spotless went on a slow 30 minute walk.
Yippee went on a slow 30 minute walk.
Walk 3:
Spot went on a fast 17 minute walk and even pooped.
Spotless is a slow walker and refused to go on this fast walk.
Yippee went on a fast 17 minute walk.

The service walked three dogs:
Spot is a slow walker who peed 48 times and pooped 2 times.
Spotless is a slow walker who peed 36 times and pooped 0 times.
Yippee is a slow walker who peed 24 times and pooped 0 times.

We gave 3 walks for a total of 88 minutes of walking time.

Acknowledgement

This laboratory assignment was developed by Dr. Chris Taylor.

See your professor's instructions for details on submission guidelines and due dates.