Urgent : Need help with my c++ assignments
Oct 21, 2012 at 6:21am UTC
Will anyone please help me ?
Quite lost, leave your MSN or IM address.
I will pay you if you need..
Can I check how do you retrieve the input(x,y) from LocationData to be called out from PointTwoD
Bold that part
Main 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 64 65 66 67 68 69 70 71 72 73
#include <iostream>
#include <cstring>
#include <string>
#include "PointTwoD.h"
#include "LocationData.h"
using namespace std;
PointTwoD PD;
LocationData test;
// Variables
char input = '5' ;
// Functions
void mainMenu()
{
cout <<"Welcome to Mission Plan Program!" <<endl <<endl;
cout <<"1) Input statistical data\n" ;
cout <<"2) Compute civ. index value (for all records)\n" ;
cout <<"3) Print top 5 exploration destinations\n" ;
cout <<"4) Print total travel distance\n" ;
cout <<"5) Exit\n\n" ;
cout <<"Please enter your choice : " ;
cin >>input;
cout<<"You have keyed in" <<input;
}
int main()
{
// LocationData test;
cout <<"Welcome to Mission Plan Program!" <<endl <<endl;
cout <<"1) Input statistical data\n" ;
cout <<"2) Compute civ. index value (for all records)\n" ;
cout <<"3) Print top 5 exploration destinations\n" ;
cout <<"4) Print total travel distance\n" ;
cout <<"5) Exit\n\n" ;
cout <<"Please enter your choice : " ;
cin >>input;
switch (input) {
case '1' :
{
test.inputData();
test.ShowData();
PD.SetX(2);
PD.SetY(3);
PD.ShowXandY();
}
break ;
case '2' : cout<<"Text" ;
break ;
// case 3: printTop5Destination();
break ;
// case '4': {
// PointTwoD DataInfo;
// DataInfo.Setx(0);
// DataInfo.Sety(1);
// DataInfo.PrintCoordinate();
// break; }
default : cout<<"Exit or Invalid Input\n" ;
break ;
;
return 0;
}
}
LocationData.h
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
#include <iostream>
#include <string>
using namespace std;
class LocationData
{
private :
string sunType;
int noOfEarthLikePlanets;
int noOfEarthLikeMoons;
float aveParticulateDensity;
float avePlasmaDensity;
public :
void SetSunType (string ISunType)
{
sunType = ISunType;
}
void SetPlanetInt(int Planets)
{
noOfEarthLikePlanets = Planets;
}
void SetMoonInt(int Moons)
{
noOfEarthLikeMoons = Moons;
}
void SetParticulateDensity(float PartDensity)
{
aveParticulateDensity = PartDensity;
}
void SetPlasmaDensity(float PlasmaDensity)
{
avePlasmaDensity = PlasmaDensity;
}
void inputData()
{
cout << "[Input statistical data]\n" ;
cout <<"Please enter x-coordinate : " ;
int x = 0;
cin >> x;
cout << "Please enter y-coordinate : " ;
int y = 0;
cin >> y;
cout << "Please enter sun type : " ;
string sunType;
cin >> sunType;
cout << "Please enter no. of earth-like planets : " ;
int noOfEarthLikePlanets = 0;
cin >> noOfEarthLikePlanets;
cout << "Please enter no. of earth-like moons : " ;
int noOfEarthLikeMoons = 0;
cin >> noOfEarthLikeMoons;
cout << "Please enter ave.particulate density (%-tage): " ;
float aveParticulateDensity = 0;
cin >> aveParticulateDensity;
cout << "Please enter ave, plasma density (%-tage): " ;
float avePlasmaDensity = 0;
cin >> avePlasmaDensity;
cout << "Record successfully stored. Going back to main menu\n" ;
// Storing Data into Class
LocationData Data;
Data.SetSunType(sunType);
Data.SetPlanetInt(noOfEarthLikePlanets);
Data.SetMoonInt(noOfEarthLikeMoons);
Data.SetParticulateDensity(aveParticulateDensity);
Data.SetPlasmaDensity(avePlasmaDensity);
void ShowData();
}
void ShowData()
{
cout<<"" <<endl;
cout<<"Detail Entered into System is :\n" ;
cout<< "SunType = " + sunType <<endl;
cout<< "No Of Earth Like Planets : " <<noOfEarthLikePlanets <<endl;
cout<< "No Of Earth Like Moons : " <<noOfEarthLikeMoons <<endl;
cout<< "Average Particulate Density : " <<aveParticulateDensity <<endl;
cout<< "Average Plasma Density : " <<avePlasmaDensity <<endl;
}
};
Point2D.h
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
#include <iostream>
//#include "LocationData.h"
#include <string>
using namespace std;
class PointTwoD
{
private :
int x;
int y;
float civIndex;
public :
void SetX (int xInput)
{
x = xInput;
}
void SetY (int yInput)
{
y = yInput;
}
void ShowXandY()
{
cout<<"X :" <<x <<endl;
cout<<"Y: " <<y <<endl;
}
};
Last edited on Oct 21, 2012 at 3:35pm UTC
Oct 21, 2012 at 7:46am UTC
If the issue is with a single project please post your code. There are many people that are willing to help out. If you need help with all your assignments then I would suggest consulting your teacher or finding a local tutor.
Oct 21, 2012 at 7:59am UTC
Test
Last edited on Oct 21, 2012 at 3:41pm UTC
Oct 21, 2012 at 3:37pm UTC
Can anyone render any help here
Topic archived. No new replies allowed.