Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have to write this using C programming and using a switch statement. It has to run in visual studio. I'm completely lost. How should

image text in transcribed

image text in transcribedimage text in transcribed

I have to write this using C programming and using a switch statement. It has to run in visual studio. I'm completely lost. How should I set up this switch statement?

Overview: This second programming assignment will make use of several things we've learned (or will shortly learn) since the first programming assignment. This includes floating point numbers (defining them, reading them in from keyboard, etc), functions (we'll have more than just a main() function in this program), returning values from functions, and switch statements. Brief Description: This program will present the user with a main menu of options which the user can choose from to perform simple unit conversions. Once the user has chosen an option from the menu, the program should provide a brief explanation of the conversion to be performed and allow the user to enter a quantity to be converted. The program should then display the converted result. After performing the conversion, the program should return the user back to the main menu. Details: When your program first runs, it should print out your name, the course number (CS102-03), and the programming assignment name (Programming Assignment #2), each on a new line. Then, the program should skip a line (i.e., print a blank line), and print a brief description of what the program does. After the description, the program should print out a main menu similar to the following: Here is the menu. Enter your choice (or q to quit): a) Convert kilometers to miles b) Convert miles to kilometers c) Convert meters to feet d) Convert feet to meters e) Convert centimeters to inches f) Convert inches to centimeters When the user picks an option from the menu, the program should take in input from the user and perform the conversion, along with proper prompts. For example, if the user selects option a, the program should ask the user to input the number of kilometers to be converted, and the program should When the user picks an option from the menu, the program should take in input from the user and perform the conversion, along with proper prompts. For example, if the user selects option "a", the program should ask the user to input the number of kilometers to be converted, and the program should print out the converted number. After the conversion is performed, the program should return to the main menu. When the user enters "q" at the main menu, the program should quit immediately. I've included an example run" on the next page, which should clarify exactly what information is to be printed and with what formatting. Specific Implementation Requirements: 1. The menu should be implemented as a switch statement. 2. Each conversion should be done by a function that takes a single argument of a floating point number. Each function should return a floating point number. There are 6 conversions to be done, so there should be 6 of these functions. 3. All input from the keyboard and output to the screen should be done in main - nowhere else. CS102-04 Programming Assignment #2 Due: 2/25/2020 4. All functions should have appropriate comments explaining what data the function takes in, what data the function returns, and what the function does (this includes main!). 5. Conversion from kilometers to miles should be done by multiplying the number of kilometers by 0.621371. 6. Conversion from miles to kilometers should be done by multiplying the number of miles by 1.60934. 1.60934. 7. Conversion from meters to feet should be done by multiplying the number of meters by 3.28084. 8. Conversion from feet to meters should be done by multiplying the number of feet by 0.3048. 9. Conversion from centimeters to inches should be done by multiplying the number of centimeters by 0.393701. 10. Conversion from inches to centimeters should be done by multiplying the number of inches by 2.54

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions