Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ An application of the floor) unction is rounding a value to a specific decimal point. The statement y-floor(x0.5) rounds the variable x to the

image text in transcribed
C++
An application of the floor) unction is rounding a value to a specific decimal point. The statement y-floor(x0.5) rounds the variable x to the nearest integer and assigns the result to y. The statement y floor(10.0+0.5)/10.0 rounds the variable x to the tenths place and assigns the result to y. The statement floor ( x 100.0 0.5)/100 . 0; y * + = rounds the variable x to the hundredths place and assigns the result to y Write a program that defines four functions to round a variable x various ways with the following function prototypes: a int roundToInteger (double x) b) double roundToTenths (double x) c) double roundToHundredths (double x) d) double roundtoThousandths (double x) Use these functions to round the average of a sequence of numbers to the proper decimal point. Specifications: Prompt the user to enter the number of values to be averaged. Use this value to create a for) loop to read in a sequence of numbers. Calculate the average of the numbers, and pass the average into each of the functions to round the value to the required decimal points. Print the results to the screen with 4 values after the decimal point, as necessary. As an example, if you execute the program with the following underlined inputs, the output will be: -main.o Enter Number of Values to be Averaged: 3 Enter a number: 1.299999 Enter a number: 4.5321 Enter a number: -2.3 The raw average is: ...to the nearest integer: 1 to the tenths place: t the hundredths place : 1.2000 1.1800 ...to the thousandths place: 1-1770 -s Develop your I/O diagram and pseudocode, debug your code, and submit to the Grader Program

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

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago