Lab 2: Dog Walking Tracker Application
Due Date and Submission Requirements
- Due Date: Tuesday, January 30th at 11:59 p.m.
- Partner Information: This is an individual assignment. You are allowed to collaborate with other students, but each student must submit their individual, independent solution.
- Submission Instructions: Upload your solution (.java file), entitled Dog.java to the BrightSpace(D2L) Lab 1 Dropbox.
The goal of this lab is:
- Write a basic Java class (Instance Fields, Methods, Constructor)
- Gain practice writing different kinds of methods
- Use if statements to check conditions
Background and Directions
You've been tasked with writing the needed Java class for a dog walking tracking application. This class holds information about the dog, and tracks how well someone is walking their dog.
Using DogDemo.Java, You will create a Java class, named Dog.java and supply the missing class definitions and methods. You will need to download or copy/paste this code into your local Java project folder. Your Dog.Java class will not have a public static void string args[] method
You first need to define the instance fields and constructor for the Dog class. Each dog will have:
- A name (such as "Tater" or "Lucy")
- A breed (such as "Dachshund" or "Aussie")
- An age (such as 8 years old or 4 years old)
- A weight (such as 14.3 lbs or 44.23 lbs)
- Their weekly walk distances. This is a seven-length array of doubles that holds information for how many miles they were walked for each day during a week. For example, if the array is {0.1, 0.54, 0.0, 1.2, 1.8, 0.0, 1.1} , this means that the dog was walked 0.1 miles on Sunday, 0.54 miles on Monday, 0.0 miles on Tuesday, and so on...
Next, you will need to define and write the code for the following 5 methods.
- getName()- This method returns the name of the dog
- getDogAge()- This method returns the age of the dog in dog years. A dog's age in dog years is (7 * their current age). For example, if a dog is 2 years old, then they are 14 in dog years.
- printInfo()- This method prints out information about a dog, including their name, breed, age, and weigh (see the sample output)
- getTotalMiles()- This method computes and returns the total miles walked in a week. Here, you will use the Dog's weekly walking distance array and find the sum.
- checkWalkingScore- This method takes in the total miles walked (a double) as input, and prints out a message depending on the value of the total miles walked.
- If a dog was walked a total of less than 3.5 miles in one week, then "(insert dog name here) needs to be walked more!" will be printed out
- If a dog was walked a total of more than (or equal to) 3.5, but less than (or equal to) 5.0 miles in one week, then "(insert dog name here) is being walked a healthy amount!" will be printed out
- If a dog was walked a total of more than 5.0 miles in one week, then "(insert dog name here) is being walked a lot!" will be printed out
Rules
You are NOT allowed to modify DogDemo.Java. If you modify DogDemo.Java in any way (other than changing the package statement line), the you will lose significant points!
Starting Code
Required Output
When your program is run, your output should look exactlythe same as seen in this screenshot .
Grading (10 points)
- 2 points - Your Dog class is correctly defined, and has a working constructor method
- 1 points - getName() is correct
- 1 point - getDogAge() is correct
- 1 points- printInfo() is correct
- 2 points- getTotalMiles() is correct
- 2 points- checkWalkingScore() is correct
- 1 point- your program matches the sample output exactly
here is a picture of Tater. He is a good boy