The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
I am having some issues with getting the attached code to compile for my basic java pet tracker in order to track type, names, age, etc.  I need help creating a driver class that will show all of the requirements listed in the instructions that are attached.  Any and all help is appreciated!  Thank you!
Â
/
********************************************************************************
**************
* TGUnit6.java
* Gabriel Thrower
*
* A Program for getting Pet data and outputting the Pet information.
********************************************************************************
***************/
import java.util.*; //Import All of Utility Class
public class TGUnit6.java
{
public static void main(String args)
{
/* Pet objects */
NMPet Pet1 = new NMPet();
NMPet Pet2 = new NMPet();
NMPet Pet3 = new NMPet();
Scanner inputScanner = new Scanner(System.in);
System.out.println("Welcome to the Java Pet Tracker!\n");
/* Pet 1 Description */
System.out.print("Please enter the type of Pet #1 (Dog or Cat): ");
Pet1.setPetType(inputScanner.next());
System.out.print("Please enter the name of Pet #1: ");
Pet1.setPetName(inputScanner.next());
System.out.print("Please enter the age of " + Pet1.getPetName() + ":
"); Pet1.setPetAge(inputScanner.nextInt()); System.out.print("Please enter the weight of " + Pet1.getPetName() +
" in pounds (example 5.2): ");
Pet1.setPetWeight(inputScanner.nextDouble());
System.out.print("Is " + Pet1.getPetName() + " Male (true/false):
"); "); Pet1.setPetIsMale(inputScanner.nextBoolean());
/* Pet 2 Description (Using Option 2) */
System.out.print("\nPlease enter the type of Pet #2 (Dog or Cat):
String sPetType = inputScanner.next();
System.out.print("Please enter the name of Pet #2: ");
String sPetName = inputScanner.next();
System.out.print("Please enter the age of " + sPetName + ": ");
int iPetAge = inputScanner.nextInt(); System.out.print("Please enter the weight of " + sPetName + " in
pounds (example 5.2): ");
double dPetWeight = inputScanner.nextDouble();
System.out.print("Is " + sPetName + " Male (true/false): ");
boolean bPetIsMale = inputScanner.nextBoolean();
Pet2.setPetIdentity(sPetType, sPetName, iPetAge, dPetWeight,
bPetIsMale); /* Pet 3 Description */
System.out.print("\nPlease enter the type of Pet #3 (Dog or Cat):
"); Pet3.setPetType(inputScanner.next());
System.out.print("Please enter the name of Pet #3: ");
Pet3.setPetName(inputScanner.next()); "); System.out.print("Please enter the age of " + Pet3.getPetName() + ":
Pet3.setPetAge(inputScanner.nextInt()); System.out.print("Please enter the weight of " + Pet3.getPetName() +
" in pounds (example 5.2): ");
Pet3.setPetWeight(inputScanner.nextDouble());
"); System.out.print("Is " + Pet3.getPetName() + " Male (true/false):
Pet3.setPetIsMale(inputScanner.nextBoolean());
/* Display Pet Information */
System.out.println("\n\nProcess Pet Population ...");
int iDogs = 0; */ /* Count the number of cats and dogs. int iCats = 0;
if (Pet1.getPetType().equals("Dog")) { iDogs += 1; }
else { iCats += 1; }
if (Pet2.getPetType().equals("Dog")) { iDogs += 1; }
else { iCats += 1; }
if (Pet3.getPetType().equals("Dog")) { iDogs += 1; }
else { iCats += 1; } //Display message if there are both Cats and Dogs.
if (iDogs > 0 && iCats > 0) {
System.out.print("I sure hope the Cats and Dogs get
along!\n"); }
System.out.println("\nPet Registration Information:");
Pet1.displayPet();
Pet2.displayPet();
Pet3.displayPet();
} // End Main
} // End Class NMUnit6