subject

Computer Programming 1 Homework 2
Write a Java program that stores information about a company. You should define two classes: Employee which represents the employees in the company, and Department which represents the departments the employees are in.
Class definition
The classes should have the following fields:
▪ Department
• String name
▪ Employee
• String firstName
• String lastName
• double salary
• Department department
Notes:
1. All fields should be private.
2. You should define a constructor that takes as parameters all fields in each class.
3. You should define a getter and a setter for all fields in each class.
4. The field salary on class Employee should never be a negative number.
5. You should define a method getFullName on class Employee that returns the employees full name as a String.
Main Program
after you have defined the classes, In the main method define two objects of type Department as follows:
#
name
1
Sales
2
Accounting
Then define an array of type Employee and fill it with the following Employee objects:
#
firstName
lastName
salary
department
1
John
White
1000
Department object 1 (Sales)
2
David
Ford
1500
Department object 1 (Sales)
3
Sophie
Beech
1200
Department object 1 (Sales)
4
Mary
Howe
1300
Department object 2 (Accounting)
5
Susan
Brand
1400
Department object 2 (Accounting)
the program should show the user the following menu and wait for input from the user:
1. Show all employees
2. Show employees for department
3. Show employee with max salary
Option 1: shows the employee’s full name, salary and department name for all employees
Option 2: asks the user for a department name then shows the employee’s full name, salary and department name for that department.
Option 3: shows the full name, salary and department name for the employee with the maximum salary in the company


Computer Programming 1

Homework 2
Write a Java program that stores information about a company. Y

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:00
It is not a good idea in a cover letter to mention another person whom the employer knows.
Answers: 1
question
Computers and Technology, 23.06.2019 01:40
You have a linux system that has a 1000gb hard disk drive, which has a 90gb partition containing an ext4 filesystem mounted to the / directory and a 4gb swap partition. currently, this linux system is only used by a few users for storing small files; however, the department manager wants to upgrade this system and use it to run a database application that will be used by 100 users. the database application and the associated data will take up over 200gb of hard disk space. in addition, these 100 users will store their personal files on the hard disk of the system. each user must have a maximum of 5gb of storage space. the department manager has made it very clear that this system must not exhibit any downtime as a result of hard disk errors. how much hard disk space will you require, and what partitions would you need to ensure that the system will perform as needed? where would these partitions be mounted? what quotas would you implement? what commands would you need to run and what entries to /etc/fstab would you need to create? justify your answers.
Answers: 3
question
Computers and Technology, 23.06.2019 07:30
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 2
question
Computers and Technology, 23.06.2019 20:30
If an appliance consumes 500 w of power and is left on for 5 hours, how much energy is used over this time period? a. 2.5 kwh b. 25 kwh c. 250 kwh d. 2500 kwh
Answers: 1
You know the right answer?
Computer Programming 1 Homework 2
Write a Java program that stores information about a compa...
Questions
question
Mathematics, 07.02.2021 01:50
question
Biology, 07.02.2021 01:50
question
Mathematics, 07.02.2021 02:00
question
Mathematics, 07.02.2021 02:00
Questions on the website: 13722363