In this activity, you will revisit the Paint program from Module Six. Your original program calculated the amount of paint needed, but depending on the width and height, that value could be a long decimal. Your program will better suit the needs of the user if it can calculate the number of cans needed as an integer value. For example, given that 1 gallon = 1 can of paint, we might expect the Paint program from Module Six to output:
Paint needed: 2.142857142857143 gallons
Cans needed: 3.0 can(s)
Consult the official Java documentation for the Math class. https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html
Scroll to the Method Summary section of the Math class and review the methods and their descriptions. Look for a method that will help you.
If a method looks promising, click on its name to see a more detailed description. Pay special attention to the argument(s) and the data type of the return value.
Based on your review, select one or more methods from the Math class to use in your solution.
When using a method from the Math class, use the syntax Math.methodname() when you implement the method. For example, if you decided to use the absolute value method, you would write something like: Math.abs().

Respuesta :

Use the Math.ceil() method, which returns the smallest (closest to negative infinity) double or long value that is greater than or equal to the argument and is equal to a mathematical integer.

Example of Math.ceil()  :

This would round the number of gallons of paint needed up to the nearest integer, so that the number of cans of paint needed can be accurately calculated.

For example, if the Paint program from Module Six output 2.142857142857143 gallons, I would use:

double gallons = 2.142857142857143;

double cans = Math.ceil(gallons);

System.out.println("Paint needed: " + gallons + " gallons");

System.out.println("Cans needed: " + cans + " can(s)");

This would output:

Paint needed: 2.142857142857143 gallons

Cans needed: 3.0 can(s)

To know more about Math.ceil()
https://brainly.com/question/13041380
#SPJ4

ACCESS MORE