MUST BE IN ONE JAVA FILE Write a Java program A4p1.java with a public class A4p1 and no named packages to read from stdin information for several singers and dancers. You can try with the following design choices: design an abstract superclass Person with appropriate constructor(s) to initialize member variables such as name (of type String), sex (of type String), age (of type int), rank (of type int); design an interface Honorable with one method HowToHonor (of return type String); the Person class can have an abstract method HowToPerform (of return type String) and implement the Comparable interface; design two additional non-abstract subclasses Singer and Dancer of the Person class with appropriate constructor(s) and let them implement the Honorable interface. You can override the toString method of these three classes to provide a suitable string representation for objects of these classes. Put all classes and interfaces in the same file. A sample run can look like the following (you can also try running it with standard input redirection):
MUST BE IN ONE JAVA FILE
Write a Java program A4p1.java with a public class A4p1 and no named packages to read from stdin information for several singers and dancers. You can try with the following design choices: design an abstract superclass Person with appropriate constructor(s) to initialize member variables such as name (of type String), sex (of type String), age (of type int), rank (of type int); design an interface Honorable with one method HowToHonor (of return type String); the Person class can have an abstract method HowToPerform (of return type String) and implement the Comparable interface; design two additional non-abstract subclasses Singer and Dancer of the Person class with appropriate constructor(s) and let them implement the Honorable interface. You can override the toString method of these three classes to provide a suitable string representation for objects of these classes. Put all classes and interfaces in the same file. A sample run can look like the following (you can also try running it with standard input redirection):
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 7 images
Where is the second part of the code that prints the people in order of age? Seen in the example output.