Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Directions Points The file must be called (driver) (handles variables and methods for the Pet Class) Proper coding conventions required the first letter of the

Directions Points The file must be called (driver) (handles variables and methods for the Pet Class) Proper coding conventions required the first letter of the class start with a capital letter and the first letter of each additional word start with a capital letter. Only submit the .java files needed to make the program run. Do not submit the .class files or any other files. 5% Style Components Include properly formatted prologue, comments, indenting, and other style elements as shown in Chapter 2 starting page 64 and Appendix 5 page 881-892. 5% Topics covered in chapter Topics with * are covered in this assignment. Ensure you use every item listed below with an * in your completed assignment. *Object Oriented Programming *Driver Class Calling Objects, this reference *Instance Variables Tracing UML *Local Variables *The return statement *Argument Passing *Specialized Methods *Accessor, *Mutator, and Boolean Methods Problem Solving with Simulation (optional) Basic Guidelines You will be making a very basic Pet Tracker. You will be tracking type, name, age, etc and outputting some information at the end. LiFiUnit6.java (driver) Provide a driver class that has the following items: Creates 3 instances of your LiFiUnit6Pets class. You may use a loop but it is not required. 60% Gets input for first type, name as String. Notice in the example how the prompts change once the name has been entered. Get input for age as integer. Get input for weight as double. Get input for isMale as Boolean. For all pets, use the default constructor and use proper mutator methods to set all variables. Create a class method (in your driver), that counts the number of dogs and the number of cats. It is recommended you create one method called countPets that accepts the pet instance, type, and 0 as a constant for number. This method should return the number of the pet set to it. This method is required but how it works is up to you. After counting the pets, if you have 1 or more dogs and 1 or more cats, output I sure hope the cats and dogs get along. Call displayPet method from your Pets class. LiFiPets.java Provide a pets class that has accessor/mutator methods for all variables pertaining to the pets above. Create a method called displayPet and output the values for all pets, see sample below. Ensure to output Male or Female based on isMale. Cal lthis method for each pet. Sample output is provided below. Be sure to mimic it exactly except for values entered. 30% NOTE: Complete your activity and upload to assignment. Total Percentage 100% Sample Notice how once the name is input, the name is used in the following prompts. The below example has 2 dogs and 1 cat so notice the output about hoping the pets get along. Welcome to the Java Pet Tracker. Please enter the type of Pet #1 (Dog or Cat): Dog Please enter the name of Pet #1: Max Please enter the age of Max: 3 Please enter the weight of Max in pounds (example 5.2): 85.2 Is Max Male (true/false): true Please enter the type of Pet #2 (Dog or Cat): Dog Please enter the name of Pet #2: Buddy Please enter the age of Buddy: 4 Please enter the weight of Buddy in pounds (example 5.2): 75.6 Is Buddy Male (true/false): true Please enter the type of Pet #3 (Dog or Cat): Cat Please enter the name of Pet #3: CiCi Please enter the age of CiCi: 10 Please enter the weight of CiCi in pounds (example 5.2): 10.6 Is CiCi Male (true/false): false Calculating Pet Population and Stuff I sure hope the cats and dogs get along! Pet Registration Information: Type: Dog Name: Max Age: 3 Weight: 85.2 Sex: Male Type: Dog Name: Buddy Age: 4 Weight: 75.6 Sex: Male Type: Cat Name: CiCi Age: 10 Weight: 10.6 Sex: Female The below examples is of all Cats so notice no statement about hoping they get along. Welcome to the Java Pet Tracker. Please enter the type of Pet #1 (Dog or Cat): Cat Please enter the name of Pet #1: CiCi Please enter the age of CiCi: 10 Please enter the weight of CiCi in pounds (example 5.2): 10.7 Is CiCi Male (true/false): false Please enter the type of Pet #2 (Dog or Cat): Cat Please enter the name of Pet #2: Zeus Please enter the age of Zeus: 2 Please enter the weight of Zeus in pounds (example 5.2): 7.6 Is Zeus Male (true/false): true Please enter the type of Pet #3 (Dog or Cat): Cat Please enter the name of Pet #3: Strawberry Please enter the age of Strawberry: 2 Please enter the weight of Strawberry in pounds (example 5.2): 11.6 Is Strawberry Male (true/false): false Calculating Pet Population and Stuff Pet Registration Information: Type: Cat Name: CiCi Age: 10 Weight: 10.7 Sex: Female Type: Cat Name: Zeus Age: 2 Weight: 7.6 Sex: Male Type: Cat Name: Strawberry Age: 2 Weight: 11.6 Sex: Female

I've been working on this program for two days now and I cannot get it to work usually due to not knowing how to set the objects outside of the scan

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

mple 10. Determine d dx S 0 t dt.

Answered: 1 week ago