C++ Function/Switch Statement Homework

Sep 29th, 2015
DreamIt
Category:
Computer Science
Price: $50 USD

Question description

Okay, I need this done correctly. Please use a switch statement for the menu. Please don't forget the last two functions in the statements-You can chose these functions. I bolded important parts of the instructions. 

This is a long assignment, so please let me know if you need clarification/help. Thank you

-------------------------------------------------------------------------------------------------

For each calculation in your program, you should write (at least) two functions. One function should perform the calculation and return the result, and the other function should accept necessary data from the user, call the calculation function, and then display the result. You should also have a menu function which presents the user with the possible choices for calculations 

Get Started

To begin, create an empty project. For the main(), copy/paste the following into your homework project.

int main() { 
// DO NOT change this main function 
  Menu(); 
  return 0; 
} // end of Main Function 

Note that the main function calls a Menu function, which you need to write. Note also that you are not allowed to change the main function. Thus, your Menu function will need to call another function which is associated with the calculation chosen by the user. 

You should place your function definitions below your main(). 

The Functions

Your program must have the following functions that perform the described tasks:

  • Menu, which has no parameters and no return value. This function displays the list of available calculations to the user, and then accepts a choice from the user. For practice, use a switch statement to decide which function gets called.
  • PoundsToKilograms, which has no parameters and no return value. This function asks the user to input the number of pounds to convert, calls DoPoundsToKilograms to do the calculation, and then outputs the result returned.
  • DoPoundsToKilograms, which has one double parameter (pounds) and returns a double (kilograms). This function does the pounds to kilogram conversion, and then returns the results. Note: 1 pound is about 0.454 kilograms.
  • FeetToMeters, which has no parameters and no return value. This function asks the user to input the number of feet to convert, calls DoFeetToMeters to do the calculation, and then outputs the result returned.
  • DoFeetToMeters, which has one double parameter (feet) and returns a double (meters). This function does the feet to meter conversion, and then returns the results. Note: 1 foot is about 0.3048 meters.
  • BodyMassIndex, which has no parameters and no return value. This function asks the user to input height (in feet) and weight (in pounds). Then, this function calls DoPoundsToKilograms andDoFeetToMeters to do conversions, and then calls DoBMI to do the calculation. Finally, this function outputs the result returned.
  • DoBMI, which has two double parameters (kilograms and meters) and returns a double (BMI). This function calculates the BMI, and then returns the results. Note: BMI is calculated as (weight (kg)) / (height (m) * height (m)).
  • Add (at least) two more functions to your program that calculates something you think would be useful for your calculator (i.e., (1) an input function with no parameters and no return value and (2) a calculation function with at least one parameter used in the calculation). Make this function accessible from your Menu function and test it completely.

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Cornell University
PREMIUM TUTOR

Studypool has helped 1,244,100 students

5 Reviews


Summary
Quality
Communication
On Time
Value
ashleyisgod
Nov 27th, 2016
" Top quality work from this guy! I'll be back! "
Molly_Moon
Nov 4th, 2016
" AMAZING as always! "
Hemapathy
Oct 13th, 2016
" all I can say is wow very fast work, great work thanks "
BlueOcean
Sep 29th, 2016
" Awesome! Exactly what I wanted. "
kevin12622
Sep 20th, 2016
" Goes above and beyond expectations ! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1822 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors