Instructions Write a program to implement and test the algorithm that you designed for Exercise 15 of Chapter 1 . The instructions to Exercise 15 have been posted below for your convenience: Exercise...

1 answer below »


Instructions


Write a program to implement and test the algorithm that you designed forExercise 15ofChapter 1. The instructions toExercise 15have been posted below for your convenience:



Exercise 15



Given the radius, in inches, and price of a pizza, design an algorithm to find the price of the pizza per square inch.


You may assume that the value of π =3.141593.


In your program, declare a named constantPIto store this value.


Below is an example of how the completed program should work:


Enter the radius of the pizza: 20




Enter the price of the pizza: 22




The price per square inch is: 0.017507


Since your program handles currency, make sure to use a data type that can store decimals.


Answered Same DaySep 19, 2021

Answer To: Instructions Write a program to implement and test the algorithm that you designed for Exercise 15...

Arun Shankar answered on Sep 19 2021
134 Votes
#include
using namespace std;
int main()
{
const double PI = 3.1415;
double radi
us, area, price;
cout << "Enter the radius of the pizza: ";
cin >> radius;

area = PI * radius * radius;

cout << "Enter the price of the pizza: ";
cin >> price;
cout << "The...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here