207k views
5 votes
The variable baggageWeight is the weight of an item. Complete the function CheckWeight(baggageWeight, maximumWeight) to return a logical value that indicates true wherever baggageWeight is above maximumWeight.

For example: If baggageWeight = 28 and maximumWeight = 50, then overweightBaggage = CheckWeight(baggageWeight, maximumWeight) will return overweightBaggage = false

User Kiyo
by
7.5k points

1 Answer

5 votes

Final answer:

The question pertains to creating a function that returns true if baggageWeight is greater than maximumWeight, otherwise false. An example function was provided using a conditional statement comparing the two weights, suitable for integration into a program.

Step-by-step explanation:

The student is asking about how to complete a function in a programming context that returns a logical value. The function, CheckWeight(baggageWeight, maximumWeight), is supposed to compare two values: the weight of an item and the maximum allowed weight. The function should return true if baggageWeight is above maximumWeight, otherwise it should return false.

To accomplish this, you would write a function in your chosen programming language that includes a conditional statement to check if baggageWeight > maximumWeight. If this condition is met, the function should return true; if not, it should return false. Here's an example of what the function might look like in pseudo-code:

function CheckWeight(baggageWeight, maximumWeight) {
if (baggageWeight > maximumWeight) {
return true;
}
else {
return false;
}
}

Testing the function with a baggageWeight of 28 and a maximumWeight of 50 would return false, as the baggage is within the weight limit.

User Anndrew
by
7.8k points