hi. this is my first post here, my name is jen, someone in my class told me about this site and how helpful all you guys are and im so lost i thought id come try and see if someone can help me understand :(
i dont even know where to start please help :(
"Define a class Area that has two private variable members; units of type string and area_value of type float. Modify the above program to create a dynamic variable of type Area.
-Input from the keyboard the area_value and its units. Compute one-half and one-quarter of the area and display the results with unit.
-Destroy the dynamic variable at the end
-The input of the unit does not have space in it.
-The default unit is Squaremeter and default area value is 0."
here's the "above program"
#include <iostream>
using namespace std;
int main ()
{
int *p1;
p1 = new int;// Variables created using the new operator are called dynamic variables
cout << "Enter an integer \n";
cin >> *p1;
*p1 = *p1 + 7;
cout << "Your input + 7 = " << *p1 << endl;
delete p1;// Delete the dynamic variable p1 and return the memory
return 0;
}
and heres the given class definition
class Area
{
public:
Area();
void setu(string a);
void seta(float b);
string getu();
float geta();
private:
string unit;
float area_value;
};