Write a program that makes use of a class called Employee that will calculate an employee's weekly paycheque.

Ads
 

Write a program that makes use of a class called Employee that will calculate an employee's weekly paycheque.

Write a program that makes use of a class called Employee that will calculate an employee's weekly paycheque. Design your class based on the UML diagram to the right as well as the following notes:

A static field, empCount, keeps track of the number of instantiated employees and can be retrieved using the static method getCount( )
The constructor initializes the employee's name and employee number (a random number in the range of 1000 - 9999)
The method setEmployeePay( ) is overloaded to accomodate different payment methods based on empType:

    Type 1 - Salaried employees have a yearly salary, paid on a weekly basis
    Type 2 - Hourly employees are paid an hourly rate for the number of hours worked (overtime is time and a half for hours over 40)
    Type 3 - Piece employees are paid a base amount plus $24.00 for every piece completed
The method calculatePay( )will determine what the employee's weekly pay is, based on their payment type
The methods getName( ) and getNumber( )return the employee's name and employee number respectively
All input & output should be displayed in the main class only


The main program should test your class by instantiating four different employees:

    Test a salaried employee
    Test two hourly employees, one who has worked overtime and one who hasn't
    Test a piecework employee
    The following data can be hard-coded into your program (no prompts to enter data other than the names):

        Employee 1: (22.50, 35.0)
        Employee 2: (45350.00)
        Employee 3: (500.00, 25)
        Employee 4: (14.75, 48.0)

Output: 
Enter an employee name: Bob 

Employee Count is: 1

Enter an employee name: Ted

Employee Count is: 2

Enter an employee name: Carol

Employee Count is: 3

Enter an employee name: Alice

Employee Count is: 4

Employee  8826  Bob earned $787.50

Employee  5454  Ted earned $872.12

Employee  1083  Carol earned $1100.00

Employee  8782 Alice earned $767.00
View Answers

July 1, 2012 at 5:08 AM

using these names


July 1, 2012 at 5:09 AM

click on above line "using these names"

Ads









Related Tutorials/Questions & Answers:
Write a program that makes use of a class called Employee that will calculate an employee's weekly paycheque.
Write a program that makes use of a class called Employee that will calculate an employee's weekly paycheque.  Write a program that makes use of a class called Employee that will calculate an employee's weekly paycheque. Design
to write a program to display the employee details..
to write a program to display the employee details..  To dipslay the employee details like empid,empname,salary,wonno bye using java swings.by running this program the new window has to be opened asking us to enter all
Advertisements
How do I write a program to manage an employee's business and personal contacts?
How do I write a program to manage an employee's business and personal contacts.... Demonstrate use of polymorphism by overriding a method of the abstract class in both... Requirements 1. Demonstrate use of collections (e.g., TreeSets, ArrayList). 2
program on employee details
program on employee details  to write a program on displaying the employee details like empid,empname,wonno,location,leave type by using the text fields in java swings
Employee Salaries
salary of the Employee. Write a program that lets a user create Employee objects...Employee Salaries  Define a class Employee with the following..., the program must print the current salary of the Employee. Note: A simple interface
write a program to evaluate the following investment equation make use of wrapper class v=p(1+r)rest to n
write a program to evaluate the following investment equation make use of wrapper class v=p(1+r)rest to n  write a program to evaluate the following investment equation make use of wrapper class v=p(1+r)rest to n
Employee Salaries
salary of the Employee. Write a program that lets a user create Employee objects...Employee Salaries  Define a class Employee with the following..., the program must print the current salary of the Employee. Note: A simple interface
Employee Salaries
salary of the Employee. Write a program that lets a user create Employee objects...Employee Salaries  Define a class Employee with the following..., the program must print the current salary of the Employee. Note: A simple interface
Employee Salaries
salary of the Employee. Write a program that lets a user create Employee objects...Employee Salaries  Define a class Employee with the following..., the program must print the current salary of the Employee. Note: A simple interface
Employee Salaries
salary of the Employee. Write a program that lets a user create Employee objects...Employee Salaries  Define a class Employee with the following..., the program must print the current salary of the Employee. Note: A simple interface
Employee Salaries
salary of the Employee. Write a program that lets a user create Employee objects...Employee Salaries  Define a class Employee with the following..., the program must print the current salary of the Employee. Note: A simple interface
Adding an employee
Adding an employee  coding for adding an employee
Add Employee
Add Employee  coding for adding an employee
write a program to demonstrate wrapper class and its methods......
write a program to demonstrate wrapper class and its methods......  write a program to demonstrate wrapper class and its methods
Employee form
Employee form  In employee form emp Id id after any data iserted is incremented for oher data insertion. insert, delete, update buttons when we cleak the select buttoun then the created table data iserted automaticaly
employee progarm
employee progarm  Hai, I have developed a code for an employee program by using jtext fields and buttons,it has no errors but while we... java.awt.event.*; class Emp { JFrame f; JPanel p; JLabel
employee records
employee records  Pl give one script like i will creat one table name Emp_master and column name like Empcode, Empname. I like one form where I... and one report like details of employee thanks
employee records
employee records  Pl give one script like i will creat one table name Emp_master and column name like Empcode, Empname. I like one form where I... and one report like details of employee thanks
employee records
employee records  Pl give one script like i will creat one table name Emp_master and column name like Empcode, Empname. I like one form where I... and one report like details of employee thanks
application for an Employee
: in this page it should modify employee data and persist in DB 3.DISPLAY
coding for employee management system
coding for employee management system  coding for employee management system
Employee Management System
Employee Management System  coding for employee management system
Employee Management System
Employee Management System  coding for employee management system
display the employee name
display the employee name  when i will select one employee designation based on that employee designation display the particular designation employee name display in another select box how it possible using servlet and mysql
write a program to calculate volume of a cube, cylinder, rectangular box using method overloading
write a program to calculate volume of a cube  write a program to calculate volume of a cube, cylinder, rectangular box using method overloading...;class
Employee Management Sysem
Employee Management Sysem  coding for Daoclass Login Page Validation
Auto Generated Employee ID
Auto Generated Employee ID  Hello Everyone I want to generate an ID like (SCS-0001) and then it should be auto incremented each time a new employee add page is opens. I am using My Sql database
Employee Details - JSP-Servlet
Employee Details  Respected Sir/Madam, Thanks for your... for specified operation. You can't write the code, which is written... to do that, you have to forward form to either java action class or to some jsp (i.e
Generate Employee ID (SCS-0001,SCS-0002......)
Generate Employee ID (SCS-0001,SCS-0002......)  Hello everyone i am beginner in java and i am working on my major project I want to generate bill number and employee number like SCS-0001 and so on and bill number like SCS/'date
write a program
write a program  write a program add 2 no.s without use arithmetic,unary operaters in java
Write a program to calculate factorial of any given number
program to calculate factorial of any given number. First of all define a class... class, it is necessary to use 'try' and 'catch' block for catching and handling... Factorial Examples - Java Factorial Example to calculate factorial of any

Ads