Develop the class Cat in a le Cat.java such that Kitten.java is suc- cessfully executed.

computer science

Description

​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 }


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.