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

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter7: String Manipulation
Section: Chapter Questions
Problem 10E
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
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT