Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using C++ SAMPLE INPUT: SAMPLE OUTPUT: Lab 2a - Secure Coding An airplane will carry passengers and their luggage, as well as the maximum number
Using C++
Lab 2a - Secure Coding An airplane will carry passengers and their luggage, as well as the maximum number of cargo shipments they can carry on the same flight. The number of passengers they can carry is limited by the number of seats on the plane. The amount of cargo they can carry is limited by the maximum takeoff weight of the plane. Constant values for the program are given below, as well as expected input and output. First determine the number of passengers and use the average weight constant per passenger below to figure how much weight they will add to the base plane weight. Once the passenger list is settled, the program will allow entry of multiple cargo shipment weights as long as the combined weight of base plane weight, passengers and cargo already loaded is less than the maximum takeoff weight. Limitations: If you are using C++, do not use the standard library string class or data structures like vectors. Dynamically allocate any arrays needed. Lab objective: Use secure coding techniques in C or C++ to avoid buffer overflows, memory allocation issues, and integer overflows. Submission: C or C++ code file (.cpp or .c) that compiles. In part 2b of this lab, these submissions will be anonymized and tested by another student. Due: February 18, 2020, end of day Constants: average weight per passenger and their luggage maximum passenger seats base weight of airplane without passengers or cargo maximum takeoff weight 175 143 130000 pounds 175000 pounds Input: From the keyboard at the command line: airline name flight number alphanumeric alphanumeric From the keyboard while in the program: number of passengers cargo shipment weights integer integer (multiple values) Output: To the screen after number of passengers entered: original weight passenger weight added new weight integer integer integer To the screen after each cargo shipment weight entered: current shipment weight new weight integer integer To the screen at the end of the program: airline alphanumeric flight number alphanumeric number of passengers integer number of cargo shipments integer for each cargo: cargo weight integer total weight integer maximum weight integer SAMPLE INPUT:
SAMPLE OUTPUT:
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