Question

Write a ceil method that takes a single double as
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the ceil method in java for you:

public static int ceil(double c)
{
int x = (int)c;   //Store the integral value of c in x.
if(x == c)       //If the integral part and the original number are equal.
return x;       //Don't increase the number.
else if(x < 0)   //If the Integral part is a negative number.
return x;       //Don't increase the number.
else           //If not, i.e., if it is a positive number.
return x+1;    //Increase the number by 1.
}

Add a comment
Know the answer?
Add Answer to:
Write a ceil method that takes a single double as an argument and returns an int....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT