Question: Today's lab, you will be using functions to round numbers! There is a math function called floor Read into the function and understand how it

 Today's lab, you will be using functions to round numbers! There
is a math function called floor Read into the function and understand

Today's lab, you will be using functions to round numbers! There is a math function called floor Read into the function and understand how it works. You will need to write four functions e roundTolnteger( number) . roundToTenths( number) e roundToHundredths( number) e roundToThousandths( number) The following line of code rounds to the nearest tenths y = floor ( x * 10 + .5 ) / 10; Overall, your code should perform the following Your code should round a number to the nearest integer, nearest tenths, nearest hundredths and nearest thousandths You should use the correct data types for the parameters and function return types o Your code should have sufficient comments Your code should have correct indentation . Your code should be cfficient (use minimum amount of code nceded..not lines...but code) Your code should only work for numbers larger than 0 Your code should have a while statement to ask a user whether or not they want to continue entering a number and it should quit once the user enters the dummy value (be clear on what the dummy values needs to be) Your code should use a swite Your code should ask the user to what position they would want to round to Your code should have a user friendly interface . Example: What value do you want to round to (enter -1 to quit)? 1. 2. 3. 4. Round to the nearest integer Round to the nearest tenths Round to the nearest hundredths Round to the nearest thousandths Please enter your choice now: 2 Enter the value you want to round to the nearest tenths: 3.14159 The value you entered is 3.14159 and the number rounded to the nearest tenths is 3.1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!