Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Rodney Seals. Pets Project for Mr. Carter
- import java.util.Scanner;
- public class Main
- {
- public static void main(String[] args)
- {
- Scanner input = new Scanner(System.in);
- Pet PetObject = new Pet();
- System.out.println("What kind of pet do you have?");
- String getPetType = input.nextLine();
- System.out.println("How old is your pet?");
- String getPetAge = input.nextLine();
- System.out.println("What is your pet's Name?");
- String getPetName = input.nextLine();
- PetObject.setAge(getPetAge);
- PetObject.setType(getPetType);
- PetObject.setName(getPetName);
- }
- }
- //Pet's Class
- public class Pet
- {
- //I used print, string, println for looks. I think it looks better this way.
- public void setName(String getPetName)
- {
- System.out.print("Your pet's Name is " + getPetName); System.out.println(".");
- }
- public void setAge (String getPetAge)
- {
- System.out.print("Your pet is " + getPetAge); System.out.println(" years old.");
- }
- public void setType (String getPetType)
- {
- System.out.print("Your pet is a " + getPetType); System.out.println(".");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement