How do I use a nested if statement to calculate an employee’s productivity bonus and print the employee’s name and bonus? Bonuses are calculated based on an employee’s productivity score as shown below. A productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked. Productivity Score Bonus <=30 $50 31–69 $75 70–199 $100 >= 200 $200

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

How do I use a nested if statement to calculate an employee’s productivity bonus and print the employee’s name and bonus? Bonuses are calculated based on an employee’s productivity score as shown below. A productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked.

Productivity Score Bonus
<=30 $50
31–69 $75
70–199 $100
>= 200 $200

 

EmployeeBonus.cpp
10
9 string employeeFirstName;
string employeeLastName;
double numTransactions;
11
12
double numShifts;
13
double dollarValue;
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
double score;
double bonus;
const double BONUS_1 = 50.00;
const double BONUS_2 = 75.00;
const double BONUS_3 = 100.00;
const double BONUS_4 = 200.00;
cout << "Enter employee's first name: ';
cin>>employeeFirstName;
cout << "Enter employee's last name: ";
cin>>employeeLastName;
cout << "Enter number of shifts: ";
cin >> numShifts;
cout << "Enter number of transactions: ";
cin >> numTransactions;
cout << "Enter dollar value of transactions: ";
dollarValue;
cin
// Write your code here
Transcribed Image Text:EmployeeBonus.cpp 10 9 string employeeFirstName; string employeeLastName; double numTransactions; 11 12 double numShifts; 13 double dollarValue; 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 double score; double bonus; const double BONUS_1 = 50.00; const double BONUS_2 = 75.00; const double BONUS_3 = 100.00; const double BONUS_4 = 200.00; cout << "Enter employee's first name: '; cin>>employeeFirstName; cout << "Enter employee's last name: "; cin>>employeeLastName; cout << "Enter number of shifts: "; cin >> numShifts; cout << "Enter number of transactions: "; cin >> numTransactions; cout << "Enter dollar value of transactions: "; dollarValue; cin // Write your code here
Employee Bonus.cpp
34
#include<iostream>
35 using namespace std;
36 int main()
37 {
38 int
39 int
40 int BONUS_3 = 70-199;
41 int BONUS_4 = 200
42
43 if (BONUS_1 <= 30) { // first if condition : variable BONUS_1 is checked
44 cout << " value of BONUS_1 is: " << 50.00 << endl;
45
46 if ( BONUS_2 = 31-69) { // second if condition : variable BONUS_2 is checked
47 cout <<
11
" value of BONUS_2 is: << 75.00 << endl;
BONUS_1 = 30; // Declare and assign values to variables
BONUS_2 = 31-69;
48}
49 }
50 return 0;
51 }
52
53
54
55
56
57
5
// This is the work done in the endOfJob() function
// Output.
cout << "Employee Name: " << employeeFirstName << " " << employeeLastName
cout << "Employee Bonus: $" << bonus << endl;
return 0;
Transcribed Image Text:Employee Bonus.cpp 34 #include<iostream> 35 using namespace std; 36 int main() 37 { 38 int 39 int 40 int BONUS_3 = 70-199; 41 int BONUS_4 = 200 42 43 if (BONUS_1 <= 30) { // first if condition : variable BONUS_1 is checked 44 cout << " value of BONUS_1 is: " << 50.00 << endl; 45 46 if ( BONUS_2 = 31-69) { // second if condition : variable BONUS_2 is checked 47 cout << 11 " value of BONUS_2 is: << 75.00 << endl; BONUS_1 = 30; // Declare and assign values to variables BONUS_2 = 31-69; 48} 49 } 50 return 0; 51 } 52 53 54 55 56 57 5 // This is the work done in the endOfJob() function // Output. cout << "Employee Name: " << employeeFirstName << " " << employeeLastName cout << "Employee Bonus: $" << bonus << endl; return 0;
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Control Structure
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education