2. Write a Java program that computes the size of a pizza and determines its price...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 (PI) 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 - (diameter) / 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. 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 (PI) 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 - (diameter) / 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.
Expert Answer:
Answer rating: 100% (QA)
java public class Pizza public static final double PI 314159265 public static void mainString args double diameter 12 inches double price 699 dollars ... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Let r and s be solutions to the quadratic equation x 2 b x + c = 0. For n N, define d0 = 0 d1 = r s dn = b dn1 c dn2 (n 2) Prove that dn = r n s n for all n N. [4 marks] (b) Recall that a commutative...
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
Consider the problem of minimizing (x, y) = x subject to g(x, y) = (x 1) 3 y 2 = 0. (a) Show, without using calculus, that the minimum occurs at P = (1, 0). (b) Show that the Lagrange condition P =...
-
Instead, the researchers reweigh the 300-pound individual and record a new weight of 350 pounds. Will the mean increase or decrease in this situation? A group of researchers measures the weight of...
-
Table 1.13 gives the net sales of The Gap, a clothing retailer. (a) Find the change in net sales between 2013 and 2015. (b) Find the average rate of change in net sales between 2011 and 2015. Give...
-
The Nielsen family formed their corporation, N. Robert Nielsen, Inc., to conduct farming operations. Morre, Grider & Co. is a certified public accounting firm that has provided accounting, tax, and...
-
Each of the following internal controls has been taken from a standard internal control questionnaire used by a CPA firm for assessing control risk in the payroll and personnel cycle. 1. Approval of...
-
Formulate your answer based on the information below. The intensity of care delivered dropped from a budgeted case mix of 0 . 9 0 to an actual case mix of 0 . 8 5 . What dollar effect did this have...
-
A truck is needed for five years. Two alternatives, A and B, are being considered. The interest rate is given as 12%. Based on the following data, which alternative will be more economical? Compare...
-
The demand for sausages is Q = 280 + 8P and the supply of sausages is Q = 12P + 20. A per-sausage tax of $2 is levied on vendors. Calculate the after-tax price paid by consumers and the after-tax...
-
Explain the multiplier effect as it pertains to the corona viruss impact on the economy.
-
What is the concept of the looking glass self, and to what extent do factors such as race, class, sex, or religion influence the formation and development of our self-identity?
-
How long is the arc subtended by an angle of radians on a circle of radius 10 cm? 0.2 cm 2n cm 36 cm 72 cm
-
In the futures market, if the futures price exceeds the spot price the market is said to exhibit contango .If the futures price is below the spot price, the market is said to exhibit backwardation ....
-
Gross Margin Return on Investment (GMROI) GMROI is the relationship between the average inventory at cost and gross margin. GMROI is used to analyze a retailers inventory and incorporate how fast...
-
In order to get an idea on current buying trends, a real estate agent collects data on 10 recent house sales in the area. Specifically, she notes the number of bedrooms in each house as follows: a....
-
What does the Java code Scanner keyboard = new Scanner(System.in); keyboard.useDelimiter("y"); System.out.println("Enter a string."); String a = keyboard.next(); String b = keyboard.next();...
-
Suppose we have a satellite in orbit. To communicate to the satellite, we can send messages composed of two signals: dot and dash. Dot takes 2 microseconds to send, and dash takes 3 microseconds to...
-
Add a method bubbleSort to the class ArraySorter, as given in Listing 7.10, that performs a bubble sort of an array. The bubble sort algorithm examines all adjacent pairs of elements in the array...
-
Modem databases require a high level of skill and knowledge to be adequately supported. See if you can interview the database administrators in three or four local organizations which nse...
-
What is at common misconception about databases?
-
CASE tools, such as system Architect, are used for database development and support. Search on the Web and in trade journals for some of the popular CASE tools currently in use. a. What CASE tools...
Study smarter with the SolutionInn App