0% found this document useful (0 votes)
2K views5 pages

07 Hands-On Activity 1 - ARG (TANTAY)

The document describes a hands-on activity that has students create a Java program to calculate employee gross pay. It prompts the user to enter an employee's name and whether they are full-time or part-time. For full-time, it asks for and displays the monthly salary. For part-time, it asks for and uses to calculate pay the hourly rate, hours worked, overtime hours, and displays the calculated wages and gross pay. It also provides example output and a grading rubric for the activity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views5 pages

07 Hands-On Activity 1 - ARG (TANTAY)

The document describes a hands-on activity that has students create a Java program to calculate employee gross pay. It prompts the user to enter an employee's name and whether they are full-time or part-time. For full-time, it asks for and displays the monthly salary. For part-time, it asks for and uses to calculate pay the hourly rate, hours worked, overtime hours, and displays the calculated wages and gross pay. It also provides example output and a grading rubric for the activity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

IT1708

Hands-on Activity
Selection
Objectives:

At the end of the exercise, the students should be able to:

 Implement decision using one-way, two-way, and multiple selections; and


 Combine conditions using logical operators.

Materials:

 NetBeans IDE 8.2


 Java Development Kit (JDK) 8

Instructions:

1. Create a folder named LastName_FirstName (ex. Diaz_Jess) on your local drive.

2. Launch NetBeans IDE.

3. Click File > New Project > the New Project window appears.

4. In the New Project window, click the Java category and select Java Application project and click the
Next button.

5. On the Name and Location page, perform the following:

 In the Project Name field, type GrossPayCalculator.

 In the Project Location field, browse and select your folder, then click the Open button.

 Click the Finish button.

6. Write a simple payroll program that will display the employee’s information. The program should
perform the following:

 Ask the user to enter the name of the employee.

 Prompt the user to select between full time and part time by pressing either F (full time) or P
(part time)

 If F is pressed, ask the user to enter his monthly salary. Then display his name and salary.

 If P is pressed, ask the user to type his rate (pay) per hour, the number of hours he worked,
and the numbers of overtime. Then display his name and wage. The computation of overtime
pay is: hours of overtime x (rate per hour x 125%)

 If an invalid letter is pressed, display an error message.

7. Compile and execute the program.

07 Hands-on Activity 1 *Property of STI


Page 1 of 2
8. Debug syntax and logical errors if there is any in the program.

9. Save the file.

10. The following is the example output:

Figure 1

Figure 2

GRADING RUBRIC:
CRITERIA PERFORMANCE INDICATORS POINTS
Correctness The code produces the expected result. 30
Logic The code meets the specifications of the problem. 30
Efficiency The code is concise without sacrificing correctness and logic. 20
Syntax The code adheres to the rules of the programming language. 20
Total 100
CODES IN GROSS PAY CALCULATOR

import java.util.Scanner;
public class GrossPayCalculator {
public static void main(String args[]) {

String employee;
char choose;
double salary, payrate, overtime, hourswork, payovertime, payratework;
Scanner input = new Scanner(System.in);

System.out.print("Enter employee name: ");


employee = input.nextLine();
System.out.print("Press F for Full Time or Press P for Part Time: ");
choose = input.next().charAt(0);

switch (choose)
{
case 'F':
System.out.println("----------- Full Time Employee -----------");
System.out.print("Enter Basic Pay: ");
salary = input.nextDouble();
System.out.println("__________________________________________");
System.out.println("Employee Name: " + employee);
System.out.println("Basic Pay: " + salary);
System.out.println("__________________________________________");
System.out.println("Gross Pay: " + salary);
break;
case 'P':
System.out.println("----------- Part Time Employee -----------");
System.out.print("Enter rate per hour: ");
payrate = input.nextDouble();
System.out.print("Enter number of hours worked: ");
hourswork = input.nextDouble();
System.out.print("Enter number of overtime: ");
overtime = input.nextDouble();
System.out.println("__________________________________________");
System.out.println("Employee Name: " + employee);
System.out.println("Basic Pay: " + payrate * hourswork);
payratework = payrate * hourswork;
payovertime = overtime * payrate * 1.25;
System.out.println("Overtime Pay: " + payovertime);
System.out.println("__________________________________________");
System.out.printf("Gross Pay: %.2f", payovertime + payratework);
break;
default:
System.out.println("Invalid plss press F or P only");
}
}
}
OUTPUT IN GROSS PAY CALCULATOR

Figure 1

Figure 2
OUTPUT IN GROSS PAY CALCULATOR
IN
ONE PROGRAM

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy