![lLavenderl](/avatars/32371.jpg)
lLavenderl
06.05.2020 •
Computers and Technology
You are asked to write a program to help a small company calculate the amount of money to pay their employees. In this simplistic world, the company has exactly three employees. However, the number of hours per employee may vary. The company will apply the same tax rate to every employee.
Problem Description
Inputs (entered by user of the program)
• Name of first employee
• Hourly rate
• Number of hours worked
• Name of second employee
• Hourly rate
• Number of hours worked
• Name of third employee
• Hourly rate
• Number of hours worked
• Tax rate (between 0 and 1.0)
Processing and Output
• Calculate and display the amount each employee will be paid before taxes
• Calculate and display the amount each employee will be taxed
• Calculate and display the amount each employee will be paid after taxes have been withheld
• Calculate and display the total amount of taxes the company will withhold
• Display your name
You may separate the processing/calculation step from the output step or you may combine those steps. It is your choice.
Solved
Show answers
More tips
- F Food and Cooking How to Make Mayonnaise at Home? Secrets of Homemade Mayonnaise...
- C Computers and Internet Which Phone is Best for Internet Surfing?...
- F Food and Cooking Everything You Need to Know About Pasta...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
- S Style and Beauty How to Make Your Lips Fuller? Ideas and Tips for Beautiful Lips...
- C Computers and Internet How to Learn to Type Fast?...
- A Art and Culture Who Said The Less We Love a Woman, the More She Likes Us ?...
Answers on questions: Computers and Technology
- M Mathematics Anna can type 123 words in a minute caroline can type 220 words in five minutes who can type faster. how to show work?...
- M Medicine Dr. Santiago administers a test to a patient in which she asks him to provide an interpretation of a meaningless inkblot on a piece of paper. Several weeks later, she administers...
- F French En France Tammy _ du shopping tous les jours (faire)...
- E English Russian is an Indo-European language of the Slavic family, spokenin Russia. Determine from the following Russian data whether the low front [a] and the low back [a] complement...
Ответ:
See Explaination
Explanation:
Java Program:
/* Java Program that calculates payroll of a company */
import java.util.Scanner;
public class Main
{
//Main method
public static void main(String[] args) {
//Scanner class object
Scanner reader = new Scanner(System.in);
//Array to hold names
String[] names = new String[3];
//Array to hold hourly rate
double[] hourlyRate = new double[3];
//Array to hold hours worked
double[] hoursWorked = new double[3];
//Reading data from User
for(int i=0; i<3; i++)
{
System.out.print("\nEnter name of Employee #" + (i+1) + ": ");
names[i] = reader.nextLine();
System.out.print("Enter Hourly rate of Employee #" + (i+1) + ": ");
hourlyRate[i] = reader.nextDouble();
System.out.print("Enter Hours Worked by Employee #" + (i+1) + ": ");
hoursWorked[i] = reader.nextDouble();
reader.nextLine();
}
//Reading tax rate
System.out.print("\n\nEnter tax rate (between 0 and 1.0): ");
double taxRate = reader.nextDouble();
double companyWithholdTax = 0.0;
System.out.printf("\n %-15s %-15s %-15s %-15s \n", "Employee Name", "Pay Before Tax", "Tax Deducted", "Pay after Tax");
double tax, payBefore, payAfter;
//Printing result
for(int i=0; i<3; i++)
{
//Before tax
payBefore = hoursWorked[i] * hourlyRate[i];
//Computing tax
tax = payBefore * taxRate;
//After taxRate
payAfter = payBefore - tax;
companyWithholdTax += tax;
System.out.printf("\n %-18s %-15.2f %-15.2f %-15.2f ", names[i], payBefore, tax, payAfter);
}
System.out.printf("\n\nTotal amount of taxes company withhold: %.2f \n\n", companyWithholdTax);
}
}
Ответ:
I’d.k if these are meme but these are some weird pics I found so yea
Explanation: