The code snippet given below is content of a le Kitten.java found in a public repository. Unfortunately, the program cannot be executed because the le Cat.java which denes the class Cat is missing. You are expected to develop the class Cat in a le Cat.java such that Kitten.java is suc- cessfully executed. import java.util.Scanner; 2 public class Kitten { 3 public static void main(String[] args) { 4 Cat myCat = new Cat("Kitty"); 5 double[] movement = promptMove(myCat); 6 myCat.move(movement[0], movement[1]); 7 myCat.showPosition(); 8 myCat.showDistance(); 9 } 10 public static double[] promptMove(Cat myCat) { 11 Scanner input = new Scanner(System.in); 12 char[] directions = {'X', 'Y'}; 13 double[] movement = new double[directions.length]; 14 for (int i = 0; i 15 System.out.printf("Distance to move in %c direction: ", directions[i]); 16 movement[i] = input.nextDouble(); 17 } 18 input.close(); 19 return movement; 20 } 21 }
Get Free Quote!
315 Experts Online