Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Mysql Examples Explanations Explain Examples

Authors: Harry Baker ,Ray Yao

1st Edition

B0CQK9RN2J, 979-8872176237

More Books

Students also viewed these Databases questions