Question

In: Computer Science

You are asked to write a program to help a small company calculate the amount of...

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.

Solutions

Expert Solution

CODE IN JAVA:

EmployeeTax.java file:

import java.util.Scanner;

public class EmployeeTax {

   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       System.out.print("Enter the number of employees:");
       int n = sc.nextInt();
       sc.nextLine();
       String[] employeeName = new String[n];
       double[] hourlyRate = new double[n];
       int[] hoursWorked = new int[n];
       double taxRate;
       for (int i = 0; i < n; i++) {
           int temp = i + 1;
           System.out.print("Enter name of employee " + temp + " :");
           employeeName[i] = sc.nextLine();
           System.out.print("Enter hourly rate of employee " + temp + " :");
           hourlyRate[i] = sc.nextDouble();
           System.out.print("Enter number of hours worked of employee " + temp + " :");
           hoursWorked[i] = sc.nextInt();
           sc.nextLine();
       }
       System.out.print("Enter tax rate : ");
       taxRate = sc.nextDouble();
       double companyTaxAmount = 0.0;
       double amountBeforeTax, amountAfterTax, taxAmount;
       for (int i = 0; i < n; i++) {
           int temp = i + 1;
           amountBeforeTax = hoursWorked[i] * hourlyRate[i];
           taxAmount = amountBeforeTax * taxRate;
           amountAfterTax = amountBeforeTax - taxAmount;
           System.out.println("Amount before tax for employee " + temp + " : " + amountBeforeTax);
           System.out.println("tax amount employee " + temp + " : " + taxAmount);
           System.out.println("Amount after tax for employee " + temp + " : " + amountAfterTax);
           companyTaxAmount += taxAmount;
       }
       System.out.println("The total amount of tax the company with held : " + companyTaxAmount);

   }

}

OUTPUT:


Related Solutions

Write a program to help a small company calculate the amount of money to pay its...
Write a program to help a small company calculate the amount of money to pay its 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 The program must be written in Java. Prompt the user for the inputs and store the values in variables Must include all the inputs and outputs listed here and perform the calculations correctly...
Overview For this assignment, write a program that will calculate the amount that a customer spends...
Overview For this assignment, write a program that will calculate the amount that a customer spends on tickets at a movie theater. This program will be continued in program 3 so it is important that this program is completed. Basic Program Logic The basic logic for this program is similar to program 1: the user is asked to enter values, a calculation is performed, and the result of the calculation is displayed. For this program, prompt the user for the...
Write a program that can calculate the amount of federal tax aperson owes for the...
Write a program that can calculate the amount of federal tax a person owes for the upcoming year.After calculating the amount of tax owed, you should report to the user their filing status (single/joint), which tax rate they fell under, as well as the tax owed. Example: “As a single filer you fell under 12% tax bracket and you owe $3500.”Disclaimer: This example is simplified and is not intended to be an accurate representation of how to calculate your taxes.Your...
Write the program in C++ The Rebel food truck has asked you to write a program...
Write the program in C++ The Rebel food truck has asked you to write a program for them to do both inventory and sales for their food wagon. Ben and Dave run the food truck and they already have full time day jobs so they could really use your help. The food truck sells: hamburger, hotdogs, chilli, fries and soda. The truck has spots for 200 hamburger patties, 200 hot dogs, 75 hamburger buns, 75 hot dog buns, 500 ounces...
(Write a program in C++) A local instructor wants you to write a program to calculate...
(Write a program in C++) A local instructor wants you to write a program to calculate the average score made on exams by her students. For simplicity, she always has only 12 students in each course she teaches. She teaches multiple subjects so she would like to enter the name of the exam. She wants the program to also determine the highest and lowest scores and the number of students who passed and failed the exam. A score of 60...
Using C++ Write a program to calculate the amount a customer should pay in a checkout...
Using C++ Write a program to calculate the amount a customer should pay in a checkout counter for the purchases in a bagel shop. The products sold are bagels, cream cheese, and coffee. Use the pseudo code discussed in the class to write the program. Make reasonable assumptions about the prices of bagel, cream cheese, and coffee. Declare prices of bagel, cream cheese, and coffee as constants.
Coding Problem 1: In this program, you are asked to write a program in assembly (MIPS)...
Coding Problem 1: In this program, you are asked to write a program in assembly (MIPS) which works as a simple calculator. The program will get two integer numbers, and based on the requested operation, the result should be shown to the user. a. The program should print a meaningful phrase for each input, and the result. i. “Enter the first number” ii. “Enter the second number” iii. “Enter the operation type” iv. “The result is” b. The user should...
You are asked to give advice to a program that has been given a large amount...
You are asked to give advice to a program that has been given a large amount of money to facilitate learning in children. They will have the ability to have rooms for different age children, supplies for these rooms and teachers who can be trained to help children. Using the ideas of Piaget and Vygotsky, what would you recommend they do for all child age groups, including infants and toddlers, preschool children, elementary school children, middle school children, and high...
For Python: In this assignment you are asked to write a Python program to determine the...
For Python: In this assignment you are asked to write a Python program to determine the Academic Standing of a studentbased on their CGPA. The program should do the following: Prompt the user to enter his name. Prompt the user to enter his major. Prompt the user to enter grades for 3 subjects (A, B, C, D, F). Calculate the CGPA of the student. To calculate CGPA use the formula: CGPA = (quality points * credit hours) / credit hours...
Write a program in python to calculate the amount each person must pay toward the bill...
Write a program in python to calculate the amount each person must pay toward the bill and toward the tip, for a group of friends who are eating out together. Since you are all friends, it is okay to split the costs evenly. Your program should take as input: The restaurant bill (without tax or tip) as a floating point number The sales tax rate as a floating point number (for example: an 8% tax rate would be 0.08) The...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT