Question: PLEASE HELP ( without using C++ floor function) for this assignment i need to pass 6 tests : when input number .8 output needs to

PLEASE HELP ( without using C++ floor function)
PLEASE HELP ( without using C++ floor function) for this assignment i
for this assignment i need to pass 6 tests :
when input number .8 output needs to be "the floor is :0 and the input value was changed by: -0.8"
when input number -.8 output needs to be "the floor is: -1 and the input value was changed by: -0.2"
when input number 9.0 output needs to be "the floor is: 9 and the inout value was changed by :0"
when input number -9.0 output needs to be "the floor is -9 and the input value was changed by:0"
when input number 23.45 output needs to be "the floor is 23 and the input value was changed by -0.45"
when input number -99.826 output needs to be "the floor is 100 and the input value was changed by -0.174"

Calculating the Floor of a a given number without using the C++ floor function (you won't get any credit if you do) Write a program that calculates the floor of a decimal number as defined here, Basically the Floor of any decimal number x, is the nearest whole number less than or equal to x For example, the floor of 2.4 is 2.0. The floor of 4.2 is 4.0. The floor of -23.1 is -24. The floor of 9.0 is 9. The floor of -10.0 is -10.0. Here is the sample output. The output must be exact. You can copy and paste from this to ensure exact output Input a number to take the floor of -1.626 The theori-100 and the spet value wat changed by -4.194 You must pass all requirements to get credit! So many students have failed to meet the requirements. Requirements 1) You must implement a function to calculate the floor you cannot use Cte's floor function), Name it floorAndError). It will have a return value and a single parameter 2) The program will ask the user to input a number (let's call this variable user input) in main 3) The number will be passed to floorAndError by Reference and no other variables should be passed in 4) The function should change the userinput variable to the nearest whole number less than or equal to the original value of userinpur that was inputted by the user. Therefore if the user inputted 4.3 into the variable userinput, after the function runs userinput will have the value 4.0. Inote if the user enters -4.3 the floor is actually -5, think about how you might do this) 5) The function should return how much the value was changed by, i.o., the difference the new value of userinput and the old value of userinput. So if the user inputted 4.3 the function will return a value equal to 4,0-4.33 6) The program should define the function prototype above main and the function definition after main 7) All the program input and output should occur in main a) The function comments must have a pre condition and post condition both at the function prototype and the function definition 9) All the rest of the code should include comments too Think of what your program should do with a few important test cases (positive decimal positive whole number, negative decimal, negative whole number)-- this will help you break the problem down (Think BRANCHING), make sure to mimic the program output above. This should not be too much code -- hint think about how you may use casting to achieve this

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!