Hello This is my homework and I am having trouble figuring how to start would appreciate the help!

It is the year 2035, the MarsX Space Vehicles Company has recently made its X-2 single use Space Transportation Systems (STS) available to the general public. Anyone can purchase the STSs to travel to the nearest celestial bodies (government permits and fees not included). The company has asked you to write a program that calculates the amount (in $) the customers owe for the purchase of the STSs. First, your program should welcome the customer with some fancy message (be creative). Then, the program must present the customer with a menu with two options as follows:
Please Enter One of the Following:
Purchase X-2 STS
If the customer chooses option 1, prompt him/her asking how many STSs he/she would like to purchase AND if he/she is a member of the Interplanetary Travelers Club. Display the amount he/she owes, including some fancy thank you message, keeping the following in mind:
If customer purchases 4 STSs or less, the cost of each STS is $1.0 * 107.
For all purchases above 4 STSs (5 and above), the cost of each STS is $8.0 * 106.
If the customer is a member of the Interplanetary Travelers Club, he/she receives an extra 10% discount and free fuel for one of the STSs (make sure to display a message informing the customer of this).
Customers cannot be allowed to enter a number smaller than 1.
The program will redisplay the menu until the customer enters option 2 (Hint: use do…while loop).
If the customer enters option 2, Quit the program.
Validate for incorrect inputs (Hint: use while loops). If the user enters incorrect answers 5 times quit the program.

Sample outputs (please don’t make yours exactly like this one, use some creativity):
***** Welcome to MarsX Space Vehicles Online Store *****
Please Enter One of the Following:
Purchase MXSV-2 STS
1 [Enter]
How Many MXSV-2 STSs Would You Like to Purchase?
10 [Enter]
Are You a Member of the Interplanetary Travelers Club (y/n)?
y [Enter]
Thank You for Your Purchase: Your Total is $72,000,000.00. You Saved $8,000,000.00 Today!!!
*** You Get Free Fuel for One of Your STSs ***
Your free fuel voucher will arrive with the delivery of your first STS.

Please Enter One of the Following:
Purchase MXSV-2 STS
2 [Enter]
Press any key to continue …

Last edited on
how to start

Split the task into small pieces. The instructions hint at that.

// my first program in C++
#include <iostream>

int main()
  std::cout << "Hello World!"; // This is a greeting
  // This is where the main menu should (re)display
  return 0;

Redisplay, repeat, loop
thank you! I was told I had to use printf and scan , I know that would be the start can you show me?
You were told to use the C Standard Input and Output library? That is possible in C++ program, but not recommended; the C++ iostream library is more convenient (and safe).

What is the programming language on your course?
Yes , this is my first class ever in programming , the class is C for engineers , I would really appreciate the help!
printf works like this

printf("text info with magic marker chars like %i or %1.20f that is near wysiwyg\n", 10, 3.14159265);

%? lets you inject a variable or constant or even another string into that position. Common ones are %i (integers), %f (floating point), %s (string char array), and %c (char). There are MANY more like %x (int in hex).

you can format there also; the %1.20f will print 20 decimal places. You can read up on how this works to control the width and decimals as well as tricks for other data types.

scanf works the inverse way.

scanf ("%i %f", &intvar, &floatvar); //note the & symbol on your variables. This is critical.

Ok so this is what I have , I don't really know what do to next!
This part runs and displays.

#incude <stdio.h>

int main (void)
int option;
unsigned SpaceVehicleQuantity;
double totalCost;

printf("Welcome to MarsX online store\n\n");
printf("Where shopping is always fun\n\n");
printf("%s""1 - Purchase MXSV-2 STSs\n");
printf("%s""2 - Quit and miss a life time experience!\n\n");
printf("Please enter one of the following options");
scans_s("%d" , &option);
You do need loop(s) and conditional execution.
Read: http://www.cplusplus.com/doc/tutorial/control/

Note that this site is about C++ and therefore not all directly usable in C.
There must be sites that focus on C or at least have a section for it.
Like https://cboard.cprogramming.com/

PS. Posting code with code tags makes it much more readable. See http://www.cplusplus.com/articles/jEywvCM9/
Topic archived. No new replies allowed.