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):
![How many persons do you want to input? 3
Enter information for person 1:
Name: Tom
Sex ('F' or 'M') : M
Age: 19
Singer or Dancer ('S' or 'D'): S
Favorite song: song1
ASA rank (1,2, or 3): 2
Enter information for person 2:
Name: Jerry
Sex ('F' or 'M') : M
Age: 18
Singer or Dancer ('S' or 'D'): D
Favorite dance: dancel
ADA rank (1,2, or 3): 3
Enter information for person 3:
Name: Alice
Sex ('F' or 'M'): F
Age: 20
Singer or Dancer ('S' or 'D'): D
Favorite dance: dance2
ADA rank (1,2, or 3): 1
The persons you entered are:
Tom is male and is 19 years old and is an ASA rank 2 singer with
favorite song song1.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F2c4edb98-69de-41ca-82a1-574ea53bda76%2Fe56f0df2-77a7-4043-b949-b6060295dc12%2Ffr84ryf_processed.png&w=3840&q=75)
![Jerry is male and is 18 years old and is an ADA rank 3 dancer with
favorite dance dancel.
Alice is female and is 20 years old and is an ADA rank 1 dancer with
favorite dance dance2.
All the persons sorted by age are:
Jerry is male and is 18 years old and is an ADA rank 3 dancer with
favorite dance dancel.
Tom is male and is 19 years old and is an ASA rank 2 singer with
favorite song song1.
Alice is female and is 20 years old and is an ADA rank 1 dancer with
favorite dance dance2.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F2c4edb98-69de-41ca-82a1-574ea53bda76%2Fe56f0df2-77a7-4043-b949-b6060295dc12%2F7qfn7u_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 7 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Where is the second part of the code that prints the people in order of age? Seen in the example output.
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)