Can someone check if my corrected results would have given me the correct answer?

Alright, I did an assignment recently. This was my original output.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//Ashton Dreiling
//Monthly sales tax exercise

#include <iostream>
#include <stdlib.h>

using namespace std;

//module prototypes
void calculateCountySalesTax(double &countyTax, double &monthySales);
void calculateStateSalesTax(double &monthlySales, double &stateTax);

//global constants to help with mathematical expressions
const double STATE_SALES_TAX_RATE = 0.04;
const double COUNTY_SALES_TAX = 0.02;


int main()
{   //some variables
    double monthlySales;
    double countyTax;
    double stateTax;
    double totalSalesTax;

    cout << "Today we are going to be calculating your total sales tax."<< endl;
    cout << "Please enter your total monthly sales." << endl;
    cin >> monthlySales;
    cout << "You put that your monthly sales are " << monthlySales << endl;
    cout << "We will now calculate your county sales tax." << endl;
    //moving to module calculateCountySalesTax
    calculateCountySalesTax(countyTax, monthlySales);
    cout << "Your county sales tax is $" << countyTax << endl;
    cout << "We will now calculate your state sales tax." << endl ;
    //moving to module calculateStateSalesTax
    calculateStateSalesTax(monthlySales, stateTax);
    cout << "Your state sales tax is $" << stateTax << endl;
    cout << "Now, give us a minute to calculate your total." << endl;

    //total sales tax
    totalSalesTax = stateTax + countyTax;

    cout << "Your total sales tax is $" << totalSalesTax << endl;


    system("Pause");

    return 0;
}//end main

void calculateCountySalesTax(double &countyTax, double &monthlySales)
{
    countyTax = monthlySales + COUNTY_SALES_TAX;
}//end calculateCountySalesTax

void calculateStateSalesTax(double &monthlySales, double &stateTax)
{
    stateTax = monthlySales * STATE_SALES_TAX_RATE;
}//end calculateStateSalesTax 


This is my instructors code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Chapter 3 Programming Exercise: 10
// Ray Warren
// 25 May 2013
// 14 Sept 2013 rewrite with reference parameters to return results

#include <iostream>
#include <cstdlib>
using namespace std;

// Function prototypes
// NOTICE: the use of reference parameters to return results
void getUserInput(double &myTotalMonthlySales);
void calcCountyTax(double myTotalMonthlySales, double &myCountyTax);
void calcStateTax(double myTotalMonthlySales, double &myStateTax);
void displayResults(double myCountyTax, double myStateTax);

// global CONSTANTS
const double COUNTY_TAX = 0.02; // County sales tax rate
const double STATE_TAX = 0.04; // State sales tax rate

int main()
{
     double totalMonthlySales = 0;  // the user supplied total monthly sales
     double countyTax = 0;  // the county sales tax
     double stateTax = 0;  // the state sales tax

     // (INPUT) get the total monthly sales from the user
     getUserInput(totalMonthlySales);

     // (PROCESS) calculate the tax components
     calcCountyTax(totalMonthlySales, countyTax);
     calcStateTax(totalMonthlySales, stateTax);

     // (OUTPUT) display the results
     displayResults(countyTax, stateTax);

     system("Pause");
     return 0;
}    // end main()


void getUserInput(double &myTotalMonthlySales)
{    // get the total monthly sales from the user
     cout << "Enter the total monthly sales." << endl;
     cin >> myTotalMonthlySales;
}    // end getUserInput()

void calcCountyTax(double myTotalMonthlySales, double &myCountyTax)
{    // calculate the tax - return the result through reference
     myCountyTax = myTotalMonthlySales * COUNTY_TAX;
}    // end calcCountyTax()

void calcStateTax(double myTotalMonthlySales, double &myStateTax)
{    // calculate the tax - return the result through reference
     myStateTax = myTotalMonthlySales * STATE_TAX;
}    // end calcStateTax()

void displayResults(double myCountyTax, double myStateTax)
{    // display the results
     cout << "County tax: $" << myCountyTax << endl;
     cout << "State tax: $" << myStateTax << endl;
     cout << "Total sales tax: $" << (myCountyTax + myStateTax) << endl;
}    // end displayResults() 


I know based off of his notes that I made two mistakes.
: countyTax = monthlySales * COUNTY_SALES_TAX; and const double STATE_SALES_TAX_RATE = 0.04;

const double COUNTY_SALES_TAX = 0.02;

If I put those in would that fix the problems I made and therefore would have given me 100%?



Please forgive me for what may be a silly question, but couldn't you just put them in, run the program, and see for yourself if that fixes everything?
I figured i could. I just get nervous sometimes and second guess my "checkings", but a friend checked it for me. : )
Topic archived. No new replies allowed.