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...
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...
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...
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...
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...
C program help 1. Write a program to compute the Mileage given by a vehicle. Mileage...
C program help 1. Write a program to compute the Mileage given by a vehicle. Mileage = (new_odometer – old_odometer)/(gallons_gas) // illustrating how ‘for’ loop works. 2. How to initialize an array of size 5 using an initializer list and to compute it’s sum How to initialize an array of size 5 with even numbers starting from 2 using ‘for’ loop and to compute it’s sum 3. Program to compute the car insurance premium for a person based on their...
You are the controller of the Small Corporation. Terry Small, the company owner, asked you why...
You are the controller of the Small Corporation. Terry Small, the company owner, asked you why you recorded Goodwill as an asset on the books when Small purchased another company. How do you respond?
General Description: Write a program that processes weekly payroll for a small company. The program starts...
General Description: Write a program that processes weekly payroll for a small company. The program starts with printing a logo then asking for the total number of employees for the week. The program then inputs data for each individual employee and prints a paystub. At the end, it prints a report based on data for all employees. Gross Pay: The company has two types of employees: Hourly and Salaried - Hourly employees have an hourly wage, and are paid overtime...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT