Hi,

I'm new to Java and I need help with the following if someone can help me:

Write a program named Personnel that maintains salary information for the employees of a company. The program should display a text based menu, giving the user a choice of selecting a command.

The commands that the program should support are: n (create new employee by pressing the n button), l (list all employees), p (compute all paychecks), r (raise wages), and q (exit the
menu).

The n command creates a new employee and prompts the user for the name of the employee, and whether the employee is an hourly paid, or has an annual salary. If the user selects to create
an hourly paid employee, he/should be prompted for the hourly rate, otherwise he/should be prompted for the annual salary of the employee.

The p command calculates and displays on the screen the amount that it should be paid to each individual employee who already exists in the system. Assuming that hourly paid employees have been created, the p command should ask the user for the number of hours that each individual hourly paid employee has worked for.

The r command should prompt the user for a percentage rate. All salaries (annual and hourly) should be increased by this rate.

Additionally, the user should be able to display all the employees with an annual salary in ascending order, according to their salaries. I.e. the employee with the smallest salary should
be displayed first, the employee with the second smallest salary should be displayed next, etc
.
The program should implement the classes Employee (abstract class), HourlyEmployee, SalariedEmployee with appropriate methods.

Implement a test class which creates instances of all the implemented classes and tests their functionality.
---------------------

I've done a text based menu displaying the above options, but what do I put in the switch case for the menu for the different cases?

case 'N' : ???????

Recommended Answers

All 4 Replies

Seems to me you would put the code to carry out the operations you've been instructed to perform for each of those menu options.

Perhaps if you can post some code and ask more specific questions, someone here can help you out. They won't write it for you though.

You will create separate classes for your employees and they will have the attributes that are described in your assignment (name, hourly paid, ... ). Then the user eneters 'N' you will read the input specified, create a new object 'employee' and add to a list of employees (Use the java.util.Vector or the java.util.ArrayList class)

You will have methods that take as an argument the above Vector with employees and calculate what it is asked.

hmm... sounds like an assignment to me, show us some code which asserts us about the work done by you and as mentioned above ask specific questions where you might get stuck up, then we may be able to assist you further.

Also to get you started on it...when working with a OO langauge always break down the problem domain into classes and methods.
You have most of it done since you have been given classes too. Now you can identify the individual methods that should be put into each class and write your code.

commented: Very helpful +9
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.