Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Foo210526a {
- private Pet[] petList = new Pet[20];
- public void editPetInfo() {
- Scanner sc = new Scanner(System.in);
- System.out.println("Enter the name of the pet you would like to edit. \n");
- String nam = sc.nextLine(); // Pet name input to edit
- nam = nam.toLowerCase();
- boolean found = false;
- for (int i = 0; i < petList.length; i++) {
- if (nam.equals(petList[i].getName())) {
- found = true;
- System.out.println("Choose attribute to change for " + petList[i].getName());
- System.out.println(" 1) Type \n 2) Size \n 3) Weight (decimal) 4) Age (whole number) \n");
- int opt = sc.nextInt();
- String type, size;
- Double weight;
- int age;
- }
- }
- }
- }
- class Pet {
- private String name = "";
- public String getName() {
- return name;
- }
- }
Add Comment
Please, Sign In to add comment