Week05Assignment.cpp
// The DisplayTotal function which will display the amount of money made
// Added iTotalXXXS as a parameter here
The DisplayTotal function which will display the amount of money made
Added iTotalXXXS as a parameter here
The DisplayTotal function which will display the amount of money made Added iTotalXXXS as a parameter here
void DisplayTotal(const int iTotalSmall, const int iTotalMedium, const int iTotalLarge, const int iTotalXXXS) {
    const double smallPrice = 175.00;
    const double mediumPrice = 190.00;
    const double largePrice = 200.00;
    const double xxxsPrice = 100.00;
    double smallTotal = 0.0;
    double mediumTotal = 0.0;
    double largeTotal = 0.0;
    double xxxsTotal = 0.0;
    if (iTotalSmall != 0) {
        smallTotal = iTotalSmall * smallPrice;
        cout << "The total number of small surfboards is " << iTotalSmall << " at a total of $" << fixed << setprecision(2) << smallTotal << endl;
    }
    if (iTotalMedium != 0) {
        mediumTotal = iTotalMedium * mediumPrice;
        cout << "The total number of medium surfboards is " << iTotalMedium << " at a total of $" << fixed << setprecision(2) << mediumTotal << endl;
    }
    if (iTotalLarge != 0) {
        largeTotal = iTotalLarge * largePrice;
        cout << "The total number of large surfboards is " << iTotalLarge << " at a total of $" << fixed << setprecision(2) << largeTotal << endl;
    }
    if (iTotalXXXS != 0) {
        xxxsTotal = iTotalXXXS * xxxsPrice;
        cout << "The total number of xxxs surfboards is " << iTotalXXXS << " at a total of $" << fixed << setprecision(2) << xxxsTotal << endl;
    }
    if (iTotalSmall == 0 && iTotalMedium == 0 && iTotalLarge == 0 && iTotalXXXS == 0) {
        cout << "No purchases made yet." << endl;
    }
    double moneyMade = smallTotal + mediumTotal + largeTotal + xxxsTotal;
    if (moneyMade != 0.0) {
        cout << "Amount due: $" << moneyMade << endl;
    }
}
void DisplayTotal ( const int iTotalSmall , const int iTotalMedium , const int iTotalLarge , const int iTotalXXXS ) { const double smallPrice = 175.00 ; const double mediumPrice = 190.00 ; const double largePrice = 200.00 ; const double xxxsPrice = 100.00 ; double smallTotal = 0.0 ; double mediumTotal = 0.0 ; double largeTotal = 0.0 ; double xxxsTotal = 0.0 ; if ( iTotalSmall != 0 ) { smallTotal = iTotalSmall * smallPrice ; cout << " " << iTotalSmall << " " << fixed << setprecision ( 2 ) << smallTotal << endl ; } if ( iTotalMedium != 0 ) { mediumTotal = iTotalMedium * mediumPrice ; cout << " " << iTotalMedium << " " << fixed << setprecision ( 2 ) << mediumTotal << endl ; } if ( iTotalLarge != 0 ) { largeTotal = iTotalLarge * largePrice ; cout << " " << iTotalLarge << " " << fixed << setprecision ( 2 ) << largeTotal << endl ; } if ( iTotalXXXS != 0 ) { xxxsTotal = iTotalXXXS * xxxsPrice ; cout << " " << iTotalXXXS << " " << fixed << setprecision ( 2 ) << xxxsTotal << endl ; } if ( iTotalSmall == 0 && iTotalMedium == 0 && iTotalLarge == 0 && iTotalXXXS == 0 ) { cout << " " << endl ; } double moneyMade = smallTotal + mediumTotal + largeTotal + xxxsTotal ; if ( moneyMade != 0.0 ) { cout << " " << moneyMade << endl ; } }
The DisplayTotal function which will display the amount of money made
Added iTotalXXXS as a parameter here
The DisplayTotal function which will display the amount of money made Added iTotalXXXS as a parameter here
// Declare the variables for board prices // made up a price for xxxs size // Declare variables for the size totals // added xxxs here too // We don't want to display prices for sizes that haven't received purchases yet // Again, I used if statements to accomplish this // now to calculate the price for xxxs // added xxxs here // Now we need to calculate the total money made // add the money from xxxs to here as well // Only display the amount due if money made is not $0