For Lab #6, you must write a C++ language program that meets the following specifications: The program must present a menu prompt for the user to select a particular temperature conversion either a conversion from Fahrenheit to Celsius or Celsius to Fahrenheit i.e. the menu would be similar to: Select one of the following options: 1) Temperature conversion from Fahrenheit to Celsius 2) Temperature conversion from Celsius to Fahrenheit 3) Quit the program now Enter your selection now (1, 2 or 3): Clear the screen(refer to lab 2 on how to do this) and rewrite the menu if a user keys in an integer other than 1, 2 or 3 Pass the selection to a switch statement to process the conversion by use of one of the following formulas Fahrenheit to Celsius use the formula /9(F-32) (use a function for the calculations) Celsius to Fahrenheit use the formula /5+32 (use a function for the calculations) Note: these formulas use doubles for the variables, be aware of side effects of mixing integers and doubles.
Finally output the result of the conversion to two decimal places with appropriate labels (use a function for the output) Be sure to insert spaces in the output for readability and allow the user to go back to the menu by pressing the enter key and clearing the screen and redisplaying the menu. Setup your header comments at the beginning of the source file. Set up function headers as follows: (this goes before your function definition) //************************************************************ // // Function name: // // Purpose: // // Input parameters: // name of each parameter and its purpose pass by value parameters // // Output parameters: //name of each parameter and its purpose that is changed during the function // // call, pass by reference parameters // // Return Value: // data type that is returned for the function // //************************************************************ Example: //****************************************************************** // // Function name: countStudents // // Purpose: count number of student records in a file and reset the // file pointer to the beginning of the file for further reads // // Input parameters: in file handle to file to be read // // Output parameters: in updated file handle // // Return Value: int = number of student records // //******************************************************************* int countStudents(ifstream &in) { student tmp; // temporary record for a student int i = 0; // initially we have no student records in >> tmp; while(!in.eof()) { i++; // increase count of students in >> tmp; // read in one record } in.clear(); // clear eof flag in.seekg(0); // reset file pointer to beginning of the file return i; } · Your program must work correctly with any double input value · Your code must be well structured and it must have comments
Get Free Quote!
382 Experts Online