Advertisement
Pein_Calamity

Untitled

May 9th, 2017
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. //Rodney Seals.  Pets Project for Mr. Carter
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main
  6. {
  7.  
  8.     public static void main(String[] args)
  9.     {
  10.         Scanner input = new Scanner(System.in);
  11.         Pet PetObject = new Pet();
  12.        
  13.         System.out.println("What kind of pet do you have?");
  14.         String getPetType = input.nextLine();
  15.        
  16.         System.out.println("How old is your pet?");
  17.         String getPetAge = input.nextLine();
  18.        
  19.         System.out.println("What is your pet's Name?");
  20.         String getPetName  = input.nextLine();
  21.        
  22.  
  23.         PetObject.setAge(getPetAge);
  24.         PetObject.setType(getPetType);
  25.         PetObject.setName(getPetName);
  26.     }
  27.  
  28. }
  29.  
  30. //Pet's Class
  31.  
  32. public class Pet
  33. {
  34. //I used print, string, println for looks.  I think it looks better this way.
  35.     public void setName(String getPetName)
  36.     {
  37.     System.out.print("Your pet's Name is " + getPetName); System.out.println(".");
  38.     }
  39.     public void setAge (String getPetAge)
  40.     {
  41.     System.out.print("Your pet is " + getPetAge); System.out.println(" years old.");
  42.     }
  43.     public void setType (String getPetType)
  44.     {
  45.     System.out.print("Your pet is a " + getPetType); System.out.println(".");
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement