Modify the payroll program so that it uses a class to store

Assignment Help Basic Computer Science
Reference no: EM13892638

Modify the Payroll Program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked. Use a constructor to initialize the employee information, and a method within that class to calculate the weekly pay. Once stop is entered as the employee name, the application should terminate. Make sure the program maintains all the functionality required in previous assignments and your source code is readable and well documented. Use feedback you have received from the instructor to make any needed modifications.


The application compiles and runs.

The application properly uses a class for employee information.

The application uses a constructor to initialize the employee information and a method within the class to calculate the weekly pay.

The source code is readable and well documented.

The application performs all the required functionality from previous weeks.

 

This is what I already have: 

 

package It215week2;

import java.util.*;
/**
* Monitors employees weekly salary when enter and bonus amount
* Loop feature add
* Program will continue to until user enter "stop" then program will terminate
*
* @author John Doe
*/
public class PayrollSystemProgram {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
try {
// requests the user input the name of the employee, the hourly
// rate, and the number of hours worked.
System.out.print("Enter the name of Employee:");
String employeeName = scanner.nextLine();
while(!employeeName .equals("stop"))
{
System.out.print("Hourly Rate : $");
double hourRate = scanner.nextDouble();
while(hourRate {
System.out.println("Hourly Rate should be a positive value.");
System.out.print("Hourly Rate : $");
hourRate = scanner.nextDouble();
}
System.out.println("Number of hours worked :");
int hoursWorked = scanner.nextInt();
while(hoursWorked {
System.out.println("Hourly Rate should be a positive value.");
System.out.println("Number of hours worked :");
hoursWorked = scanner.nextInt();
}
double weeklyPay = 0, bonusPay = 0;
// calculating weekly pay and bonus pay
if (hoursWorked > 40) {
// if hourly worked is more than 40
// then The bonus amount is the number of hours more than 40
// times the hourly rate
weeklyPay = (double) hourRate * hoursWorked;
bonusPay = (double) (hoursWorked - 40) * hourRate * 0.5;
} else {
weeklyPay = (double) hourRate * hoursWorked;
}
// name of the employee and the correct weekly pay amount in dollar
// format and bonus amount in dollar format
System.out.println("***WEEKLY PAY***");
System.out.println("-----------------");
System.out.println("Employee Name:" + employeeName);
System.out.println("Weekly pay amount :$" + weeklyPay);
if (bonusPay != 0) {
System.out.println("Bonus amount :$" + bonusPay);
}
System.out.print("Enter the name of Employee:");
scanner.nextLine();
employeeName = scanner.nextLine();
}
} catch (Exception e) {
// TODO: handle exception
} finally {
scanner.close();
}
}
}

Reference no: EM13892638

Questions Cloud

Compare characters of troy and rose in august wilsons fences : Compare and contrast the characters of Troy and Rose in August Wilson's Fences. To what extent are each of these characters responsible for their tragedy?
How would such a condition affect your work life : Finally, describe what it might be like to have presbycusis. Include the following points: If you have normal hearing now, how would your ability to converse with others be affected? What activities that you now enjoy would be limited by this conditi..
Describe a specific issue related to health care access : Describe a specific issue related to health care access or policy with respect to a particular ethnic or socioeconomic group.
What does it mean to consecrate a place? : What does it mean to consecrate a place?
Modify the payroll program so that it uses a class to store : Modify the Payroll Program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked. Use a constructor to initialize the employee information, and a method within that class to calculate the w..
How did you frame the decisions you had to make : What biases and past experiences influenced your impressions and decision making? Do you think aspects of your culture or views of a different culture impacted your impressions? How did you frame the decisions you had to make? How did your emotions..
Use the 2s complement : Problem 1  Convert the following decimal numbers into (a) 8-bit, (b) 16-bit, and (c) 32-bit binary numbers. For negative numbers, use the 2's complement. State "overflow" if a number cannot be represented correctly. 1)  45 ten. 2)   -81 ten.  3)-3,0..
What legal implication of these challenges for administraton : Summarize significant findings about this group that inform attitudes and preferences around end-of-life care (e,g., inform consent, life support, advance directives, communication styles, and/or decision making, etc.), and cite your sources of info..
Unadjusted trial balance and information for the accounting : 1.The unadjusted trial balance and information for the accounting adjustments of Noseworthy Investigators follow.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd