Posted at 10.17.2018
Inheritance & Polymorphism
Given Person category definition below:
private String name;
this. name = name;
public String getName()
- Design two subclasses of Person, named Student and Staff. Make Faculty and Staff subclasses of Employee. An instance of Pupil has a course status (freshman, sophomore, junior, and older). Declare the position as constants in the College student class. An example of Employee has a division, salary, and date-hired. Define a course named MyDate which has fields of the year, month, and day. A faculty member has office time and a get ranking (lecturer, mature lecturer, associate teacher, and professor). A staff member has a posture subject. Override the toString() method in
- Person class to show the class name and the individuals name.
- Student class to show category name, student's name and class status.
- Employee class to display category name, employee's name, and department
- Faculty class to show category name, employee's name, office time and rank
- Staff class to display course name, employee's name, position title
- Draw a category diagram to symbolize the partnership of the classes above.
- Using Java to write and execute the classes with regard to the course diagram.
- Write a test program in Java that creates cases of Person, Student, Staff, Faculty, and Staff, and invokes their toString() method.
- Write another test program in Java that creates cases of Person, Student, Employee, Faculty, and Personnel in an array of Object. Utilize a repetition declaration to call its toString() method.
- Modify the classes in question (1) above:
- Add a package deal ctb2209. p7 to Person class, and then compile all the classes again. Clarify the problems and correct it.
- Design a category named Square which has data fields for elevation, width, and an abstract method named computeSurfaceArea(). Create a child class known as Cube. Cube contains yet another data field known as depth, and overrides computeSurfaceArea() method inherited from its parent or guardian method.
- Implement all the classes.
- Write an application that instantiates objects of Square and Cube within an array and displays the surface regions of each subject using iteration, and test all the techniques of all objects.
Create an abstract Vehicle class with fields for the automobile make and price. Include get and arranged methods for these domains; the calculatePrice() method is abstract. Create two subclasses for specific automobile creators (for example, Ford or Honda), you need to include appropriate calculatePrice() method in each subclass (for example, RM110, 000 or RM120, 000 respectively).
- Finally, write an application that uses the auto class as reference point type and instantiate items of its subclasses to display information about different vehicles. Save the data files as Auto. java, Ford. java, Honda. java and UseAutoMobile. java.
- Create an program called Player. The user interface comes with an abstract method called play() that presents a message explaining the meaning of "play" to the class. Create classes called Child, Musician, and Actor that put into action Player program. Create a credit card applicatoin that demonstrates the use of the classes. Save the files as Player. java, Child. java, Acting professional. java, Musician. java, and UsePlayer. java.
Sunway Construction Loan Corporate makes loans as high as RM100, 000, 000, 000 for construction projects. A couple of two types of Lending options - those to businesses and the ones to individual candidates.
- Write a credit card applicatoin that tracks all new construction loans. The application form must also determine the total amount owed at the deadline (original loan amount + loan fee). The application form should include the following classes:
- LoanConstants - A open public interface course. LoanConstants includes frequent worth for short-term (one year), medium-term (three years), and long-term (five years) loans. It also consists of constants for the company name and the utmost loan amount.
- Loan - A open public abstract class that implements the LoanConstants software. A Loan includes a loan amount, customer last name, amount of loan, interest rate, and term. The constructor requires data for each of the areas except interest. Don't allow loan amounts over RM100, 000, 000, 000. Force any loan term that's not one of the three described in the LoanConstants category to a short-term (one-year) loan. Produce a toString() method that presents all the loan data.
- BusinessLoan - A general public class that extends Loan. The BusinessLoan constructor packages the interest rate to 1% over the existing basic interest rate.
- PersonalLoan - A general public class that stretches Loan. The PersonalLoan constructor models the interest to 2% over the existing basic interest rate.
CreateLoans - A credit card applicatoin that creates an array of five Loans. Prompt that user for the existing basic interest rate. Then, in a loop, fast the user for a loan type and all relevant information for that loan. Store the created Loan objects in the array. When data admittance is complete, display all the loans.
Save the documents as Loan. java, LoanConstants. java, BusinessLoan. java, PersonalLoan. java, and CreateLoans. java.
[Be aware: java. util. Day and java. words. SimpleDateFormat may needed for your total balance due at the due date calculation, you may go through the use of format() and parse() ways of SimplateDateFormat course]
Examples of completed orders
More than 7 000 students trust us to do their work
90% of customers place more than 5 orders with us