Source of Pet3Demo.java


  1: //Pet3Demo.java
  2: 
  3: import java.util.Scanner;
  4: 
  5: public class Pet3Demo
  6: {
  7:     public static void main(String[] args)
  8:     {
  9:         Pet3 yourPet = new Pet3("Jane Doe");
 10:         System.out.println("My records on your pet are inaccurate.");
 11:         System.out.println("Here is what they currently say:");
 12:         yourPet.writeOutput();
 13: 
 14:         Scanner keyboard = new Scanner(System.in);
 15:         System.out.println("Please enter the correct pet name:");
 16:         String correctName = keyboard.nextLine();
 17:         yourPet.setName(correctName);
 18: 
 19:         System.out.println("Please enter the correct pet age:");
 20:         int correctAge = keyboard.nextInt();
 21:         yourPet.setAge(correctAge);
 22: 
 23:         System.out.println("Please enter the correct pet weight:");
 24:         double correctWeight = keyboard.nextDouble();
 25:         yourPet.setWeight(correctWeight);
 26: 
 27:         System.out.println("My updated records now say:");
 28:         yourPet.writeOutput();
 29:     }
 30: }