//******************************************************
// Filename: Solution_Lab_03.cpp
// Purpose: Paint Your House Calculations
// Author: Ken Busbee; ? 2008 Kenneth Leroy Busbee
// Date: Dec 24, 2008
//******************************************************
// Headers and Other Technical Items
#include <iostream>
using namespace std;
// Function Prototypes
void pause(void);
double getValue();
double calculateArea();
double numgallons();
double totalCost();
//******************************************************
// main
//******************************************************
int main(void)
{
// Input - Test Data = 100, 40, 10, 28.49, 250
// - Alternate Test Data = 20, 30, 10, 12.34, 350
getValue(); // function get value
calculateArea(); // calculate total area
numgallons(); // calculate the number of fallons
totalCost() ; // calculate the total cost of paint
}
// function get value
double getValue()
{
double length,
width,
height,
price_gal_paint,
coverage_gal_paint;
cout << "\nEnter the length of the house in feet --->: ";
cin >> length;
cout << "\nEnter the width of the house in feet ---->: ";
cin >> width;
cout << "\nEnter the height of the house in feet --->: ";
cin >> height;
cout << "\nEnter the price of a gallon of paint ---->: ";
cin >> price_gal_paint;
cout << "\nEnter the coverage of a gallon of paint ->: ";
cin >> coverage_gal_paint;
}
// Process
// function calculate area
double calculateArea(double total_area, double total_gal_paint, double total_cost)
{
length = getValue(length);
total_area = (length * height * 2) + (width * height * 2);
total_gal_paint = total_area / coverage_gal_paint + 0.9999;
total_cost = total_gal_paint * price_gal_paint;
}
// Output - Predicted Results From Test Data = 12, 341.88
// Alternate Test DAta Results = 3, 37.02
double numgallons ()
{
cout << "\n";
cout << "\nThe total gallons of paint needed is ---->: ";
cout << total_gal_paint;
cout << "\nThe total cost is ----------------------->: ";
cout << total_cost;
}
pause();
return 0;
}
//******************************************************
// pause
//******************************************************
void pause(void)
{
cout << "\n\n";
system("PAUSE");
cout << "\n\n";
return;
}
//******************************************************
// End of Program
//******************************************************
I am confused when writing code using the same name of variable
i don't know how the other function get the value that have already been declared in another funtion
and those are errors
C:\Users\se7olutionyg\Desktop\Untitled1.cpp In function `double calculateArea(double, double, double)':
any help would be appriciated