Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- import java.util.Scanner;
- public class mainCat {
- public static void main(String[] args)
- {
- cat cat;
- Scanner in = new Scanner(System.in);
- String name, type;
- boolean water, meow;
- System.out.printf("Enter the cat's name: ");
- name = in.next();
- while(!name.equals("*"))
- {
- System.out.printf("Enter the cat's type: ");
- type = in.next();
- System.out.printf("Does your cat like to meow? <T or F> ");
- meow = in.next().charAt(0) == 'T' ? true : false;
- System.out.printf("Does your cat like water? <T or F> ");
- water = in.next().charAt(0) == 'T' ? true : false;
- cat = new cat(name, type, water, meow);
- System.out.printf("%s\n", cat.data());
- System.out.printf("%s\n", cat.meow());
- System.out.printf(cat.water() ? "I like water!\n" : "I don't like water!\n");
- System.out.printf("Enter the cat's name: ");
- name = in.next();
- }
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement