Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MARS Program must be in MIPS. I don\'t understand this. It\'s not as simple as j

ID: 3763375 • Letter: M

Question

MARS Program must be in MIPS. I don't understand this. It's not as simple as just converting it from java to mips. Write a program to calculate the number of gallons of paint needed to paint a room. Assume that a gallon covers 350 square feet. Assume that you are painting two coats on all four walls. You are painting one coat on the ceiling, using ceiling paint which is a different kind of paint. Remember that if there is any fractional part when calculating the number of gallons you need to round up so you are sure to have enough paint. Input: length of room (in feet) width of room (in feet) height of ceiling (in feet) price of a gallon of paint (assume same price for wall paint and ceiling paint) Output: your name total number of square feet of walls number of gallons of wall paint needed total number of square feet of ceiling number of gallons of ceiling paint needed cost of paint Make sure your program includes comments. You need comments at the top with your name and lab number, and a comment for every line of executable code.

I have completed most of it but need help with the last 2 parts. I need help calculating the paint needed for the ceiling and total cost of paint. I can send you my code. Just message me or comment.

Explanation / Answer

#include <iostream>

using namespace std;

#include <iomanip>

#include <cmath>

void init(void);

void splash(void);

void getInput(void);

void doCalc(void);

void sendOutput(void);

void loop(void);

void eodr(void);

double fHeight, fWidth, fLength, fPaintSpace, fGallonCost, fGallonsNeeded, fArea;

char sFirstName[16], sLastName[16], sState[3], cSalesDay, sFirstHigh[16], sLastHigh[16];

double fCost, fCostTax, fCostDiscount, fRedundant;

double CountGA, CountFL, CountSC, CountTN, CountAL, CostGA, CostFL, CostSC, CostTN, CostAL, TotalCount, TotalCost, CountOther, CostOther;

int main() {

            init();

            splash();

            loop();

            eodr();

            return 0;

}

void loop(void) {

while ((cSalesDay == 'y') || (cSalesDay == 'Y')) {

                        system("cls");

                        getInput();

                        doCalc();

                        sendOutput();

                splash();

                        system("cls");

}

return;}

void splash(void) {

            cout << "Is today a sales day (Y/N)? ";

            cin >> cSalesDay;

            system("cls");

return;}

           

void getInput(void) {

            cout << "Customer Name (first and last): ";

            cin >> sFirstName >> sLastName;

            cout << " Height:           "; // get the height of the room to be painted

            cin >> fHeight;

            cout << " Width:            "; // get width

            cin >> fWidth;

            cout << " Length:           "; // get length

            cin >> fLength;

            cout << " Gallon Coverage: "; // get fPaintSpace

            cin >> fPaintSpace;

            cout << " Cost Per Gallon: "; // get gallon cost

            cin >> fGallonCost;

    cout << " State:            ";

            cin >> sState;

            system("cls");

            if ((fGallonCost >= 1) && (fGallonCost <= 50)) {

                        return;}

            else {

                        cout << " Invalid. Please enter a number between 1 and 50: ";

                        cin >> fGallonCost;

                        if ((fGallonCost >= 1) && (fGallonCost <= 50)) {

                                                system("cls");

                                                return;}

                        else {

                                                cout << " Invalid!!";

                                                system("cls");

                                                return;}

            }

}

