Question: 2. Write a Java program that computes the size of a pizza and determines its price per square inch, given its diameter and price Declare

 2. Write a Java program that computes the size of a

2. Write a Java program that computes the size of a pizza and determines its price per square inch, given its diameter and price Declare a class named constant (PI) for O- 3.14159265. 2. Declare variables for diameter, price, size and price per square inch. Use the naming conventions discussed in class. 3. Initialize the diameter and price with some particular values (like 12 and 6.99) For finding the size of the pizza use the formula: size = (* diameter) / 4 4. 5. For finding the price per square inch use the formula: price sq inch - price / size 6. Show the output in the following format: The size of the pizza with a diameter of xx inches is xx.xx square inches The price per square inch for the same pizza is xx.xx 7. Test your program for different values of diameter and price

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!