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: Is it possible for a class that has no abstract methods to be defined as abstract? If you are not…
A: Answer: Abstract class can have both abstract and non-abstract(concrete) 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: Derive a class BuyNItemsGetOneFree from DiscountPolicy, as described in Exercise 10. The class…
A: public class BuyNItemsGetOneFree extends DiscountPolicy{ private int numberOfItems;…
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: 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: Make a clasS Employee with a name and salary. Make a class Manager inherit from Employee. Add an…
A: public class Employee { //declaring instance variables public String name; public double salary;…
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: write easy java program. Make a class Employee with a name and salary. Make a class Manager…
A: Code is in step 2 and output in step 3 Programming instructions: Create a class Employee. In the…
Q: Change the Fraction class so that its instance variables (numerator and denominator) are hidden…
A: Basic mistake here is that there were two classes in which main method is present. Hence one…
Q: Make a class Employee with a name and salary. Make a class Manager inherit from Employee. Add an…
A: Programming instructions: Create a class Employee. In the Employee class, create the instance…
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: Write a class Point with instance variables as: xCoordinate(int) and yCoordinate(int). Write public…
A: Objective: We need to construct a Point class with its attributes, a circle class extending features…
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: IN C++ Implement a class Car with the following properties. A car has a certain fuel efficiency…
A:
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: write a program to print the names of the student by creating a student class .if no name is passed…
A: Using Constructor #include <iostream> using namespace std; class Student{ public: string…
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: 1/ Implement a class Employee. An employee has a name (a string) and a salary (a double). Provide a…
A: Note: This is a multiple-question-based problem. The only first question is solved. Kindly send the…
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: For a parking management system, use the Observer pattern to implement this interaction using Java…
A: For a parking management system, use the Observer pattern to implement this interaction using Java…
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: Write a Java program for a class named Baby. A Baby has a name of type String and an age of type…
A: Introduction of Java Program In this program, we have a default constructor that is used to…
Q: ng method must return all the degree information: year, subject and person’s name in the following…
A: Here is C++ program:
Q: Write a JAVA program to model the kinds of people one finds in a university. The categories are…
A: Required: Write a JAVA program to model the kinds of people one finds in a university.
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: Class student inherits from superclass Person. Which assignment is legal? a) Student s = new…
A: class Person { //Code } class Student extends Person { //code } A subclass inherits all the…
Q: Write the complete “S"Critter class, including all instance variables and required methods. Do NOT…
A:
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: Add(implement) a method to the Parking Office class to return the collection of permit ids for a…
A: public List<String> getPermitIds(Customer c){ List<String> permitid = new…
Q: Make a class Person, with instance variable name, age, and gender. Make a class Employee inherit…
A: class Person{ String name; int age; String gender; public Person(String name, int age, String…
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 Java program for given scenarios below: Create a class named 'Member' having the following…
A: Program with commented explanation, code and output is below. Member class is a parent/super class.…
Q: Define a constructor in class Child and give an appropriate initial values for the instance (name,…
A: The answer is goven below:-
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: write the following 3 classes for the Java program so that this program produces the sample output…
A: *Note: Save the code in a file named "Main.java" otherwise it will not compile. This is because,…
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: Say I create a superclass Bird, a subclass Parrot extends Bird, and a subclass Parakeet extends…
A: Above in the method public static void printName(Bird b) we are passing object of class Parakeet and…
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 3 steps with 4 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 parameterWrite 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.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.
- 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,…Implement 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.Java- 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.
- 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.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…
- 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 = $200NOTE: 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.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…