1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dmitriy555 [2]
2 years ago
8

Develop a Java program that determines the gross pay for an employee. The company pays hourly rate for the first 40 hours worked

by the employee and time and a half (1.5x hourly rate) for all hours worked in excess of 40. The user of your application will enter an employee name, shift (day or night) ,the number of hours worked for the week and their hourly rate. Your program should then calculate and display the employee’s name, regular pay, overtime pay, total gross pay and payperiod. PayPeriod is "Friday" for "day" shift and "Saturday" for "night" shift. Use class Scanner to input the data. Be sure to format output, so it is professionally displayed to your users.Here is an example of pseudocode:StartEnter employee nameEnter employee shift (day/night)Enter hours workedEnter hourly pay rateCalculate reg payif hours worked > 40 thenCalculate overtime payelseovertime = 0Calculate total payOutput employee name, reguldar pay, overtime pay, total payIf day shiftoutput "Friday payperiod"Elseoutput "Saturday payperiod".End.
Computers and Technology
1 answer:
Neko [114]2 years ago
6 0

Answer:

// Program is implemented using Java Programming Language

// Comments are used for explanatory purpose

// The program starts here

import java.util.Scanner;

public class CalcRate

{

public static void main (String [] args)

{

//Call scanner function

Scanner input = new Scanner(System.in);

//Variable Declaration

int hour;

double regpay, overtime, total, hourlyrate;

string name,shift;

// Input employee details

System.out.print("What's your name: ");

name = input.nextLine();

System.out.print("What's your Shift: ");

shift = input.nextLine();

System.out.print("Numbers of hours worked: ");

hour = input.nextInt();

System.out.print("What's your hourly pay rate: ");

hourlyrate = input.next.Double();

// Calculate worker's pay

if(hour<=40)

{

regpay = hourlyrate * hour;

overtime = 0;

}

else

{

overtime = (hour - 40) * 1.5 * hourlyrate;

regpay = 40 * hourlyrate;

}

total = regpay + overtime;

// Print payment details

System.out.println(" Employee name: "+name);

System.out.println(" Regular Pay: "+regpay);

System.out.println(" Overtime Pay: "+overtime);

System.out.println(" Total Pay: "+total);

// Print shift output

if(shift == "Day)

{

System.out.println(" Friday day period: ");

}

else

{

System.out.println(" Saturday day period: ");

}

}

}

You might be interested in
On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 * rn, where n is the distance
Stels [109]

Answer:

#include <stdio.h>

int main()

{

float your_value1, your_value2, your_value3, your_value4, your_value5;

printf("Enter a frequency: ");

scanf_s("%f", &your_value1);//storing initial key frequency in your value 1

 

float r = 2.0 / 12;//typing 2.0 so it is treated as float and not int

your_value2 = your_value1 * r * 1; //initial*r*n

your_value3 = your_value1 * r * 2; //initial*r*n

your_value4 = your_value1 * r * 3; //initial*r*n

your_value5 = your_value1 * r * 4; //initial*r*n

printf("%0.2f %0.2f %0.2f %0.2f %0.2f", your_value1, your_value2, your_value3, your_value4, your_value5);

return 0;

}

Explanation:

The purpose of this exercise is to make you understand the difference between float and int. float variables are used when you need decimals in your calculations. int is used when you need integers. The problem in this exercise was the formulation of r. Now r is = 2/12, this means that when we type r as that, the computer assumes that it is an integer and treats it as such. So, it will convert the 0.166667 into 0. To overcome this, all you have to do is type 2.0 instead of 2 alone.

The %0.2 command restricts the float variable to 2 decimal places. By default, it has 6 decimal places.

I have used the function scanf_s instead of scanf simply because my compiler does not work with scanf.

3 0
3 years ago
Describe the procedure for creating a table or spreadsheet in a presentation slide.
vodomira [7]

Answer:

Select the slide that you want to insert a table on.On the Insert tab, in the Tables group, click Table, and then click Excel Spreadsheet.To add text to a table cell, click the cell, and then enter your text

Explanation:

7 0
3 years ago
Read 2 more answers
Qué propiedades del bromato de potasio han hecho que sea el aditivo más usado en la fabricación del pan​
torisob [31]

Answer:

es la capacidad de unir proteínas presentes en la harina

4 0
3 years ago
Differentiate between soft copy output and hard copy output?​
katen-ka-za [31]

a hard copy stores data and information in the form of physical files it may be images text photographs and more a soft copy data and information in the form of virtual file saved on a computer or a drive you can preserve a hard copy for two long because its day subjected to wear and tear

4 0
2 years ago
Read 2 more answers
What does the hard disk drive do?
Airida [17]
It stores data and retrieving digital information using one or more rigid rapidly rotating disks (platters) coated in magnetic material
4 0
3 years ago
Read 2 more answers
Other questions:
  • How does information technology most benefit people’s personal and professional lives?
    9·2 answers
  • Finding your style in photography is about ___
    10·2 answers
  • In this exercise, you are given a word or phrase and you need to return that word or phrase with the word ‘like’ in front of it.
    5·1 answer
  • What is virtual memory?
    11·1 answer
  • Camille prepared excellent PowerPoint slides for her speech about education reform, but the speech didn't go as well as she had
    15·1 answer
  • Which statement is not true? An audit objective for systems maintenance is to detect unauthorized access to application database
    8·1 answer
  • You have created a PivotChart showing sales by quarter by sales rep. Before presenting it to management, you notice thename of a
    7·1 answer
  • What does choosing Slide Sorter view do?
    8·1 answer
  • What is the second stage of information processing cycle​
    10·2 answers
  • How do you enter the decimal 73 into the computer?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!