fubarable

example 210526a

May 26th, 2021
998
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Foo210526a {
  4.     private Pet[] petList = new Pet[20];
  5.    
  6.     public void editPetInfo() {
  7.         Scanner sc = new Scanner(System.in);
  8.         System.out.println("Enter the name of the pet you would like to edit. \n");
  9.         String nam = sc.nextLine();     // Pet name input to edit
  10.         nam = nam.toLowerCase();
  11.         boolean found = false;      
  12.         for (int i = 0; i < petList.length; i++) {
  13.             if (nam.equals(petList[i].getName())) {
  14.                 found = true;
  15.                 System.out.println("Choose attribute to change for " + petList[i].getName());
  16.                 System.out.println(" 1) Type \n 2) Size \n 3) Weight (decimal) 4) Age (whole number) \n");
  17.                 int opt = sc.nextInt();
  18.                 String type, size;
  19.                 Double weight;
  20.                 int age;
  21.             }
  22.         }
  23.     }
  24. }
  25.  
  26. class Pet {
  27.     private String name = "";
  28.    
  29.     public String getName() {
  30.         return name;
  31.     }
  32. }
Add Comment
Please, Sign In to add comment