Make a class Employee with a name and salary. Make a class Manager inherit from Employee. Add an instance variable, named department, of type string. Supply a method tostring that prints the manager's name, department, and salary. Make a class Executive inherit from Manager. Supply appropriate tostring methods for all classes. Supply a test program that tests these classes and methods.
Q: What is the output of java the following code where Student is a subclass of Person class? Person…
A: We need to tell the output of the given Java program. Here Student class is a Subclass of class…
Q: Suppose the class SportsCar is a derived class of a class Automobile,and suppose also that the class…
A: PARENT CLASS: Automobile Methods: accelerate, addGas DERIVED CLASS: SportsCar
Q: Set the last name only. Set the first name only. Set the middle name. Check whether a given last…
A: Note: Since you have not provided the language to write the code so I am using java language to…
Q: Write the Boat class in Java Eclipse. A Boat has a registered name, a number of cabins, and a…
A: I give the code in Java eclipse as per your requirement along with code and output screenshot
Q: Write a class named Person with data attributes for a person’s name, address, and telephone number.…
A: Python program for the above problem is given below:-
Q: Implement a superclasS Person. Make two classes, Student and Instructor, that inherit from Person. A…
A: Programming instructions: Create a class Person. In a Person class, create required variables, a…
Q: Implement a superclass Father that Make two classes, Boy and Girl that inherit from Father. A Father…
A: Java used to answer this question
Q: Redefine the equals method of the class Date (Display 4.13) so that it hasa parameter of type Object…
A: Redefine the equals method of the class Date (Display 4.13) so that it hasa parameter of type Object…
Q: Write a Java enumeration LetterGrade that represents letter grades A through F, including plus and…
A: Answer : /************************************** *The following LetterGradeDemo class class…
Q: Define a new "Degree" class that contains a year (integer), a subject (string) and a person's name…
A: Hey there, I am writing the required solution based on the above stated question. First, I will…
Q: Write a program by creating an 'Employee' class having the following methods and print the final…
A: /* Java program */import java.util.*; class EmployeeDetail { private String name; private float…
Q: Consider a class that could be used to play a game of hangman. The class has the following…
A: Note - As per the guidelines we're only allowed to answer 1 question at a time. Define a main…
Q: Write a class encapsulating the concept of a team (for example, "Orioles"), assuming a team has only…
A: PROGRAM EXPLANATION: Create a class Team. Define the constructor for this class. Declare an…
Q: Write a complete program for the description given below. Consider a Billing class that implements…
A: Note: Since you have not provided the language to write the code so I am using Java language to…
Q: We have a parking office class for an object-oriented parking management system using java Add…
A: The above mentioned question demands a database that will keep record of the vehicles parked in the…
Q: Implement a class Car
A: public class Car{ private double fuelEfficiency; private double fuelLevel; Car(double efficiency){…
Q: Implements an interface having three methods eat, travel, bark
A: Program Plan: Create an interface named Animal In that interface declare methods…
Q: Now write a Demo class which contains main method in order to demonstrate the behavior of all…
A: public class Main{ public static void main(String[] args) { //create Circle instace and…
Q: Write a class named NameAndCount for recording a String data name and an int data named count. A…
A: The NameAndCount class implements a Comparable interface. An interface is a class that contains the…
Q: INTRO JAVA Make a class Employee with a name and salary. Make a class Manager that inherits from…
A: class Employee{String name;double salary;void tostring(){System.out.println("Employee:\nName:…
Q: Given the following class. (JAVA) public class FamilyMember { public String drink( ) {return…
A: logic:- define a constructor taking age as parameter. set this.age=age create a method in baby…
Q: Write the Boat class in Java Eclipse. A Boat has a registered name, a number of cabins, and a…
A: The following is the source code for the given statements in the question.
Q: By the same exact way when we wrote SalariedEmployee, write class HourlyEmployee, CommissionEmployee…
A: A class contains data and operations on that data as one unit. This is known as encapsulation. An…
Q: Write a program by creating an 'Employee' class having the following methods and print the final…
A: Create Employee class. Inside Employee class initialize variable salary and hours. Add Given…
Q: Solve the programming exercise P9.9 on Page 490 on the book. Make a class Employee with a name and…
A: public class Employee{ //declaring instance variables private String name; private double…
Q: ) Implement a class Point with three attributes, x, y, and z. b) Implement an init method with an…
A: GIVEN: Create a program for the above question. NOTE: As programming language is not mentioned, we…
Q: change their state once they are instantiated. How will you implement t
A: All objects of the classes cannot change their state once they are instantiated. How will you…
Q: Write a class that implements Employee class that is described in UML diagram given below. The…
A: class Employee{ //declaring variables private int id; private String firstName;…
Q: Create a parent class Person with one attribute age and one method greet() that prints out "Hello,…
A: I give the code in Java (Because you have not mentioned any specific language )along with output and…
Q: Write a class encapsulating the concept of a corporate name (for example, "IBM"), assuming a…
A: The given problem is related to java programming that will have 2 classes in it. corporate class…
Q: ng method must return all the degree information: year, subject and person’s name in the following…
A: Here is C++ program:
Q: Complete the class LeprechaunGold to model a stash of gold coins at the end of the rainbow. There is…
A: PROGRAM: LeprechaunGold.java: //Defining the class public class LeprechaunGold { //Declaring…
Q: Java program Make a class Employee with a name and salary. Make a class Manager inherit from…
A: According to the Question below the Solution: Output:
Q: We have a parking office class for an object-oriented parking management system using java Add…
A: Below is the code in java and explanation:
Q: Imagine you have two classes: Employee (which represents being an employee) and Ninja (which…
A: Given: Imagine you have two classes: Employee (which represents being an employee) and Ninja (which…
Q: In python, create a class horse that inherits the following attributes and methods from its parent…
A: #Parent class class Animal: #constructor def __init__(self,common_name, given_name, weight):…
Q: Write a java program Write a class named Employee with name and salary as private data fields. Add…
A: The main objective of the program is to create three java files. Employee.java Manager.java…
Q: (Java) Identify the true statements, select all that apply: -Setters and getters are not…
A: 1. Setters and getters are not required for public instance variables. Expalnation: It is possible…
Q: This assignment starts with the Account class from Labs 4 and 5. Our new and improved bank has two…
A: package inheritance; import java.util.*; class Bank { Scanner s=new Scanner(System.in);…
Q: Write a Tourist class to work with the following piece of code: tl Tourist("John", "Smith",…
A:
Q: Modify the GeometricObject class to implement the Comparable interface and define a static max…
A: Code to Copy: import java.util.*; //Implementation of GeometricObject class public class…
Q: Suppose class B is derived from class A, and class C is derived from class B. In other words, we…
A: Child class variables can use parent class objects. However, parent class variables cannot utilize…
Q: Write a class named NameAndCount for recording a String data name and an int data named count. A…
A: The interface is a class that contains the declarations of the methods and the definition of the…
Q: Write a java program Create an Abstract class Student that contains a method take exam, implement…
A: Create an Abstract class Student that contains a method take exam, implement the method in the child…
Q: What is the output of the following code where Student is a subclass of Person class? Person s = new…
A: The answer varies acccording to type of class
Q: Implement a supe lass Person. Маке two classes, Student and Instructor, that inherit from Person. A…
A: // Screenshot of the code & output
Q: Write a superclass called ؛Person (as shown in the class diagram), which contains: • Two instance…
A: public class Tester { public static void main(String[] args) { //creating Person instances…
in java
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- B - RobotFriend Create a RobotFriend class. RobotFriend is a new toy just on the market. Copy the starter class and the tester from Codecheck. A RobotFriend has a name and replies to various commands Provide a constructor that takes the name of the RobotFriend as a parameter. Remember that a constructor has the same name as the class. What does the class need to remember? That is the instance variable. Provide the following methods: public String getName () gets the name of this RobotFriend • public void setName (String newName) sets a new name for this RobotFriend • public String whatDoYouNeed () returns a string consisting of name + needs a battery charge" where name is the name of this RobotFriend (which was supplied in the constructor) public String doCommand (String whatToDo) returns a string consisting of "Your friend " + name + does not + whatToDo where name is the name of this RobotFriend and whatToDo is the parameterJava- Suppose that Vehicle is a class and Car is a new class that extends Vehicle. Write a description of which kind of assignments are permitted between Car and Vehicle variables.Write the Movie class. The UML diagram of the class is represented below: 1. Implement the class strictly according to its UML one-to-one (do not include anythingextra, and do not miss any data fields or methods). 2. Implement a MovieTest class to test the class Movie you just created.• Create two Movie objects: one using the no-args constructor and one from theconstructor with all fields.• Print the contents of both objects. Please submit a screenshot. Hint: toString()method.
- Create a project to play a bunch of games. Add a class that has main() in it. Create an abstract class called Game. Define one instance variable for the name of the game. Define a constructor that takes the name of the game as a parameter and sets it. Define an abstract method called playGame. It takes no arguments and returns void. Create a child class of Game called BoardGame. Rather than implementing playGame, declare BoardGame abstract. Create a child class of BoardGame called Chess or Battleship or Monopoly or whatever board game you want. Implement the playGame with only a message that says the name of the game and that it is being played. Create a child class of Game called CardGame. Rather than implementing playGame, declare CardGame abstract. Create a child class of CardGame for War. Implement the playGame method by with a message that says the game of war is being played. Create a child class of Game called VideoGame. Rather than implementing playGame,…Make a class Person, with instance variable name, age, and gender. Make a class Employee inheritfrom Person, with extra data for salary, and hiring date. Make another class Student inherit from Person,with data for program name, level (undergraduate/graduate), and program year. Supply required methods forthe superclass and the subclasses. Make a subclass Manager from Employee, with bonus salary, andoverride the corresponding method(s). Provide toString method for the Employee class and its subclass,Manager, such that it returns employee name, type of the employment, and salary. For instance if you createan object, manager1, from Manager class, with name=”John Smith” and annual salary of $125,000 and bonusweekly bonus of $200, and then write a print statement like System.out.println(manager1); , the output willbe:John Smith, Manager, Salary = $125,000/year, Weekly bonus = $200Implement the following using JAVA: a.Design a class named Person and its two subclasses named Student andEmployee. b.Make Faculty and Staff subclasses of Employee. Please note that,● A person has a name, address, phone number, and email address. A student has aclass status (freshman,sophomore, junior, or senior). You can define the status as aconstant.● An employee has office & salary.● A faculty member has office hours and a rank.● A staff member has a title. c. Draw a UML diagram of the system.
- Create a Right Triangle class that has two sides. Name your class rightTraingle. Code getter and setters for the base and the height. (Remember class variables are private.) The class should include a two-argument constructor that allows the program to set the base and height. The constructor should verify that all the dimensions are greater than 0. before assigning the values to the private data members. If a side is not greater than zero, set the value to -1. The class also should include two value-returning methods. One value-returning method should calculate the area of a triangle, and the other should calculate the perimeter of a triangle. If either side is -1, these functions return a -1. The formula for calculating the area of a triangle is 1/2 * b*h, where b is the base and h is the height. The formula for calculating the perimeter of a triangle is b+h+sqrt (b*b+h*h). Be sure to include a default constructor that initializes the variables of the base, height to -1. To test…Write a class named Person with data attributes for a person’s name, address, and telephone number. Provide accessors/getters and mutators/setters for each attribute. Write a displayPerson() to print out the attributes of the Person. Next, write a class named Customer that is a subclass of the Person class. The Customer class should have a data attribute for a customer number, and a Boolean data attribute indicating whether the customer wishes to be on a mailing list. Provide accessors/getters and mutators/setters for each attribute. Write a display customer() to print out the attributes of the Customer. Demonstrate an instance of the Customer class in a simple program. All your programs will be modular. It will have the main() method that is executed first. Submit code that has no syntax error. And test your code, so as to not have logic errors. Each program must contain your name in the comments section and the date you created the code.NOTE: READ CAREFULLY Design a class named Person and a subclasses named Employee. Make Teacher a subclass of Employee. A Person has a name, address, and e-mail address. An Employee has an office, salary. A Teacher has office hours and a subject they teach. They also have a tenure status. Define the tenure status as a constant. The tenure status is either Senior or Junior, and is represented as an integer, where Senior is equal to 1, and Junior is equal to 2. Each class should have a Default constructor, and a constructor that accepts all arguments. There should be appropriate calls to the superclass within the constructors. Each class should also have getters and setters for each member variable. Each class should have a toString method. Note: You do NOT need to run this in a test program. Just create the classes as indicated above.
- Design a console program that will print details of DVDs available to buy. Make use of an abstract class DVD with variables that will store the title, yearReleased, running time and price of a DVD. Create a constructor that accepts the title, yearReleased and running time through parameters and assign these to the class variables. Create an abstract set method for the price of a DVD; also create get methods for the variables.Create a subclass InstructionalDVD that extends the DVD class and implements an iPrintable interface. The interface that must be added is shown below:public interface iPrintable { String ShowDetails();}The InstructionalDVD subclass has a private variable named category for which a get method must be written. The constructor of the InstructionalDVD class must accept the title, yearReleased, running time and category through parameters. Write the code for the setPrice() and ShowDetails() methods.Write a useDVD class and instantiate 2 objects of the InstructionalDVD…Create a class BeautyProduct with name, color, brand. Provide Constructors, getters, setters and also write toString method. Now create a class Lipstick which extends the class BeautyProduct as Lipstick is-a Beauty Product it has totalVolume, remainingVolume, price, texture (gloss, matt) as private data members. Provide Constructors, getters, setters and an apply() method whenever this method is called a beauty item is applied and its volume decreases by 10.This should also check that volume must not be zero if it then u have to throw exception. Also write toString method which prints all details like name, color, brand, price, texture and volume. Create another class foundation having totalVolume, remainingVolume, price, texture (liquid, cake) and lastingTime (number of hours foundation remain intact on face and does not crease) as private data members. This also extends the base class i.e. BeautyProduct. Provide Constructors, getters, setters and an apply() method whenever this…This assignment requires one project with two classes. Class Employee Class Employee- I will attach the code for this: //Import the required packages. import java.text.DecimalFormat; import java.text.NumberFormat; //Define the employee class. class Employee { //Define the data members. private String id, lastName, firstName; private int salary; //Create the constructor. public Employee(String id, String lastName, String firstName, int salary) { this.id = id; this.lastName = lastName; this.firstName = firstName; this.salary = salary; } //Define the getter methods. public String getId() { return id; } public String getLastName() { return lastName; } public String getFirstName() { return firstName; } public int getSalary() { return salary; } //Define the method to return the employee details. @Override public String toString() { //Use number format and decimal format //to format the salary…