I need help with this program I need to create at this point I'm sorta lost on what I'm supposed to do. Any help would be greatly appreciated THANK YOU!
instructions
Build a program to compute the area of geometric figures. The program will request information about the size of two geometric figures and the output the resulting areas. Create two classes, one named Square and one named Triangle. Each class should:
1. Contain member variables that are relevant for the shape it represents.
2. Use the private and public access specifiers to group class member variables and member functions in the appropriate way.
3. Declare and implement the following two public member functions (according the to exact function prototypes given here):
//gets data for each member variable from
//the user
void getDimensions( );
//calculates the area, based on the current
//member variable values, and returns the
//area to the calling function
double calculateArea( );
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
|
// This file contains the main() function used for Homework 4
// DO NOT MODIFY THIS FILE! Include this file into your VS
// project in order to test that you appropriately create your Triangle
// and Square classes as specified.
#include <iostream>
#include <iomanip>
#include "Square.h"
#include "Triangle.h"
using namespace std;
int main()
{
Square square;
Triangle triangle;
double squareArea = 0.0, triangleArea = 0.0;
cout << "Welcome! This program will collect shape dimensions from\n"
<< "the user and then display the resulting shape areas\n"
<< "based on the specified dimensions.\n\n";
//get dimensions for both shapes from the user
square.getDimensions();
cout << endl;
triangle.getDimensions();
//get the area for both shapes
squareArea = square.calculateArea();
triangleArea = triangle.calculateArea();
//display area results to the user
cout << left << endl;
cout << setw(20) << "Square Area: " << squareArea << endl;
cout << setw(20) << "Triangle Area: " << triangleArea << endl;
cout << endl << endl;
system( "pause" );
return 0;
} // main()
//gets data for each member variable from
//the user
void getDimensions()
{
}
//calculates the area, based on the current
//member variable values, and returns the
//area to the calling function
double calculateArea()
{
}
|