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 using namespace std;

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 using namespace std;

/* 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!