Salary Calculator Create a program that computes the salary based on an employee's hourly wage and hours worked. Note that employees may work for fractions of an hour, e.g. 1 and a half hours (1.5 hours). Use the following formulas: Less than or equal to 40 hours worked hourly wage * hours worked Over 40, but less than or equal to 65 hours worked (hourly wage * 40) + (hours worked - 40) * (hourly wage * 1.5) Over 65 hours worked (hourly wage * 40) + (hourly wage * 1.5) * 25 + (hours worked - 65) * hourly wage * 2 Also make sure that the hourly wage and hours worked are positive. Otherwise, display the error message: "Invalid input". Please see the sample outputs below to guide the design of your program.   main.cc file  #include   #include       int main() {   // TODO: accept user input to store the hourly wage and hours worked.   // Then, include the header file at the top of this file so you can   // call your function that computes a salary based on these inputs.   // Don't forget to check for invalid inputs!   return0;   }   salary.cc file  // TODO: implement the function defined in salary.h here.   salary.h file  // TODO: write your function declaration here.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 19PE
icon
Related questions
Question

Salary Calculator

Create a program that computes the salary based on an employee's hourly wage and hours worked. Note that employees may work for fractions of an hour, e.g. 1 and a half hours (1.5 hours). Use the following formulas:

Less than or equal to 40 hours worked

hourly wage * hours worked

Over 40, but less than or equal to 65 hours worked

(hourly wage * 40) + (hours worked - 40) * (hourly wage * 1.5)

Over 65 hours worked

(hourly wage * 40) + (hourly wage * 1.5) * 25 + (hours worked - 65) * hourly wage * 2

Also make sure that the hourly wage and hours worked are positive. Otherwise, display the error message: "Invalid input".

Please see the sample outputs below to guide the design of your program.

 

main.cc file 

#include <iomanip>
  #include <iostream>
   
  int main() {
  // TODO: accept user input to store the hourly wage and hours worked.
  // Then, include the header file at the top of this file so you can
  // call your function that computes a salary based on these inputs.
  // Don't forget to check for invalid inputs!
  return0;
  }

 

salary.cc file 

// TODO: implement the function defined in salary.h here.

 

salary.h file 

// TODO: write your function declaration here.

Salary Calculator
Create a program that computes the salary based on an employee's hourly wage and hours worked. Note that employees may work for
fractions of an hour, e.g. 1 and a half hours (1.5 hours). Use the following formulas:
Less than or equal to 40 hours worked
hourly wage *hours worked
Over 40, but less than or equal to 65 hours worked
(hourly wage * 40) + (hours worked - 40) * (hourly wage * 1.5)
Over 65 hours worked
(hourly wage * 40) + (hourly wage * 1.5) * 25+ (hours worked - 65) * hourly wage * 2
Also make sure that the hourly wage and hours worked are positive. Otherwise, display the error message: "Invalid input"
Please see the sample outputs below to guide the design of your program.
Transcribed Image Text:Salary Calculator Create a program that computes the salary based on an employee's hourly wage and hours worked. Note that employees may work for fractions of an hour, e.g. 1 and a half hours (1.5 hours). Use the following formulas: Less than or equal to 40 hours worked hourly wage *hours worked Over 40, but less than or equal to 65 hours worked (hourly wage * 40) + (hours worked - 40) * (hourly wage * 1.5) Over 65 hours worked (hourly wage * 40) + (hourly wage * 1.5) * 25+ (hours worked - 65) * hourly wage * 2 Also make sure that the hourly wage and hours worked are positive. Otherwise, display the error message: "Invalid input" Please see the sample outputs below to guide the design of your program.
Hourly wage: 12.25
Hours worked: 20
Total Salary Owed: $245.00
Sample 2
Hourly wage: 22
Hours worked: 2.5
Total Salary Owed: $55.00
Sample 3
Hourly wage: -100
Hours worked: 10
Invalid input
Sample 4
Hourly wage: 12
Hours worked: -5
Invalid input
9
Transcribed Image Text:Hourly wage: 12.25 Hours worked: 20 Total Salary Owed: $245.00 Sample 2 Hourly wage: 22 Hours worked: 2.5 Total Salary Owed: $55.00 Sample 3 Hourly wage: -100 Hours worked: 10 Invalid input Sample 4 Hourly wage: 12 Hours worked: -5 Invalid input 9
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr