The program is similar to assignment 1, but with added features. Ensure that your program has the
following features, as demonstrated in the sample output below:
• Instead of choosing basic or premium, the user will choose from various catering packages,
which are stored in memory and can be saved to and loaded from a text file called packages.txt.
• The user can add new packages to program memory. They will be prompted for the package
name, price per adult and price per child, which are all error-checked. Adding a package does
not save it to the packages file unless the user chooses to save.
• Saving replaces everything in the file with whatever packages are in memory.
• Loading a new file replaces any packages already in memory (whether added or loaded).
• For the catering calculations, the user enters the number of adults and children and then chooses
a catering package and a delivery option.
• There is a 1 in 10 random chance of getting adults at children’s prices no matter what catering
package is chosen.
• Error checking in this version is more comprehensive and your program should not crash for
any input. Integer and float inputs must be checked for valid numbers. Refer to the sample
output to see specific examples of limitations on the values for various inputs, e.g. the package
choice has to be a valid package number, and prices must not be <= 0.
• The package name must fit within 16 characters, and when packages are displayed, they should
line up in this width.
An example file (as used for the sample output below) is provided for you on LearnJCU and you must
use this format. Each line contains a package name, price for adults and price for children separated by
commas (no spaces) and a single new line character. You can assume that the packages.txt file exists
and its contents are valid, so you do not need to do any error checking for the file.
Part of the challenge (and assessment) for this assignment is for you to decide what programming
constructs to use to solve the problem. Here are some guidelines:
• Use functions appropriately to implement top-down design. Carefully think about the inputs and
outputs for functions and ensure that they are useful and reusable, as discussed in lectures.
• Start with one function for each menu option (except quit and instructions), plus use others as
appropriate. E.g. a function like getValidInt might be suitable and able to be used in
multiple situations. Don’t put user input or print statements inside functions unless that is what
the function is for. Think about reusability.
• Do not use global variables. Global CONSTANTS are appropriate, and you should use a
constant for the delivery costs and other suitable items.
• Include meaningful docstrings for all of your functions as according to the Python style guide:
o See: http://legacy.python.org/dev/peps/pep-0008/ and
• Use inline comments (start with # and put them on the line above the code they are referring to)
for anything that could benefit from some extra explanation (e.g. the random discount section).
• Use exceptions (try: except:) for error-checking numbers as shown in class.
• Close any files you open, at the appropriate spots in your program.
• Use a default parameter (packages.txt) for the filename. The user is not asked for it, but having
it as a default parameter to the functions rather than hard-coding it inside the functions means
you could extend the program to use different filenames without having to rewrite those
functions at all (this is an example of extensibility – thinking ahead).
• While most of the implementation details are up to you, in order to get full marks you need to
appropriately use a list of tuples for packages and a dictionary for delivery costs.
• Learn from the marks and feedback from your first assignment. Don’t repeat any mistakes.
Sample output from the program is below and forms part of the specification. You should make your
program match this exactly (except for your name and the date). Do not add or remove anything from
the program even if you think it would make it better. You must aim to have your program work and
look just like this including spacing and formatting.
Use the order calculator below and get started! Contact our live support team for any assistance or inquiry.[order_calculator]