954,480 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need Help Writing a Very Complicated Code

I'm not sure where to start with this code. I would greatly appreciate if someone could write the code up for me.

Here are the details.
The program should prompt the user to enter the weight of an object on Earth, between 0 and
1000 pounds, and the name of a planet. It should then output how much the object would
weigh on the specified planet.
• Use the table below to get the factor by which the weight must be multiplied for each
planet.
• The program should check that the user has input valid data. The program should
output an error message if the user inputs an incorrect planet name or a weight
outside the bounds.
• The program should allow the user to keep inputting weights for different planets
until they are ready to quit the program.
• The prompts and error messages should make it clear to the user how planet names
should be entered and what the valid range for the weight is.
• The results should be displayed neatly and well formatted. The weight on the
specified planet should be displayed with a precision of 2.

Also make sure to include:
Planet Weight)Conversion)Factor
Mercury 0.4155
Venus 0.8975
Earth 1.0
Mars 0.3507
Jupiter 2.5374
Saturn 1.0677
Uranus 0.8947
Neptune 1.1794

If you feel as if you can do this for me, please contact me via AIM @ crunner17 or via YIM @ crunner17. Please respond to the thread if you can help me by leaving me something is which I can contact you.

If you can do this for me, I will love you forever.

Thanks

determine
Newbie Poster
15 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

Show us some code, we don't do your homework!

jshoot
Junior Poster in Training
52 posts since Jan 2011
Reputation Points: 9
Solved Threads: 0
 

psh lol thats not complicated at all.. also what kinda of code they want it in??

MFC? API?? Windows Form???

triumphost
Posting Whiz
390 posts since Oct 2009
Reputation Points: 57
Solved Threads: 36
 

psh lol thats not complicated at all.. also what kinda of code they want it in??

MFC? API?? Windows Form???

I'm not excatly sure what kind of code. It's C++ so I'm guessing very basic. And I use g++ as a complier if that helps. Would you be able to help me out?

determine
Newbie Poster
15 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

Well.... U havent shown any effort :S

This is just a start but it is not the program:

#include <windows.h>
#include <string.h>
#include <math.h>
#include <cmath>
#include <iostream>

using namespace std;

int weight;
string Planet;

int main()
{
   cout<<"Please Enter The weight of an object: "
   cin>> weight;
   cout<<"\n\nPlease enter the Planet name: ";
   cin>> Planet;

   switch(Planet)
   {
    case: ........
          break;
    case: ........
          break;
    default: cout<<"that planet name is wrong or does not exist\n";
          break;
   }
return 0;
}


Of course u can use if-else statements.. such as if(.....){do something} else if (..){do something else} else{do something}

thats just a start.. but I cannot help any further till you show code or effort.

P.S. Your going to want to put a repeat function in there like a do while condition..
Another thing could be done like:

#define REPEAT do{
#define UNTIL( condition ) }while(!(condition));

then in your code you would write:
int i=0;
REPEAT
code here to make the program repeat until the user exits..
Until(i = 20);

etc..

triumphost
Posting Whiz
390 posts since Oct 2009
Reputation Points: 57
Solved Threads: 36
 

Well.... U havent shown any effort :S

This is just a start but it is not the program:

#include <windows.h>
#include <string.h>
#include <math.h>
#include <cmath>
#include <iostream>

using namespace std;

int weight;
string Planet;

int main()
{
   cout<<"Please Enter The weight of an object: "
   cin>> weight;
   cout<<"\n\nPlease enter the Planet name: ";
   cin>> Planet;

   switch(Planet)
   {
    case: ........
          break;
    case: ........
          break;
    default: cout<<"that planet name is wrong or does not exist\n";
          break;
   }
return 0;
}

Of course u can use if-else statements.. such as if(.....){do something} else if (..){do something else} else{do something}

thats just a start.. but I cannot help any further till you show code or effort.

P.S. Your going to want to put a repeat function in there like a do while condition.. Another thing could be done like:

#define REPEAT do{ #define UNTIL( condition ) }while(!(condition));

then in your code you would write: int i=0; REPEAT code here to make the program repeat until the user exits.. Until(i = 20);

etc..


thanks very much. i'll try to finish is one up.

determine
Newbie Poster
15 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You