Write a C++ program to compute and display a person’s weekly salary as determined by the following conditions: -
If the hours worked are less than or equal to 40, the
person receives $8.00 per hour; otherwise, if the person works for more than forty hours, but less than or equal to sixty hours, the person receives $320.00 plus $12.15 for each hour worked over 40 hours. Anyone who works for more than sixty hours simply gets a Jackpot salary of $1000.00 The program should request the hours worked as input and display the salary as output.
try it using the nested if structures.
1
Expert's answer
2012-03-29T11:16:46-0400
#include <iostream> using namespace std;
int main() { int hours; cin >> hours; if (hours<=40) cout << hours*8 << '$' << endl; else { & if (hours<=60) cout << 12.15*(hours-40)+320 << '$' << endl; & else cout << "1000$" << endl; }; };
Comments
Leave a comment