62 513
Assignments Done
98,8%
Successfully Done
In June 2018

Answer to Question #53533 in Java | JSP | JSF for ejay

Question #53533
The manager of Pizza Palace wants a program that calculates and displays the number of slices of pizza into which a circular pizza can be divided. The manager will enter the radius of the entire pizza. For this problem, use 14.13 as the area of a pizza slice, and use 3.14 as the value of pi. Write a Java program to help the manager of Pizza Palace
Expert's answer
import java.util.Scanner;


public class Main {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);
double radius = in.nextDouble();
double sliceNumber = 3.14 * radius * radius / 14.13;
int answer = (int) sliceNumber;
if (sliceNumber > answer) {
System.out.println(++answer);
}
else {
System.out.println(answer);
}

}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions