Write a program in Java called CatChoir. It assumes the availability of a class called Cat (do NOT write the Cat class, just assume it is available), and the two Cat methods purr and meow. The program creates 2 Cat objects and sends each of them a purr messages and two meow messages. Neither the constructor for Cat nor its methods require any arguments. The methods are void.
public class CatChoir {
public static void main(String[] args) {
Cat cat1 = new Cat();
Cat cat2 = new Cat();
System.out.println("Cat 1 purr " + cat1.purr());
System.out.println("Cat 1 purr " + cat1.meow());
System.out.println("Cat 1 meow " + cat1.meow());
System.out.println("Cat 2 purr " + cat2.purr());
System.out.println("Cat 2 purr " + cat2.meow());
System.out.println("Cat 2 meow " + cat2.meow());
}
}
Get Answers For Free
Most questions answered within 1 hours.