1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sergeu [11.5K]
2 years ago
14

Make a class Employee with a name and salary. Make a class Manager inherit from Employee. Add an instance variable, named depart

ment, 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 & equals methods for all classes. Supply a test program that tests these classes and methods.
Computers and Technology
1 answer:
sweet [91]2 years ago
8 0

Answer:

see explaination

Explanation:

class Employee

{

String name;

double salary;

void tostring()

{

System.out.println("Employee:\nName: "+name+"\nSalary: "+salary+"\n");

}

Employee(String n,double s)

{

name=n;

salary=s;

}

}

class Manager extends Employee

{

String department;

void tostring()

{

System.out.println("Manager:\nName: "+name+"\nDepartment: "+department+"\nSalary: "+salary+"\n");

}

Manager(String n,double s,String d)

{

super(n,s);

department=d;

}

}

class Executive extends Manager

{

void tostring()

{

System.out.println("Executive:\nName: "+name+"\nDepartment: "+department+"\nSalary: "+salary+"\n");

}

Executive(String n,double s,String d)

{

super(n,s,d);

}

}

public class test

{

public static void main(String args[])

{

Employee e =new Employee("Neo",12000);

e.tostring();

Manager m =new Manager("Cramster",100000,"Homework");

m.tostring();

Executive ex =new Executive("Chuks",1000000,"Homework");

ex.tostring();

}

}

You might be interested in
Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he o
Dmitriy789 [7]

Answer:

The solution code is written in Python 3

  1. count = 0
  2. sum = 0
  3. num = input("Enter a number: ")
  4. while(num != ''):
  5.    sum += float(num)
  6.    count += 1
  7.    num = input("Enter a number: ")
  8. print("Sum : " + str(sum))
  9. print("Average: " + str(sum / count))

Explanation:

Firstly, we declare two variables count and sum to hold the number of input number and the total of the input number, respectively (Line 1-2)

Next, we prompt user to input the first number (Line 4). While the num is not ' ' (This means it is not "Enter" key), accumulate the num to sum variable and increment count by one (Line 6-8) and then prompt the user to input the next number (Line 9).

At the end, display the sum and average using print function (Line 11 -12).

5 0
3 years ago
QUESTION 9 / 10
In-s [12.5K]

Answer:

The answer is C. the bank will cancel your credit card.

Explanation:

5 0
2 years ago
Hey can someone read My I.P address? My teacher want's us to learn port forwarding but I can't find my I.P. because its a school
Alborosie
Obviously you have access to any sort of device. 
click on your internet and click more info: 
your IP address will be stated clearly, for example as 666<span>.666.6.666</span>
7 0
3 years ago
The ____ operator executes one of two expressions based on the results of a conditional expression. Group of answer choices
Mars2501 [29]

Corrected or Complet Question

The ____ operator executes one of two expressions based on the results of a conditional expression.

a. .

b. ( )

c. ,

d. ?:

Answer:

(d) ? :

Explanation:

The ternary operator (? :) is an operator that executes one out of two expressions based on the results of a conditional expression. It is a faster or shorthand way of writing an if ... else statement. The operator checks the conditional expression and depending on whether it is true or false, one of its two statements will be executed. For example:

 String correct = (4 < 5) ? "yes" : "no" ;

In the code above,

i. the conditional statement is (4 < 5) and this will be tested for to return true or false.

ii. the first expression (the one after the ?) is "yes" which will be executed if the conditional statement returns true.

iii. and the second expression (the one after the : ) is "no" which will be executed if the conditional statement returns false.

Therefore, since the conditional expression returns true for 4 < 5, the first expression will be executed. i.e "yes". This means that the String variable <em>correct </em> will have a value of "yes".

8 0
2 years ago
Read 2 more answers
You work part time at a computer repair store. You are in the process of building a new computer system. The customer wants a mo
kumpel [21]

Answer:

Building of a New Computer System

Explanation:

Specification

a motherboard having dual core 64 bit dual core processor with 8 GB RAM of dual channel memory support with 16x PCI Express slot for video card and firewire support.

8 0
3 years ago
Other questions:
  • Describe the concepts of confidentiality, integrity, and availability (C-I-A), and explain each of the seven domains of a typica
    9·1 answer
  • Discuss some design considerations that you should keep in mind when you want to design a professional-looking flyer or newslett
    5·2 answers
  • Suppose that your application uses a loop that isn't producing the intended results. The best way to analyze what’s going on in
    13·1 answer
  • 1. Write a recursive method to determine if a character is in a list of characters in O(logN) time. Mathematically prove (as we
    13·1 answer
  • How do i make spaces in python<br> To draw hello world
    15·1 answer
  • Anyone know a way to trade in a Xbox with a Ps4?
    10·2 answers
  • How are programs and algorithms related? A program is a part of an algorithm. They are not connected at all. An algorithm is a p
    12·1 answer
  • If there are 18 people in your class and you want to divide the class into programming teams of 3
    7·1 answer
  • Which three techniques are used in this photo
    12·1 answer
  • charles, a security analyst, needs to check his network for vulnerabilities. he wants a scan that interacts with network nodes a
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!