Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having trouble with this as I am a beginner: This program should have a main function. 3. The program should also have another

I am having trouble with this as I am a beginner:

This program should have a main function. 3. The program should also have another function calledRoundFunct and this function should round up or round down a double value to an integer value. 4. Rules: Cannot use round function

  • For positive values
    • Round up a value if its fraction part is greater or equal to .5
    • Round down a value if its fraction part is less than .5
  • For negative values
    • Round down a value if its fraction part is greater or equal to .5
    • Round up a value if its fraction part is less than .5

5. Examples

  • 0.4 should be rounded down to 0
  • 0.6 should be rounded up to 1
  • -0.4 should be rounded up to 0
  • -0.6 should be rounded down to -1

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

More Books

Students also viewed these Databases questions