Question
This is a question for my assignment, please respond with the correct code as soon as you can. To be done on Java. Will upvote
This is a question for my assignment, please respond with the correct code as soon as you can. To be done on Java. Will upvote definitely, thanks!
Part A
/** A class to model an executive. */ public class Executive extends Manager { private int bonus; /** Make an executive with a given name, salary, department and bonus. @param name the name @param salary the salary @param department the department @param bonus the bonus */ public Executive(String name, double salary, String department, int bonus) { //-----------Start below here. To do: approximate lines of code = 2 // Initialize the inherited variables using the super() keyword // also initialize the new instance variable bonus //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions. }
/** Provide a string description of an executive. */ public String toString() { //-----------Start below here. To do: approximate lines of code = 1 // Override the method toString() from super class Manager //Hint: use the super. (see toString() method in Manager) // and add " Bonus: " followed by the bonus value to the returned string //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions. } }
Part B
/** A class to model a manager. */ public class Manager extends Employee { private String department;
/** Make a manager with a given name, salary, and department. @param name the name @param salary the salary @param department the department */ public Manager(String name, double salary, String dept) { //-----------Start below here. To do: approximate lines of code = 2 // Initialize the inherited variables name and salary using the super() keyword // initialize the new instance variable department //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions. }
/** Provide a string description of a manager. */ public String toString() { //-----------Start below here. To do: approximate lines of code = 1 // Override the method toString() from super class Employee //Hint: use the super. (see toString() method in Employee) // and add " Department: " followed by the department name to the returned string //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions. } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started