Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that will compare cost per square inch of two different diameters of Pizza and prints which pizza the user should buy Problem:
Write a program that will compare cost per square inch of two different diameters of Pizza and prints which pizza the user should buy
Problem: Write a program that will compare cost per square inch of two different diameters of Pizza and prints which pizza the user should buy. Our aim is to make the user buy cheaper pizza. Sample Output: Enter diameter of Dominoes pizza (inches) 10 Enter cost of Dominoes pizza: 15.65 Enter diameter of Pizza Hut pizza (inches)10 Enter cost of Pizza Hut pizza: 18.54 Buy Dominoes Pizza for $15.65!! Enter diameter of Dominoes pizza (inches) : 10 Enter cost of Dominoes pizza: 15.65 Enter diameter of Pizza Hut pizza (inches) 10 Enter cost of Pizza Hut pizza: 15.65 Buy Any Pizza for $15.65!! How to submit your program: Instructions: .Add Comments wherever required. Your program should take integer values for diameter variable and double values for cost. You should use only one function to calculate the cost of pizza. Your function must have function declaration. [You must define your function after main0] The function should return cost per square inch value to variables in main function, then you should compare both the costs to check which one is cheaper. For calculating cost per square inch, you have to convert diameter to radius and perform area of circle. Then you have to divide price by area to get cost per square inch of that pizza. Print it in the same format as sample outputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started