void doCalc(void) {

/* Customer Sale Calculation */

            fArea = fHeight * fWidth; // get one wall's area

            fGallonsNeeded = fHeight * fLength; // get perpendicular wall's area

            fArea *= 2; // account for two walls

            fGallonsNeeded *= 2; // account for two walls

            fArea = fArea + fGallonsNeeded; // add for total area to be painted

            fGallonsNeeded = ceil (fArea / fPaintSpace); // get number of gallons needed

            fCost = fGallonsNeeded * fGallonCost; // calculate price

/* State Gallon Counter */

            if ((sState == "ga") || (sState == "GA") || (sState == "gA") || (sState == "Ga")){

                        CountGA = CountGA + fGallonsNeeded;}

            else if ((sState == "fl") || (sState == "FL") || (sState == "fL") || (sState == "Fl")){

                        CountFL = CountFL + fGallonsNeeded;}

            else if ((sState == "sc") || (sState == "SC") || (sState == "sC") || (sState == "Sc")){

                        CountSC = CountSC + fGallonsNeeded;}

            else if ((sState == "tn") || (sState == "TN") || (sState == "tN") || (sState == "Tn")){

                        CountTN = CountTN + fGallonsNeeded;}

            else if ((sState == "al") || (sState == "AL") || (sState == "aL") || (sState == "Al")){

                        CountAL = CountAL + fGallonsNeeded;}

            else{CountOther = CountOther + fGallonsNeeded;}

/* Discount Calculations */

            if (fGallonsNeeded == 1){fCostDiscount = fCost * 0.95;}

            else if ((fGallonsNeeded == 2) || (fGallonsNeeded == 3)){fCostDiscount = fCost * 0.90;}

            else if (fGallonsNeeded == 4){fCostDiscount = fCost * 0.85;}

            else{fCostDiscount = fCost * 0.80;}

/* STARTING THE TAX SECTION */

            if ((sState == "ga") || (sState == "GA") || (sState == "gA") || (sState == "Ga")){

                        fCostTax = fCostDiscount * 1.06;}

            else if ((sState == "fl") || (sState == "FL") || (sState == "fL") || (sState == "Fl")){

                        fCostTax = fCostDiscount * 1.04;}

            else if ((sState == "sc") || (sState == "SC") || (sState == "sC") || (sState == "Sc")){

                        fCostTax = fCostDiscount * 1.05;}

            else if ((sState == "tn") || (sState == "TN") || (sState == "tN") || (sState == "Tn")){

                        fCostTax = fCostDiscount * 1.05;}

            else if ((sState == "al") || (sState == "AL") || (sState == "aL") || (sState == "Al")){

                        fCostTax = fCostDiscount * 1.02;}

            else{fCostTax = fCostDiscount * 1.00;}

/* Cost by State Counter */

            if ((sState == "ga") || (sState == "GA") || (sState == "gA") || (sState == "Ga")){

                        CostGA = CostGA + fCostTax;}

            else if ((sState == "fl") || (sState == "FL") || (sState == "fL") || (sState == "Fl")){

                        CostFL = CostFL + fCostTax;}

            else if ((sState == "sc") || (sState == "SC") || (sState == "sC") || (sState == "Sc")){

                        CostSC = CostSC + fCostTax;}

            else if ((sState == "tn") || (sState == "TN") || (sState == "tN") || (sState == "Tn")){

                        CostTN = CostTN + fCostTax;}

            else if ((sState == "al") || (sState == "AL") || (sState == "aL") || (sState == "Al")){

                        CostAL = CostAL + fCostTax;}

            else{CostOther = CostOther + fCostTax;}

/* Keeping track of Totals */

            TotalCount += fGallonsNeeded;

            TotalCost += fCostTax;

            if (fCostTax > fRedundant){

                        fRedundant = fCostTax;

                        strcpy_s(sFirstHigh,sFirstName);

                        strcpy_s(sLastHigh,sLastName);}

return;} // End doCalc()

           

void sendOutput(void) {

            cout << "Customer Name:            " << sFirstName << " " << sLastName << endl;

            cout << " Number of Gallons Needed: " << fGallonsNeeded << endl;

            cout << " Cost Before Discount:     $" << setprecision(2) << fixed << fCost << endl;

            cout << " Cost After Discount:      $" << setprecision(2) << fixed << fCostDiscount << endl;

            cout << " Cost With Tax:            $" << setprecision(2) << fixed << fCostTax << endl;

return;}

void eodr(void) {

            cout << "State      # of Cans      Total Cost After Discount/Tax ";

            cout << "GA           " << setprecision(0) << fixed << CountGA << "                     $" << CostGA << endl;

            cout << "FL           " << setprecision(0) << fixed << CountFL << "                     $" << CostFL << endl;

            cout << "SC           " << setprecision(0) << fixed << CountSC << "                     $" << CostSC << endl;

            cout << "TN           " << setprecision(0) << fixed << CountTN << "                     $" << CostTN << endl;

            cout << "AL           " << setprecision(0) << fixed << CountAL << "                     $" << CostAL << endl;

            cout << "Other        " << setprecision(0) << fixed << CountOther << "                     $" << CostOther << endl;

            cout << "________________________________________________________ ";

    cout << "Grand Total " << TotalCount << "                     $" << TotalCost << endl;

            cout << " Customer With Highest Total After Tax: " << sFirstHigh << sLastHigh << endl;

            cout << "Customer Total:                         $" << setprecision(2) << fixed << fRedundant << endl;

            return;

}

void init(void) {

            fHeight = 0.0; fWidth = 0.0; fLength = 0.0; fPaintSpace = 0.0; fGallonCost = 0.0;

            fGallonsNeeded = 0.0; fArea = 0.0; fCost = 0.0;

            fCostTax = 0.0; fCostDiscount = 0.0; fRedundant = 0.0; CountGA = 0.0; CountFL = 0.0;

            CountSC = 0.0; CountTN = 0.0; CountAL = 0.0; CostGA = 0.0; CostFL = 0.0; CostSC = 0.0;

            CostTN = 0.0; CostAL = 0.0; TotalCount = 0.0; TotalCost = 0.0; CountOther = 0.0; CostOther = 0.0;

}