0% found this document useful (0 votes)
18 views

CECS 328-Fall 2024-Programming Assignment 3

Uploaded by

mrg166
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

CECS 328-Fall 2024-Programming Assignment 3

Uploaded by

mrg166
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Programming Assignment 3

Cargo Airline
CECS 328 – Fall 2024

Due: Friday, November 1, at 11:59 pm

Points Possible: 10

Problem Statement:

You are a software engineer for a cargo airline company. You want to develop a program that, based on
the pool of possible cargo and weight capacity of the aircraft, you want to output the maximum revenue
that the aircraft can generate.

Call your function aircraft_max_revenue. Note that the function name is case sensitive and you will get
points deducted if your function name doesn’t exactly match the function name mentioned in this
document.

Inputs are the following:


• Pool of possible cargo – this is an array of tuples, containing the weight of each individual cargo
(first value of the tuple) and the price the cargo owner is willing to pay your company to
transport said cargo (second value of the tuple). Both values within the tuple will have a data
type of integer.
• Weight capacity of the airline – this is an integer. The max weight of cargo the aircraft is able to
transport.
Return data type must be an integer.
If no cargo can be taken, then your max revenue should be 0.
Constraints:

• 1 <= length of the cargo array <= 2,000


• 1 <= weight of each cargo <= 2,000
• 1 <= price of each cargo <=20,000
• 1 <= weight capacity of aircraft <= 20,000
• Your program must meet the following benchmarks, otherwise, the test case will be considered
a failure:
o If 1 <= weight capacity of aircraft <= 1,000, then your program must complete within 2
seconds.
o If 1,001 <= weight capacity of aircraft <= 5,000, then your program must complete
within 4 seconds.
o If 5,001 <= weight capacity of aircraft <= 10,000, then your program must complete
within 8 seconds.
o If 10,001 <= weight capacity of aircraft <= 15,000, then your program must complete
within 11 seconds.
o If 15,001 <= weight capacity of aircraft <= 20,000, then your program must complete
within 15 seconds.
• Your function name must be aircraft_max_revenue (all lower case and each word must be
separated by an underscore).

Submission Requirements:

Failure to follow any of the requirements in this document (items listed below or above) will result in
point deductions, up to and including receiving zero credit.

1. Write your name as a comment at the top of your code.


2. The filename of the code that you submit should be: cecs328pa3.py
3. Your program must be able to be executed via the Python command line (see the “Examples”
section below).
4. You can work with other students or individually, up to you. However, you must submit your
assignment individually on Canvas.
5. You must submit your file on Canvas. Any other submission method (such as email) will be
rejected and you will receive zero credit. As mentioned in the syllabus, only submissions on
Canvas will be accepted. If you forget to submit and your file is in some other location instead
(e.g. GitHub, BitBucket, Google Drive, OneDrive, etc.), I still will not accept it (no exceptions).
6. The programming assignment must be the same programming language and version as
mentioned in the syllabus.
7. Do not put your Python functions in a class (e.g. “class Solution:”). This will prevent our
testing script from executing on your program and you will end up getting a zero. You will get
zero credit if you do this.
8. Do not have any print statements in your code. If you do, your program will fail the test cases
and you will get points deducted, up to and including receiving zero credit on your assignment.
You can have print statements during your testing, but ensure you comment them out or delete
them prior to submission.
9. Canvas will automatically add a hyphen and a number to the file name if you upload the same
file more than once. That’s fine and don’t worry about it, I will not deduct points for that.
10. If any requirements are unclear or ambiguous, or if you have any questions, you would need to
reach out to the professor and/or TAs as soon as possible. Do not assume anything! It is your
responsibility to clear up any confusion and confirm any assumptions.

Examples:

Below are some examples for your reference. Note that your program will be graded against additional
test scenarios, not just based on the examples below.

The below are run from the Python command line (aka console). This is how your code will be graded.
Your program absolutely needs to be able to be run from the command line, otherwise you will get zero
credit.

Within the command prompt or Terminal, cd into the directory containing your cecs328pa3.py file.

Assuming you have installed Python, in your command prompt or terminal, type python or python3 and
press Enter to enter the Python console. The red text below is from the Python console. The black text
are my comments regarding the example above it.
>python

Python 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> from cecs328pa3 import *

>>> aircraft_max_revenue([(3,32),(5,22),(4,15)],8)

54

>>>
aircraft_max_revenue([(787,332),(1620,14624),(1204,11673),(147,15671),(423,18752),(1824,2418),(121
8,6800),(9,685),(1753,5432),(52,17628),(1031,9352),(2,11034),(1296,971),(961,1354),(602,11689)],1000
0)

125758

>>>
aircraft_max_revenue([(787,332),(1620,14624),(1204,11673),(147,15671),(423,18752),(1824,2418),(121
8,6800),(9,685),(1753,5432),(52,17628),(1031,9352),(2,11034),(1296,971),(961,1354),(602,11689)],5000
)

103284

>>>
aircraft_max_revenue([(787,332),(1620,14624),(1204,11673),(147,15671),(423,18752),(1824,2418),(121
8,6800),(9,685),(1753,5432),(52,17628),(1031,9352),(2,11034),(1296,971),(961,1354),(602,11689)],100)

29347

>>>
aircraft_max_revenue([(787,332),(1620,14624),(1204,11673),(147,15671),(423,18752),(1824,2418),(121
8,6800),(9,685),(1753,5432),(52,17628),(1031,9352),(2,11034),(1296,971),(961,1354),(602,11689)],10)

11034

>>>
aircraft_max_revenue([(787,332),(1620,14624),(1204,11673),(147,15671),(423,18752),(1824,2418),(121
8,6800),(9,685),(1753,5432),(52,17628),(1031,9352),(2,11034),(1296,971),(961,1354),(602,11689)],1)

What to Submit:

• You should submit just one file: cecs328pa3.py

Grading Guidelines:

• Does the program meet the requested requirements/criteria?


• Are the submission instructions followed?
• Does your code compile and execute?
• Does your code pass my test cases? I will not share my test cases with you. However, I have
provided examples, as mentioned above, so that you can test your code against.

You might also like