Question

Small aircraft weight limit Write an if-else statement that assigns safetyCheck with 1 if the sum of passengerWeight and carg

Code to call your function C Reset 1 CargoLimit(200, 100) · Run Function Submit Assessment: Check if CargoLimit(200, 100) ret

0 0
Add a comment Improve this question Transcribed image text
Answer #1
function safetyCheck = CargoLimit(passengerWeight, cargoWeight)
    maxWeight = 500;
    if passengerWeight + cargoWeight <= maxWeight
        safetyCheck = 1;
    else
        safetyCheck = 0;
    end
end

CargoLimit(200, 100) CargoLimit(300, 275) CargoLimit(400, 100) ans = 1 ans = 0 ans = 1
Add a comment
Know the answer?
Add Answer to:
Small aircraft weight limit Write an if-else statement that assigns safetyCheck with 1 if the sum...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a for loop that assigns summed Value with the sum of all odd values from...

    Write a for loop that assigns summed Value with the sum of all odd values from 1 to user Num. Assume userNum is always greater than or equal to 1. Ex: If userNum is 5, then summed Value is 9 (i.e. 1+3+5 =9). Function Save C Reset MATLAB Documentation 1 function summedValue - Oddssum(userNum) summedValue = 0; % Write a for loop that assigns summedValue with the % sum of all odd values from 1 to user Num 7 end...

  • Question Five c++ Decision Structures and Boolean Logic 1. Write an if statement that assigns 20...

    Question Five c++ Decision Structures and Boolean Logic 1. Write an if statement that assigns 20 to the variable y and assigns 40 to the variable z if the variable x is greater than 100. 2. Write an if statement that assigns 0 to the variable b and assigns 1 to the variable c if the variable a is less than 10. 3. Write an if-else statement that assigns 0 to the variable b if the variable a is less...

  • C++ Assignment Write a program that calculates the total weight of one vehidle and one cargo...

    C++ Assignment Write a program that calculates the total weight of one vehidle and one cargo vehicle. For both vehicles, the user will give the base weight of the vehicle, the passenger capacity of the vehicle, and ONLY FOR the cargo vehicle, the cargo weight capacity all as integers. Then, the user will give passenger information for BOTH vehicles as first the number of passengers and weights of each passenger (e.g., 2 60 80 means two passengers of weight 60...

  • EXERCISES: if & if...else STATEMENTS: Name Examples of if and if-else statements: Write an if statement...

    EXERCISES: if & if...else STATEMENTS: Name Examples of if and if-else statements: Write an if statement that multiplies payRate by 1.5 iſ hours is greater than 40. Write variable declarations for the variables payRate and hours first. Hint: Look for keyword if first, your boolean comes after the keyword [. This translates into Java as: double hours, payRate; if (hours > 40) { //{-} are optional here but I recommend that you them payRate = payRate 1.5; pay Rato pay...

  • CIS 22B Lab 3 Itty Bitty Airfreight (IBA) Topics: Friend functions Copy constructor ----------------------------------------------------------------------------------------------------------------------------------------- Lab 3.1...

    CIS 22B Lab 3 Itty Bitty Airfreight (IBA) Topics: Friend functions Copy constructor ----------------------------------------------------------------------------------------------------------------------------------------- Lab 3.1 Utilizing Lab 2.2 code Create your objects in the stack (not on the heap). Add a friend function, kilotopound, which will convert kilograms to pounds. Change your weight mutator to ask whether weight is input in kilograms or pounds. If it is kilograms, call the friend function kilotopound to convert it to pounds and return pounds.There are 2.2 pounds in one kilogram. Create an...

  • 1. Write a function called ordinal_sum that accepts a string argument and returns the sum of...

    1. Write a function called ordinal_sum that accepts a string argument and returns the sum of the ordinal values of each character in the string. The ordinal value of a character is its numeric Unicode code point in decimal. 2. Write code that creates a Python set containing each unique character in a string named my_string. For example, if the string is 'hello', the set would be {'h', 'e', 'l', 'o'} (in any order). Assign the set to a variable...

  • Urgent: Help with MatLab Program Create a Matlab function called seasonif. m which assigns to the...

    Urgent: Help with MatLab Program Create a Matlab function called seasonif. m which assigns to the numerical value of a month within the year a numerical value for the particular season in which that month occurs (see Table 2 above for numerical values to assign seasons). As usual, January is mouth 1, February is mouth 2, mid so on. Your function should allow decimal values (e.g. 4.68 should be considered part of April), but any value less than 1 or...

  • Lab 5.1 C++ Utilizing the code from Lab 4.2, replace your Cargo class with a new...

    Lab 5.1 C++ Utilizing the code from Lab 4.2, replace your Cargo class with a new base class. This will be the base for two classes created through inheritance. The Cargo class will need to have virtual functions in order to have them redefined in the child classes. You will be able to use many parts of the new Cargo class in the child classes since they will have the same arguments/parameters and the same functionality. Child class one will...

  • 1. Write a for loop that prints the sum of all positive even integers less than...

    1. Write a for loop that prints the sum of all positive even integers less than 200. Assume that variables i and sum are already declared. 2. Write a while loop that prints the sum of all positive odd integers less than 100. Assume that variables i and sum are already declared. 3. Write a do-while loop that prints the sum of all positive multiples of 3 less than or equal to 150. Assume that variables i and sum are...

  • write Java statements that perform the following functions ? 21 If x is greater than or...

    write Java statements that perform the following functions ? 21 If x is greater than or equal zero, then assign the square root of x to variable sqrtx and print out the result Otherwise, print out an error message about the argument of the square root function and set sqrtx to zero (2) 22 A variable fun is calculated by dividing variable numerator by variable denominator If the absolute value of denominator is less than 1, write "Divide by zero...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT