3000COMP AS3 Specification

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Faculty of Engineering and Technology

Coursework Title:

Module Name:
Module Code:
Level:

Credit Rating:

Python Software Development Portfolio


Algorithms, Programming, and Computing
3000FND
3
20

Weighting:

50%
Maximum mark available: 100
Lecturer:
Contact:

Dr Brett Lempereur
If you have any issues with this coursework you may contact your lecturer.
Contact details are:
Email: b.lempereur@ljmu.ac.uk
Room: BS701 / BS707

Hand-out Date:

26/01/2016

Hand-in Date:
Hand-in Method:

25/04/2016
Blackboard Assignment Handler

Feedback Date:
16/05/2016
Feedback Method: eMail
Programmes:

FC Engineering and Technology


Introduction

This coursework is to be attempted individually.

You are required to apply fundamental computer programming and scripting concepts to
solve two computing problems.

You are also required to provide a justification of your decisions while solving these
computing problems, and to explain how you might introduce additional technologies to
improve these solutions.

Therefore, your portfolio must include the three tasks outlined in the rest of this document.

Learning Outcomes to be assessed



3. Demonstrate an understanding of the fundamental principles of computer programming,
and apply this knowledge to write simple procedural programmes using an interpreted
language such as Python.
4. Apply their knowledge of computer programming to implement a simple algorithm.

Detail of the tasks

The planet is dying, a combination of factors has led to soaring temperatures and sixty-
percent of the earths surface becoming uninhabitable. The only hope for humanity is to
flee to the stars, but only one ship was built before the temperature became too hot to
secure the resources required to continue construction.

Figure 1: Soylent Green (1973)


You are the programmer for this mission, and are required to write two programs that will
assist with the operation of the ship.

Task 1

The first problem is to decide who should be permitted to board the ship. You have been
tasked with writing a program that will apply a set of standard criteria to determine whether
people should be allowed on board.

Your program should read the following information from the user:

Name, a string;
Health, an integer between 0 and 100;
Intelligence, an integer between 0 and 100; and,
Economic output, an integer between 0 and 100.


With this information, you should apply the following rules:

1. If their intelligence is above 90 or their economic output is above 85, they must be
permitted to board the with a message indicating they meet the exceptional criteria.
2. If their health, intelligence, and economic output are all above 60, they must be
permitted to board the ship with a message congratulating them.
3. In all other cases, they should not be permitted to board the ship, and a message
must be displayed that apologises for this.

An example of the input and output to this program is shown in Appendix A.

Your solution to this problem must be a Python script that makes use of:

Variables
Input and Output
Conditional Statements

Task 2

Two years into the journey, stocks of food are running perilously low. The captain fears
riots if the situation is not handled appropriately. You have been tasked with writing a
program to help manage the inventory of food and to ensure that people on the ship are not
able to cheat and queue for food twice in one meal.

Your program should read in a dictionary that defines the type and quantity of food still
available on the ship, and a list of people and the type of food they can consume that are
queuing to be fed. This information will be read from two JSON files:

A JSON file, stock.json, that maps the name of food types to the number of that
food type still in stock on the ship; and,
A JSON file, queue.json, that lists the names of people on the ship and their food
preferences.

Examples of both of these files are included as Appendix C and Appendix D, they are also
available to download on Blackboard. Please remember that these are only examples, we
will evaluate your coursework with similar, but not identical, JSON inputs that include
different people and food types.

You should then fairly allocate the food between the people on the ship according to the
following rules:

1. If a person has not been fed and their food type is in stock:
a. Allocate one of that food type to the person and update the amount in stock.

b. Print a message to the screen indicating that the person has been fed their
food type.
2. If a person has not been fed and there is no remaining food that matches their
preference:
a. Print a message to the screen indicating that the person has not been fed
their food type.
3. If a person attempts to eat twice:
a. Print a message to the screen indicating that they have been sent to the brig.

After this process has been completed, display a summary of the remaining stock, those
people that have been sent to the brig, and those people that have been left unfed. Your
program must also write the updated stock dictionary back to the stock.json file,
overwriting its contents. An example of the output of this program is shown in Appendix B.

Your solution to this problem must be a Python script that makes use of:

Variables
File handling and JSON
Dictionaries, Lists, and Sets
Conditional Statements
Iteration and Loops

This program should not read any input directly from the user.

Task 3

Six months later, the captain of the ship is pleasantly surprised by your approach to
problem solving and contribution to the mission. In order to train more developers and
reduce your workload, or perhaps because there is no food left that meets your dietary
requirements, she would like you to start documenting your approach to problem solving
and ideas for improving the programs you have already produced.

Provide a short report based on your work in Task 1 and Task 2 from this portfolio, including:

1. A justification of your approach to solving the problems presented in Task 1 and
Task 2 (maximum 250 words); and,
2. A description of how you might use external hardware and access to the internet to
improve the programs developed in Task 1 and Task 2 (maximum 350 words).

These reports should be submitted as a Microsoft Word or Markdown document.

What you should hand in


Your portfolio must include:

Two properly formatted and commented Python scripts, one script that implements a
solution to Task 1, and one script that implements a solution to Task 2.

A short report as a Microsoft Word or Markdown document containing your justification
and description of potential improvements.

Instructions will be provided on how to use Blackboard Assignment Handling.

Marking Scheme/Assessment Criteria



Assessment Criteria
% Weighting
Task 1
Input and output
10%

Decision algorithm
20%
Task 2
File input and output
10%

Food assignment and stock management
20%

Brig handling
5%

Output
5%
Task 1 + 2 Style, formatting, and comments
10%
Task 3
Appropriate justification of design decisions in solutions to 10%
Task 1 and Task 2

Description of hardware and internet extensions to Task 1 10%
and Task 2

Recommended reading

The Python Standard Library (2.7): https://docs.python.org/2/library/
The Python Tutorial (2.7): https://docs.python.org/2/tutorial/
Learn Python the Hard Way: http://learnpythonthehardway.org/book/
PEP8 Style Guide for Python Code: https://www.python.org/dev/peps/pep-0008/
Extenuating Circumstances
If something serious happens that means that you will not be able to complete this assignment, you
need to contact the module leader as soon as possible. There are a number of things that can be
done to help, such as extensions, waivers and alternative assessments, but we can only arrange
this if you tell us. To ensure that the system is not abused, you will need to provide some evidence
of the problem.
More guidance is available at https://www.ljmu.ac.uk/about-us/public-information/student-
regulations/guidance-policy-and-process
Any coursework submitted late without the prior agreement of the module leader will
receive 0 marks.
Academic Misconduct
The University defines Academic Misconduct as any case of deliberate, premeditated cheating,
collusion, plagiarism or falsification of information, in an attempt to deceive and gain an unfair
advantage in assessment. This includes attempting to gain marks as part of a team without
making a contribution. The Faculty takes Academic Misconduct very seriously and any suspected

cases will be investigated through the Universitys standard policy (https://www.ljmu.ac.uk/about-


us/public-information/student-regulations/appeals-and-complaints). If you are found guilty, you
may be expelled from the University with no award.
It is your responsibility to ensure that you understand what constitutes Academic
Misconduct and to ensure that you do not break the rules. If you are unclear about what is
required, please ask.

For more information you are directed to following the University web pages:

Information regarding academic misconduct: https://www.ljmu.ac.uk/about-us/public-
information/student-regulations/appeals-and-complaints
Information on study skills:


https://www2.ljmu.ac.uk/studysupport/
Information regarding referencing:
https://www2.ljmu.ac.uk/studysupport/69049.htm

Appendix A: Example session for Task 1, with user input in bold
------------------------------Citizen Selector v1.0
------------------------------Enter your name: Sam Pellegrino
Enter your standardised health score: 50
Enter your standardised intelligence score: 30
Enter your standardised economic output score: 60
Sorry, Sam Pellegrino you have not been selected.
Appendix B: Example session for Task 2
Fed Max Bergevin with Kosher food.
Fed Donald Haar with Vegetarian food.
Fed Barry Hayes with Gluten Free food.
Fed Kenneth Fitzgerald with Halal food.
Fed Katherine Newton with Omnivorous food.
Fed Marguerite Kozlowski with Vegetarian food.
Fed Ronald Crawford with Kosher food.
Sent Donald Haar to the brig.
Fed Al Whittenberg with Omnivorous food.
Fed James Bruce with Omnivorous food.
Fed Deborah Garcia with Halal food.
Fed Carlos Doby with Halal food.
Remaining stock:
Kosher: 18
Gluten Free: 9
Vegetarian: 13
Omnivorous: 47
Halal: 47

There are 0 starving citizens.


Sent 1 citizens to the brig for trying to eat twice:
Donald Haar
Updated stock inventory.
Appendix C: Example queue.json file
[
["James Bruce", "Omnivorous"],
["Katherine Newton", "Omnivorous"],
["Deborah Garcia", "Halal"],
["Marguerite Kozlowski", "Vegetarian"],
["Kenneth Fitzgerald", "Halal"],
["Ronald Crawford", "Kosher"],
["Donald Haar", "Vegetarian"],
["Al Whittenberg", "Omnivorous"],
["Max Bergevin", "Kosher"],
["Carlos Doby", "Halal"],
["Barry Hayes", "Gluten Free"],
["Donald Haar", "Vegetarian"]
]
Appendix D: Example stock.json file
{
"Kosher": 20,
"Gluten Free": 10,
"Vegetarian": 15,
"Omnivorous": 50,
"Halal": 50
}

You might also like