Using the Math.ceil method
I wrote this simple program for programming fundamentals and I was instructed to round up the results. I've been trying to use the Math.ceil method but I have not been able to corporate it into my program. Any tips?
// Program helps student determine how many pizza and soda should
// be purchased for student activities.
Code:
import java.util.Scanner;
public class PizzaSoda
{
public static void main(String[] args)
{
int People;
double Hours;
double Pizza = .4;
double Soda = .25;
double Result, Value;
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter the number of people expected to attend this activity: ");
People = keyboard.nextInt();
System.out.print("Enter the duration of the activity in hours: ");
Hours = keyboard.nextDouble();
System.out.println((Pizza * People) + " whole pizzas will be needed.");
System.out.println((Soda * People * Hours) / 2 + " 2-liter bottles of soda will be needed.");
System.exit(0);
}
}