Question
PROJECT Selection Control with Java - Differential Piecework Schedule Objective To construct a program that demonstrates selection program control. PROJECT DESCRIPTION Selection program control occurs
PROJECT Selection Control with Java - Differential Piecework Schedule
Objective To construct a program that demonstrates selection program control.
PROJECT DESCRIPTION
Selection program control occurs when code statements are executed depending on certain conditions.
Type, compile and run a computer program that uses selection control structures and that receives an employees work production and passes this to a differential piecework schedule data, according to the information given below, and then determines the gross pay amount.
Observe the output and then modify the program.
Some skeletal program code is shown in Figure 1 , which follows.
Information About This Project
Employees who manufacture items are often paid based on the number of the items they produce. Some employees are paid a flat rate per item and others are paid via a differential piecework schedule, as illustrated in the following example.
Example
Compute Linda's gross pay if she produced 372 shirts. The rate per shirt is given by the differential piecework schedule below:
Pay Level Items Produced Rate per Item
1 001 - 112 $ 7.15
2 113 - 150 $ 7.45
3 151 - 217 $ 7.95
4 over 217 $ 8.40
Solution
Lindas gross pay is computed via this numerical pay schedule.
Pay Level Items Produced Rate per Item Pay Amount
1 112 $ 7.15 $ 800.80
2 38 $ 7.45 $ 283.10
3 67 $ 7.95 $ 532.65
4 155 $ 8.40 $ 1,302.00
_________ _________
total 372 gross pay $ 2,918.55
The Input, Process and Output ( IPOS ) requirements of this project are:
Input the employee name, the number of items produced and the type of pay
schedule ( flat rate or differential piecework )
Process the employee gross pay
Output the employee name, the number of items produced, the type of pay schedule and the gross pay
Requirements all dollar amounts displayed in a currency format
PROJECT Selection Control with Java - Differential Piecework Schedule
Steps to Complete This Project
STEP 1 Open an Integrated Development Environment ( IDE )
Open Eclipse, Net Beans, MS Visual Studio, or similar programming text editor / compiler.
STEP 2 Write the Program Code
Write the program code that will satisfy the requirements of this project. That is, a program that will request the employees name, the number of items produced and the type of pay schedule ( flat rate or differential piecework ) .
You can assume a rate of $ 7.50 per unit for the flat rate pay schedule and then use the differential piecework as given in the example, shown earlier.
When writing your code statements, use both sequential and selection program control and avoid the use of any looping structures.
You can use one if / else block for the flat rate pay schedule and one if / else if / else block for the differential scales.
Into your Code window, copy the program code shown in Figure 1 . Substitute your own name in place of Sammy Student, as the program writer.
Figure 1 Program Code for the GrossPay Application
import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.Date;
public class GrossPay { public static void main(String[] args) { // declare an object that will display two decimal digits NumberFormat nf = NumberFormat.getCurrencyInstance();
// declare an object that will display the current date Date myDate = new Date(); String myDateFormat = "MM/dd/yyyy"; SimpleDateFormat dtToday = new SimpleDateFormat(myDateFormat); System.out.println("Today's Date is: " + dtToday.format(myDate));
// display the name of the programmer System.out.println(" Programmer: " + " Sammy Student ");
// display a dummy value to show that two decimals are obtained System.out.println(" test amount: " + nf.format(2.575));
} }
|
PROJECT Selection Control with Java - Differential Piecework Schedule
The above starter code will display the current date and the name of the programmer. It also writes a dummy test value to show that the two decimal format will display currency values, when it is used later in the program.
STEP 3 Build, Compile and Run the Program
Compile and run your program code statements. Correct any syntax or compile errors.
STEP 4 Test the Program
Once you have successfully compiled your program, use the following data, when prompted, into the output Console window of your application.
Name of Employee : ( enter your own name )
Type of Pay Schedule : ( choose flat or differential )
Units Produced : 372
STEP 5 Verify Your Output
When you enter the above information, the Console window should show your program output. Verify that the output is numerically accurate and that the required output information is displayed. Use separate program runs to compare the gross pay when the flat rate is selected and when the differential piecework schedule is selected.
STEP 6 Modify Your Program
Return to your Code window and supplement the program with even more additional code statements. Place the new statements before the close of your main() method.
The new statements will accomplish these tasks.
Compute and display the employees Medicare tax, which is based on the gross pay amount. Use a Medicare rate of 1.45 % .
Compute and display the employees FICA tax, which is based on the gross pay amount. Use a FICA rate of 6.20 % .
Compute and display the employees Federal tax ( FIT ) , which is based on the gross pay amount. Assume a flat tax rate of 25 % .
Calculate and display the employees net pay, which is their gross pay
less any taxes.
STEP 7 Test the Program
Once you have successfully compiled your program, use the following data, when prompted, into the output Console window of your application.
PROJECT Selection Control with Java - Differential Piecework Schedule
Program Run I
Name of Employee : ( enter your own name )
Type of Pay Schedule : ( choose flat rate )
Units Produced : 372
Program Run II
Name of Employee : ( enter your own name )
Type of Pay Schedule : ( choose differential piecework )
Units Produced : 372
STEP 8 Submit Your Project
Once you have determined that your modified program is satisfying this projects requirements, complete the submission process as follows:
Open MS Word and type a heading for a new document that includes your full name, course number, lab number and date.
Within the document paste a snapshot of your program code. Label your snapshot with a reasonable description.
After the snapshot, paste the output that appears in your Console screen.
Use multiple screen snapshots for the output when there are different output possibilities for different inputs.
Note - you can use the Windows Snipping Tool, which is part of the Windows Accessories Group, to easily capture your Console window.
Your score for this project will generally be based upon the following factors: documentation, output correctness, content, organization, style and creativity. Submit your Word document to the appropriate course Submittal Box.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started