Advertisement
RexyBadDog

Lesson012_28_08_19_Task1

Aug 30th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.67 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Lesson012_28_08_19_Task1 {
  4.     private static Scanner sc = new Scanner(System.in);
  5.     public static void main(String[] args) {
  6.         String name, color, food;
  7.         int whiskersLen, fights;
  8.  
  9.         Cat c1 = new Cat();
  10.         System.out.println("c1 is: " + c1.toString());
  11.         StreetCat c2 = new StreetCat();
  12.         System.out.println("c2 is: " + c2.toString());
  13.         SiamiCat c3 = new SiamiCat();
  14.         System.out.println("c3 is: " + c3.toString());
  15.  
  16.         System.out.println("-=-=-=-=-=-  New Street Cat -=-=-=-=-=-");
  17.         System.out.print("Please enter new cat's name: ");
  18.         name = sc.nextLine();
  19.         System.out.print("Please enter whiskers hair length: : ");
  20.         whiskersLen = sc.nextInt();
  21.         sc.nextLine();
  22.         System.out.print("Please enter the cat's color: ");
  23.         color = sc.nextLine();
  24.         System.out.print("Please enter number of fights: ");
  25.         fights = sc.nextInt();
  26.         StreetCat cat1 = new StreetCat(name, whiskersLen, color, fights);
  27.  
  28.         System.out.println("-=-=-=-=-=-  New Siami Cat -=-=-=-=-=-");
  29.         System.out.print("Please enter new cat's name: ");
  30.         name = sc.nextLine();
  31.         System.out.print("Please enter whiskers hair length: : ");
  32.         whiskersLen = sc.nextInt();
  33.         sc.nextLine();
  34.         System.out.print("Please enter the cat's color: ");
  35.         color = sc.nextLine();
  36.         System.out.print("Please enter the cat's favorite food: ");
  37.         food = sc.nextLine();
  38.         SiamiCat cat2 = new SiamiCat(name, whiskersLen, color, food);
  39.         System.out.println(cat1.toString() + "\n" + cat2.toString());
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement