Write a program that can be used to compare the prices per square inch for two pizzas. For each pizza, the program prompts the user to enter the diameter (in inches) and the price. Then, the program should output which pizza is cheaper, or in the case that the prices per square inch are equal that the pizzas have the same price per square inch. Pizzas are assumed to have circular shapes.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question
100%
please do it in java programming
PROBLEM 2:
Write a program that can be used to compare the prices per square inch for two pizzas. For each
pizza, the program prompts the user to enter the diameter (in inches) and the price. Then, the
program should output which pizza is cheaper, or in the case that the prices per square inch are
equal that the pizzas have the same price per square inch. Pizzas are assumed to have circular
shapes.
The following is a sample output:
Enter the diameter of Pizza 1 in inches: 14
Enter the price of Pizza 1: 40
Enter the diameter of Pizza 2 in inches: 10
Enter the price of Pizza 2: 35
Pizza 1 is cheaper.
Transcribed Image Text:PROBLEM 2: Write a program that can be used to compare the prices per square inch for two pizzas. For each pizza, the program prompts the user to enter the diameter (in inches) and the price. Then, the program should output which pizza is cheaper, or in the case that the prices per square inch are equal that the pizzas have the same price per square inch. Pizzas are assumed to have circular shapes. The following is a sample output: Enter the diameter of Pizza 1 in inches: 14 Enter the price of Pizza 1: 40 Enter the diameter of Pizza 2 in inches: 10 Enter the price of Pizza 2: 35 Pizza 1 is cheaper.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage