Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The programming language is C++ Given the following programming need Joe's Pizza Palace needs a program to determine the number of pizzas one needs to

The programming language is C++

image text in transcribed

image text in transcribedimage text in transcribed

Given the following programming need Joe's Pizza Palace needs a program to determine the number of pizzas one needs to buy for a party if each person attending is expected to eat an average of four slices. The program should ask the user for the number of people who will be at the party and for the diameter of the pizzas to be ordered. It should then calculate and display the number of pizzas to purchase To calculate the number of pizzas, one must know the number of slices that may be taken from the pizza. To calculate the number of slices you must know the following facts Each slice should have an area of 14.125 inches To calculate the number of slices, simply divide the area of the pizza by 14.125 The area of the pizza is calculated with this formula where (r for radius is of diameter) Write a program with the specifications and instructions given below Follow the guidelines given in the Program Documentation document for all user-defined identifiers (variables, named constants and functions) and other aspects of programming form and style 1. Use named constants for ALL identifiers whose values will not change during program execution. (There are three of them.) These may be defined globally, above main, so that they may be accessed by the functions which require them for calculations. Note: These values will be changed during grading 2. 3. Define integer data types for ALL input and ALL output variables Only two values will be input in this order-people, diameter. This is explained in more detail below but you will calculate the output number of slices per pizza and the number of pizzas to order as whole numbers (integers) but display them with one decimal place of precision so that the whole value is obvious. Do the math calculations manually before coding Make the program iterative allowing the user to input multiple sets of data, terminating when the user enters the sentinel value -1 for the number of people to feed at the party. The main function will need a counter variable which increments with each order placed 4. 5. Code a generic value returning function to calculate and return the area of the pizza as a type double The function should have one int input parameter for the diameter. Use the pow function when calculating area. Because area must be calculated as a floating point double data type you must either perform Type Casting or use literal values of type double in the calculation of area NOTE: Generic - meaning that function could be used to calculate the area of any circle given an integer parameter for its diameter. Do not use the word "pizza in the code or documentation. This function can be placed in a reusable library for use in other programs 6. Write a value returning function to calculate and return the number of slices per pizza as a type int. The function should have one double input parameter for the area. Calculate the number of slices using double floating point values but before returning, downcast the calculated value to a whole number (an int) so that there will be no fractions of a pizza remaining. You must use type casting to remove any warning message:s Given the following programming need Joe's Pizza Palace needs a program to determine the number of pizzas one needs to buy for a party if each person attending is expected to eat an average of four slices. The program should ask the user for the number of people who will be at the party and for the diameter of the pizzas to be ordered. It should then calculate and display the number of pizzas to purchase To calculate the number of pizzas, one must know the number of slices that may be taken from the pizza. To calculate the number of slices you must know the following facts Each slice should have an area of 14.125 inches To calculate the number of slices, simply divide the area of the pizza by 14.125 The area of the pizza is calculated with this formula where (r for radius is of diameter) Write a program with the specifications and instructions given below Follow the guidelines given in the Program Documentation document for all user-defined identifiers (variables, named constants and functions) and other aspects of programming form and style 1. Use named constants for ALL identifiers whose values will not change during program execution. (There are three of them.) These may be defined globally, above main, so that they may be accessed by the functions which require them for calculations. Note: These values will be changed during grading 2. 3. Define integer data types for ALL input and ALL output variables Only two values will be input in this order-people, diameter. This is explained in more detail below but you will calculate the output number of slices per pizza and the number of pizzas to order as whole numbers (integers) but display them with one decimal place of precision so that the whole value is obvious. Do the math calculations manually before coding Make the program iterative allowing the user to input multiple sets of data, terminating when the user enters the sentinel value -1 for the number of people to feed at the party. The main function will need a counter variable which increments with each order placed 4. 5. Code a generic value returning function to calculate and return the area of the pizza as a type double The function should have one int input parameter for the diameter. Use the pow function when calculating area. Because area must be calculated as a floating point double data type you must either perform Type Casting or use literal values of type double in the calculation of area NOTE: Generic - meaning that function could be used to calculate the area of any circle given an integer parameter for its diameter. Do not use the word "pizza in the code or documentation. This function can be placed in a reusable library for use in other programs 6. Write a value returning function to calculate and return the number of slices per pizza as a type int. The function should have one double input parameter for the area. Calculate the number of slices using double floating point values but before returning, downcast the calculated value to a whole number (an int) so that there will be no fractions of a pizza remaining. You must use type casting to remove any warning message:s

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago