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 1.

 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 1. Declare a class named constant (Pl) for 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) 4. For finding the size of the pizza use the formula: size (x diameter) 4 5. For finding the price per square inch use the formula: zice...aiuch -price 6. Show the output in the following format: size The size of the pizza with a diameter of xx inches is xxx, square inches. The price per square inch for the same pizza is $X:xx Make changes to the program so that you take input using the Scanner class (instead of using the assignment operator) and send output using Sxstemsuturiat numbers should have two decimals. Floating-point

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!