ccumulating Totals in Single-Level Control Break Programs in C++ p| Accumulating Totals in Single-Level Control SuperMarket.cpp 1 // SuperMarket.cpp - This program creates a report that lists weekly hours worked 2 // by employees of a supermarket. The report lists total hours for 3 // each day of one week. 4 // Input: Interactive 5 // Output: Report. Break Programs Summary 6. In this lab, you will use what you have learned about accumulating totals in 7 #include a single-level control break program to complete a C++ program. The 8 #include 9 using namespace std; 10 int main() 11 { // Declare variables. const string HEAD1 = "WEEKLY HOURS WORKED"; program should produce a report for a supermarket manager to help her keep track of the hours worked by her part-time employees. The report should include the day of the week and the total hours worked by all employees each day. 12 13 const string DAY_FOOTER =" // Leading spaces in DAY FOOTER are intentional. const string SENTINEL = "done"; 14 Day Total "; The student file provided for this lab includes the necessary variable 15 declarations and input and output statements. You need to implement the // Named constant for sentinel value. // Current record hours. // Current record day of week. // Hours total for a day. 16 code that recognizes when a control break should occur. You also need to 17 double hoursWorked = 0; complete the control break code. Be sure to accumulate the daily totals for 18 string dayofWeek; double hoursTotal = 0; 19 all days in the week. Comments in the code tll you where to write your string prevDay = ""; bool notDone = true; // Previous day of week. // loop control 20 code. 21 22 Instructions // Print two blank lines. cout << endl « endl; // Print heading. 23 24 25 1. Study the prewritten code to understand what has already been done. 26 cout « "\t\t\t\t\t" << HEAD1 <« endl; 2. Write the control break code, including the code for the dayChange(). // Print two blank lines. 27 function, in the main() function. 28 cout « endl « endl; 29 // Read first record cout <« "Enter day of week or done to quit: "; cin >> dayof Week; if(dayofWeek == SENTINEL) notDone = false; 3. Execute the program by clicking the Run button at the bottom of the 30 31 screen. Use the following input values: 32 Monday-6 hours (omployoe 1) 33 Tuesday-2 hours (employee 1). 3 hours (employee 2) 34 35 { else Wednesday-5 hours (employee 1). 3 hours (employee 2) 36 Thursday-6 hours (employee 1) Friday-3 hours (employeo 1). 5 hours (employee 2)
Addition of Two Numbers
Adding two numbers in programming is essentially the same as adding two numbers in general arithmetic. A significant difference is that in programming, you need to pay attention to the data type of the variable that will hold the sum of two numbers.
C++
C++ is a general-purpose hybrid language, which supports both OOPs and procedural language designed and developed by Bjarne Stroustrup. It began in 1979 as “C with Classes” at Bell Labs and first appeared in the year 1985 as C++. It is the superset of C programming language, because it uses most of the C code syntax. Due to its hybrid functionality, it used to develop embedded systems, operating systems, web browser, GUI and video games.
Help! Thank you.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps