Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using a loop of your choice, read information from the console about employees in a company. Each employee has an ID (integer) and number of

Using a loop of your choice, read information from the console about employees in a company. Each employee has an ID (integer) and number of hours worked that week (double) and hourly pay rate (double)

After you read in an employees information, you will calculate the salary for that week by multiplying the number of hours worked by the hourly rate. Number of hours and hourly rate should be real numbers with one or two decimal places.

Print a statement clearly indicating the employee ID, number of hours worked, hourly rate and the total salary for that week.

Use a counter variable to keep track of how many employees were processed.

Continue reading information for all employees, processing and printing the information as above until the ID less than or equal to 0. When the ID is 0 or less, you should not be entering hours worked or hourly rate. This means you should read ID separately and continue reading the rest of the data per employee only if ID is > 1.

When the loop is done, print the total number of employees processed by the program and the total salary of all employees.

Print the program and the output

Now add to your program printf statements so that the hours worked and salary will print with two decimal places. Create fixed columns for each piece of data (ID, hors worked, hourly rate and total salary). Numbers should be right adjusted so the dollars and cents line up. Run the program again with the same data and see what the output looks like now. Print the program and the output.

Add an if-else statement in your program to compute tax on the salary. If the salary is less than $300, the tax rate is .03, if salary is between $300 and $350 the tax rate is .04; otherwise the tax rate is .05. Compute the tax by multiplying the salary by the tax rate. Add the tax as another column of your output table. Print the program and the output.

Use these values as input to cover all three tax groups

Hours Hourly Wage
12.5 15.8
15.25 21.2
18.9 20.25

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions