(5/5)

Hire Me
(5/5)

Hire Me
(5/5)

Hire Me
(5/5)

Hire Me

# This program will present the user with a main menu of options which the user can choose from to perform simple unit conversions

INSTRUCTIONS TO CANDIDATES

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:

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

2. Each conversion should be done by a function that takes a single argument of a floating point 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

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!).

1. Conversion from kilometers to miles should be done by multiplying the number of kilometers by 0.621371.

2. Conversion from miles to kilometers should be done by multiplying the number of miles by 1.60934.

3. Conversion from meters to feet should be done by multiplying the number of meters by 28084.

4. Conversion from feet to meters should be done by multiplying the number of feet by 3048.

5. Conversion from centimeters to inches should be done by multiplying the number of centimeters by 393701.

6. Conversion from inches to centimeters should be done by multiplying the number of inches by 2.54.

Submission:

All programming assignments are to be submitted electronically. Programming assignments should be done in Visual Studio 2017. For the electronic submission, just make a zip file of the Visual Studio 2017 project folder for your project and submit that via Canvas. Grading late assignments is really time consuming (seriously – I didn't realize this until I started grading), so don't turn in any assignment late unless you've made arrangements with me.

As always, do your own work.

Example Run:

Jacob Hauenstein

CS102-04 Programming assignment 2

This program will present you with a menu.

Select from the menu to choose from common length unit conversions. When you are done performing conversions, enter "q".

1. Convert kilometers to miles

2. Convert miles to kilometers

3. Convert meters to feet

4. Convert feet to meters

5. Convert centimeters to inches

6. Convert inches to centimeters Your choice: a

Enter the length in kilometers: 1 That's 0.621371 miles.

1. Convert kilometers to miles

2. Convert miles to kilometers

3. Convert meters to feet

4. Convert feet to meters

5. Convert centimeters to inches

6. Convert inches to centimeters Your choice: b

Enter the length in miles: 1 That's 1.609340 kilometers.

1. Convert kilometers to miles

2. Convert miles to kilometers

3. Convert meters to feet

4. Convert feet to meters

5. Convert centimeters to inches

6. Convert inches to centimeters Your choice: q

Hints:

Remember that one of the problems with reading in a single character is that when the user presses Enter, a '\n' character is entered into the input buffer as well. You'll have to find a way to throw out the '\n' or your program will have issues. We’ll discuss this some in class.

When I grade these, I will be checking for the following things:

1. Code compiles and executes without crashing (2 points)

2. The code is consistently and appropriately formatted (spacing is consistent, ) (2 points)

3. Comments are present and appropriate (1 point)

4. The program prints the author name, class section, etc. (1 point)

5. The program returns to the menu after doing a unit conversion (2 points)

6. The menu is implemented with a switch statement (2 points)

7. The conversions are calculated outside of the main function (2 points)

8. Conversions are all performed correctly (8 points)

## Related Questions

##### . The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

##### . Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

##### . The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

##### . Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

##### . The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

409 Experts Online