Professional Documents
Culture Documents
Arriz John Villaflor Bsce 2B
Arriz John Villaflor Bsce 2B
VILLAFLOR BSCE 2B
1. The payroll manager at Holmes Supply Company wants a program that allows her
to enter the payroll amount for each of three stores: Robinsons Mall, Gasiano
Mall, and SM Mall. The program should calculate the total payroll and then
display the result on the screen. The program will use a counter to ensure that
the payroll manager enters exactly three payroll amounts. It will use an
accumulator to total the amounts.
#include <iostream>
int main() {
double totalPayroll = 0;
std::cout << "Enter payroll amount for " << storeNames[store] << ": ";
double payrollAmount;
while (std::cin.fail()) {
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
totalPayroll += payrollAmount;
std::cout << "\nTotal Payroll for all stores: $" << totalPayroll << "\n";
return 0;