Write a C program that will present a menu with four options: 1. Traveling to the Moon 2. Traveling to Mars 3.Traveling to Venus 4. Exit program. You will ask the user for the traveling speed after the user has chosen options 1, 2 or 3. Your program must keep presenting the menu until the user chooses option 4. Run your program with the following speeds: 100 km/h (car), 500 km/h (airplane), and 41000 km/h (rocket).

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%
*DONOT USE CHATGPT, please put comments so i can understand. It’s a C language program with algorithm.
Problem 2: Let's assume that you could travel to the Moon by car traveling at 100 km/h.
How long would that take to get there? How about going to Mars or Venus? If you go
there by rocket with a higher speed, it would obviously take less time.
To solve this problem you will need to write three user-defined functions, one for each
destination. Each of the functions will take the traveling speed in km/h as the argument
and give the time (in hours) it will take to get to the destination.
Note that because there are minimum (perigee) and maximum (apogee) distances between
the Earth, the Moon, Mars and Venus, you will need to calculate the minimum and
maximum travel times so the three functions will each produce two results.
Distances:
Earth to Moon > Perigee: 363,104 km. Apogee: 405,696 km
Earth to Mars > Perigee: 54.6 million km. Apogee: 401 million km
Earth to Venus > Perigee: 38 million km. Apogee: 261 million km
Write a C program that will present a menu with four options:
1. Traveling to the Moon
2. Traveling to Mars
3. Traveling to Venus
4. Exit program.
You will ask the user for the traveling speed after the user has chosen options 1, 2 or 3. Your
program must keep presenting the menu until the user chooses option 4.
Run your program with the following speeds: 100 km/h (car), 500 km/h (airplane), and
41000 km/h (rocket).
Transcribed Image Text:Problem 2: Let's assume that you could travel to the Moon by car traveling at 100 km/h. How long would that take to get there? How about going to Mars or Venus? If you go there by rocket with a higher speed, it would obviously take less time. To solve this problem you will need to write three user-defined functions, one for each destination. Each of the functions will take the traveling speed in km/h as the argument and give the time (in hours) it will take to get to the destination. Note that because there are minimum (perigee) and maximum (apogee) distances between the Earth, the Moon, Mars and Venus, you will need to calculate the minimum and maximum travel times so the three functions will each produce two results. Distances: Earth to Moon > Perigee: 363,104 km. Apogee: 405,696 km Earth to Mars > Perigee: 54.6 million km. Apogee: 401 million km Earth to Venus > Perigee: 38 million km. Apogee: 261 million km Write a C program that will present a menu with four options: 1. Traveling to the Moon 2. Traveling to Mars 3. Traveling to Venus 4. Exit program. You will ask the user for the traveling speed after the user has chosen options 1, 2 or 3. Your program must keep presenting the menu until the user chooses option 4. Run your program with the following speeds: 100 km/h (car), 500 km/h (airplane), and 41000 km/h (rocket).
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY