Question
Part a) Complete the function ConvertToCentimeters() that takes one integer parameter as a length in inches. The function returns a double as the length converted
Part a)
Complete the function ConvertToCentimeters() that takes one integer parameter as a length in inches. The function returns a double as the length converted to centimeters, given that 1 inch = 2.54 centimeters.
Ex: If the input is 22, then the output is:
The number of centimeters is 55.88
#include
double ConvertToCentimeters(int numInches) {
/* Your code goes here */
}
int main() { int inches; cin >> inches;
cout << "The number of centimeters is "; cout << ConvertToCentimeters(inches) << endl; return 0; }
Part B)
Define a function CalculatePrice() that takes one integer parameter as the number of people attending a dinner, and returns the menu's price as an integer. The menu's price is returned as follows:
If the number of people is at least 400, menu price is $51.
If the number of people is at least 225 and less than 400, menu price is $56.
Otherwise, menu price is $65.
Ex: If the input is 405, then the output is:
51
#include
/* Your code goes here */
int main() { int numberOfGuests;
cin >> numberOfGuests;
cout << CalculatePrice(numberOfGuests) << endl; return 0; }
Step 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