Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab1: Conversion CS-116 2021 Spring Semester The purpose of this lab is for you to familiar with your C++ development environment. It will help to

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Lab1: Conversion CS-116 2021 Spring Semester The purpose of this lab is for you to familiar with your C++ development environment. It will help to refresh some of the very basic C++ knowledge. Write a program that do the following unit conversion based on user menu selection: (use while or do-while loop until the user enter 'Quit' selection) 1. Seconds to hours, minutes and seconds (must implement as a function) . . inputs an integer that represents a length of time in seconds. The program should then output the number of hours, minutes, and seconds that corresponds to that number of seconds. Test Cases: If the user input 50391 total seconds then the program should output 13 hours, 59 minutes, and 51 seconds. If the user input is -80, then your program should ask user to reenter a valid number. Your program must check for valid input (positive integer only) o O 2. Fahrenheit to Celsius (must implement as a function) 0 . O . Inputs an Fahrenheit the program will convert to Celsius. For example, input 82 the program should output 27.8 F to C-Deduct 32, then multiply by 5, then divide by 9 Tic) = (82F - 32) > 5/9 = 27.8 C Your program must check for valid input (number only) Hint: use cin.fail() to check for valid input based on the cin data type (cin.clear(), cin.ignore() and cin.fail()) Test cases: o If user enters non-digits such as "abc" then your program should ask user to enter a valid number. o If user enters 82, the program should output 27.8 C . 3. Celsius to Fahrenheit (must implement as a function) . Inputs Celsius the program will convert to Fahrenheit. For example, input 12 the program should output 53.6 C to F - Multiply by 9, then divide by 5, then add 32 Convert 12 degrees Celsius to degrees Fahrenheit: T(F) = 12C x 9/5 + 32 = 53.6 F Your program must check for valid input (number only) Test cases: . . o If user enters non-digits such as "fifty" then your program should ask user to enter a valid number. o If user enters 40, the program should output 104.0 F Modify the printMe First() function below to include your personal information, and call the function 1st before anything else. Below is the sample of the program template #include #include #include #include using namespace std; You can use the following template for all your function documentation format class information Print out the programmer's information such as nam and date/time the program is run @param name the name of the programmer @param courseInfo the name of the course @return - none void printMeFirst (string name, string courseInfo) { cout

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

What are the determinants of cash cycle ? Explain

Answered: 1 week ago

Question

=+Where do you want to live and work?

Answered: 1 week ago

Question

=+1 Where are the best places in the world to live (and work)?

Answered: 1 week ago