代写Programming with Python
UNIVERSITY OF CANBERRA
INTRODUCTION TO INFORMATION TECHNOLOGY (4478/8936)
ASSIGNMENT 3: Programming with Python
1 | P a g e
Instructions
This assignment will test your knowledge and skills in writing an application software for a task,
understanding the business rules of a particular problem, coding these in a computer program,
developing a graphical user interface, and reading data from a text file from a disk. As such, the
assignment requires you to integrate and synthesise what you have learnt so far in this unit, in order
to design and create a proper working solution.
Background:
The context of this programming assignment is free for you to choose. Think about any problem you
may be facing that is suitable to be tackled from an IT-programming perspective. I have chosen a case
study to show you how would you approach the problem from the very beginning, the compulsory
elements need to be included in your solution, and the final (and hopefully nice and useful) product.
This Assignment has three parts:
• Part 1: Use the problem-solving process to create a simple Python program using an
interactive text-based menu (no GUI)
• Part 2: The same as part 1, but wrapped in a graphical user interface (GUI)
• Part 3: The input comes from a text file – read only once, then information stored in a suitable
data structure.
An example case study is in page 2, it shows the integration of these three stages. Please bear in mind
that this is an example only. Your solution does not need to be exactly the same as this one. However,
be sure that you include every single element described at the end of each part. Allocated marks are
shown at the end of each part. Comments are shown in bold blue.
Submission
• This is a SOLO ASSIGNMENT.
• This assignment requires you to complete Python code written in .py modules, in addition to
supporting files.
• Create a folder called “uxxxxx_Assignment 3” and drop all your files in there (problem-solving
process answers, flowcharts, Word documents, and the like). Python modules are compulsory.
No modules, no marks.
• Compress (zip) ALL your files and folders created above in one single file called
uxxxxx_Assignment3.zip. Upload this file on Canvas by the due date using the drop box
provided in the corresponding module.
UNIVERSITY OF CANBERRA
INTRODUCTION TO INFORMATION TECHNOLOGY (4478/8936)
ASSIGNMENT 3: Programming with Python
2 | P a g e
The Example Case Study
Planetary Exploration App
Credits: NASA Solar System Exploration @solarsystem.nasa.gov
PART 1: Problem-solving process to create a simple Python program via the Shell.
I Background
Our astronauts are about to leave for a trip to outer space. They may be visiting the Moon, Mercury,
Venus, Mars or one of the larger moons of Jupiter (IO, Europa, Ganymede or Callisto). Each astronaut
has a mass allowance in kg for items that they can take along the trip, including tools and personal
items. The amount they are allowed depends on their job description as follows:
Flight Crew are allowed a total of 100kg, and Mission Specialists are allowed a total of 150kg.
Each of the solar system bodies (celestial bodies) has less gravity than the earth. For example, if a mass
of 100kg on earth weights 100kg, on the Moon will weigh the equivalent of 16.6kg.
II Business Rules
a) The Problem at Hand
We need to calculate how much mass each astronaut has left over for personal items, the total
available mass and the average available personal mass allowance across all six astronauts. We need
to also calculate the weight of the average available personal mass allowance on the celestial body
the astronauts are travelling to. We assume there are three crew astronauts and three mission
specialists. Be sure to clearly state your assumptions!!!
b) Describing Inputs and Outputs
We need a list that contains the names of the celestial bodies that our astronauts may travel to and
their Mass multipliers. This list must be stored using an appropriate data structure. Do not hard-code
this table. This list is part of our inputs.
UNIVERSITY OF CANBERRA
INTRODUCTION TO INFORMATION TECHNOLOGY (4478/8936)
ASSIGNMENT 3: Programming with Python
3 | P a g e
Celestial body Mass Multiplier
Mercury 0.378
Venus 0.907
Moon 0.166
Mars 0.377
Io 0.1835
Europa 0.1335
Ganymede 0.1448
Callisto 0.1264
Also, the user needs to decide which celestial body the astronauts are travelling to, alongside their
mass (Second set of inputs).
The code will display a list of celestial bodies that are possible destinations along with their mass
multipliers. Our code needs to also display the weight allowances for the two different types of
astronaut (All of these are our outputs).
III Develop a “Hand” Calculation
We will create (pure creation, that it is!!!) a flowchart to start with.
A flowchart consists of special symbols connected by arrows. Within each symbol is a phrase
presenting the activity at that step. The shape of the symbol indicates the type of operation that is to
occur. The arrows connecting the symbols, called flowlines, show the progression in which the steps
take place. Below is the ANSI standard for flowchart symbols (American National Standards Institute)1
:
1
“An Introduction to Programming Using Python”, Schneider, D.I. Pearson, 2016
UNIVERSITY OF CANBERRA
INTRODUCTION TO INFORMATION TECHNOLOGY (4478/8936)
ASSIGNMENT 3: Programming with Python
4 | P a g e
Once finishing with our flowchart, we’ll develop a “pseudocode”, which is an abbreviated version of
actual computer code (hence, pseudocode). The geometric symbols used in flowcharts are replaced
by English-like statements that outline the process. As a result, pseudocode looks more like computer
code than does a flowchart. Pseudocode allows the programmer to focus on the steps required to
solve the problem rather than on how to use the computer language.
Ok then; let’s start with the flowchart according to the problem at hand and input/output (I/O)
description:
UNIVERSITY OF CANBERRA
INTRODUCTION TO INFORMATION TECHNOLOGY (4478/8936)
ASSIGNMENT 3: Programming with Python
5 | P a g e
The above flowchart clearly shows the sequence of tasks that our program will be undertaking. We
now translate this flowchart into a pseudocode:
Program: Calculate Astronauts’ Mass Allowance
start
Print welcome message on the screen
Print (display) the menu on the screen
If [option A] then
print destination on the screen.
Else [option B]
print weight allowances.
Else [option C]
Input destination
input mass and personal items each crew member.
Calculate personal allowable mass for each crew member as:
Formula here [use functions for your calculations]
Print personal mass for each crew member.
Else [option D]
print weight allowances.
Input destination
input mass and personal items each crew member.
Calculate average allowable mass for crew members as:
Formula here [use functions for your calculations]
UNIVERSITY OF CANBERRA
INTRODUCTION TO INFORMATION TECHNOLOGY (4478/8936)
ASSIGNMENT 3: Programming with Python
6 | P a g e
Print average mass for crew members.
Print exit message
end
A running example will be shown during the lectures.
Hint: Developing a Command-Line menu.
Step-by-Step Guide for Stage 1 (using the case study as an example)
1. Think about your strategy on how you will display the options for user to choose from
according to your flowchart. How you will calculate the available personal item mass for each
astronaut and how to calculate the average available mass and average available weight.
Think about writing simple functions for the repetitive calculations.
2. Create a new Python file, you may call it ProgAsgStage1
3. In the Stage1 class (file ProgAsgStage1.py), you may put all code for the user interaction
and the calculation into the main method. (You might still need to define global variables and
constants outside the main method at the top of the editor window). You might like to use
nested lists to hold the name and mass multiplier of the celestial bodies.
4. You will need to write a function to print a menu to the user. One possible example is:
UNIVERSITY OF CANBERRA
INTRODUCTION TO INFORMATION TECHNOLOGY (4478/8936)
ASSIGNMENT 3: Programming with Python
7 | P a g e
5. Now add the code that implements your strategy to display the different destinations with
their mass multipliers, TEST.
6. Add the code to display the weight allowances for the two different types of astronaut, TEST.
7. Add the code to calculate the personal mass allowances of each of the six astronauts along
with the total available mass, TEST.
8. Add the code to calculate the average available mass allowance and weight on destination,
TEST.
9. Finally, add print statements to print the output to the user.
10. Test your implementation with the test cases mentioned below (and additionally your own).
For steps 7 & 8 work out your tests before you do any coding
Examples of Test cases:
Test 1
Destination Selected The Moon
Entered tool weights for crew 100, 100, 100
Entered tool weights for mission specialists 150, 150, 150
Available mass for astronauts: 0,0,0,0,0,0
Total Available Mass 0 kg
Average available mass: 0.0 kg
Average available weight on destination 0.0 kg
Test 2
Destination Selected Mars
Entered tool weights for crew 90, 90, 90
Entered tool weights for mission specialists 140, 140, 140
Available mass for astronauts: 10,10,10,10,10,10
Total Available Mass 60 kg
Average available weight 10 kg
Average available weight on destination 3.77 kg
UNIVERSITY OF CANBERRA
INTRODUCTION TO INFORMATION TECHNOLOGY (4478/8936)
ASSIGNMENT 3: Programming with Python
8 | P a g e
Test 3
Destination Selected Venus
Entered tool weights for crew 99, 98, 101
Entered tool weights for mission specialists 150, 149, 151
Available mass for astronauts: 1,2,-1,0,1,-1
Total Available Mass 2 kg
Average available mass: 0.333333 kg
Average available weight on destination 0.302333 kg
Marks allocated for Part 1: [Total Marks: 60]
I Background [MARKS: 3 marks for a suitable background about the context of your problem]
II Business Rules
a) The Problem at Hand [MARKS: 3 marks for a clear and specific description of the problem to
be solved]
b) Describing Inputs and Outputs [MARKS: 3 marks for a clear and specific description of inputs
and outputs]
III Develop a “Hand” Calculation [MARKS: 3 marks for an example of manual calculations, 5 marks
for the flowchart, and 3 marks for the pseudocode.]
III Menu deployment
• Constants vs literals. Using constants is important for the ease of maintenance. Not using
constants will result in lower marks. For example, in this case study we consider constants for
the mass multipliers for each celestial body and the upper limit for each type of astronaut. [3
marks]
• Good names for your variables and constants. Check style against the Python style guide
attached below. [3 marks]
• The program must have at least one mathematical calculation. [3 marks]
• You must use functions for each task in your code, for example a printMenu function to
print a menu and calculateAverageMass to calculate the average available mass. [3 marks]
• Your program must have a main() function to appropriately direct the program. [2 marks]
• Program code layout. Separate blocks of code by a blank line. [2 marks]
• Program is written using well-defined functions including a main() function to direct the
program. [4 marks]
• Use of comments. A comment is not an essay. Comments are important for the maintenance
of a program and should contain enough details but keep them concise. Do not comment
every single line. [2marks]
• The program must have a short introduction. Check style against the Python style guide
attached below. [3 marks]
UNIVERSITY OF CANBERRA
INTRODUCTION TO INFORMATION TECHNOLOGY (4478/8936)
ASSIGNMENT 3: Programming with Python
9 | P a g e
• The program must work correctly. That is:
o A text-based menu is displayed when first running your program. [5 marks]
o The menu works properly. [3 marks]
o Calculations are correctly performed. [3 marks]
o The output on the shell is properly formatted.
• Business rules are met. That is, your code solves the problem you are proposing (or at least
contributes to its solution). [4 marks]
Part 2. Developing a Graphical User Interface (GUI)
In Part 1, the user input and output was not very satisfactory from the human computer interaction
and usability point of view, your task in this part is to design and implement a Graphical User interface
(GUI) using buttons and labels that provides an easy to use interface.
Use the same code for the calculations from Part 1. Reusing code is an important part of software
development.
You have a great degree of freedom in what GUI elements you choose and how you would like to
design the layout of your GUI. What matters is the functionality of the design and that the user can
input the required data in a sensible fashion. However, some elements are compulsory, as we need to
assess your understanding of performing a suitable GUI.
Marks allocated for Part 2: [Total Marks: 30]
Your GUI application must allow a user to input various data elements. To this end, your GUI must:
• Use the Grid element [2 marks]
• Add Label elements throughout your GUI. [2 marks]
• Use the Background Colour property. [2 marks]
• Allow a user to select choices from an either list box, drop-down menu, or scroll-down menu
element. [2 marks]
UNIVERSITY OF CANBERRA
INTRODUCTION TO INFORMATION TECHNOLOGY (4478/8936)
ASSIGNMENT 3: Programming with Python
10 | P a g e
• Allow a user to input the data using an entry widget. [2 marks]
• Output data using an entry widget. [2 marks]
• Allow a user to click on a Calculate button that triggers any calculation. [2 marks]
• Allow a user to press an Exit or Quit button to properly close the program. [2 marks]
• GUI Design. Is it simple to use and easy to understand? [2 marks]
• Program is written using well-defined functions including a main() function to direct the
program. [2 marks]
• Program code layout. Separate blocks of code by a blank line. [2 marks]
• Separate GUI functionality from calculations. You should use a separate method for the
calculations. It is good practice and follows good programming style to separate GUI code
from other code. [2 marks]
• Use comments [2 marks]
• The program must have an introduction. Check style against the Python style guide attached
below. [2 marks]
• Business rules are met. That is, your code solves the problem you are proposing (or at least
contributes to its solution). [2 marks]
Part 3. Reading from an external file
Your task will be to add code to your Stage 2 program that reads an external .txt file (in our case study,
the astronaut tool weight data), put these into appropriate storage in memory (I suggest you use a
nested list) and display the details to user when requested. Please note that the text file needs to be
written by yourself according to your proposed problem. You can use any text editor such as Notepad
(do not use Word!!!) You should also use the advanced Python GUI components to create a graph to
show some of your calculations (compare the mass multipliers of the different destinations in our case
study)
During the lecture, I’ll go through the file astronaut.txt that contains the astronaut tool allowance
weights along with their destination. Each line consists of destination as the first element, followed by
a comma, that destination’s mass multiplier followed by comma and the weight of each astronaut’s
tools in kilograms (kgs).
Moon,0.166,92,93,90,135,140,143
Also, for our case study:
• Celestial body (destination) will be displayed to the user in ascending order of mass multiplier.
• The text file will be read once.
• We will write a function called readFile to read the data from the text file.
Marks allocated for stage 3: [Total Marks: 10]
• The test file is properly written according to the problem proposed [3.5 marks]
• The text file should only be read once. You probably want to do that at the start of the
program. Consider how you would do that. [3.5 marks]
• Correct display of data based on the details in the text file. [3 marks]
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- 戴盟机器人发布Sparky 1:人形机器人两大阵营已现,要能跑能跳还是要心灵手巧?
- TG/Telegram群发引流营销软件,电报如何采集隐藏用户/TG协议号
- 皓丽酒店智显屏全新上市!引领智慧酒店新形态
- 中国环保设备门户:引领绿色未来,共创美好家园
- ins群发营销软件,ins营销软件,协议操作自动发送日日爆粉
- 赛诺威盛:大孔径专科化CT领航者
- ins批量群发秘籍!Instagram 2024最新群发软件推荐,Ins引流轻松搞定!
- TG、WS、Zalo、line海外营销代筛料子功能工具的系統软件,乐乐解答
- 跨境商务的神秘行者:全球app云筛帮助你在不同文化中避免尴尬和误解
- 纸飞机群发拉群自动化软件,Telegram精准定位采集工具/TG营销神器
- 数字之光 WhatsApp拉群工具 助你的销售成绩如日中天
- 揭秘ins快速爆粉技巧!Instagram自动群发私信吸客利器,Ins新手必备!
- 成功之路指南 海外营销专家推荐WhatsApp拉群营销工具的创新优势
- 迈尔微视:为人形机器人视觉感知提供精准解决方案
- Ins批量筛选群发营销采集神器,Instagram营销工具,助你轻松营销!
- TikTok管理层重组,CEO周受资更多监督内容审核
- 超好用群发神器!Instagram自动采集博主粉丝,Ins营销必备工具
- ins拉群软件,ins群发软件,ins营销软件联系天宇爆粉【TG:@cjhshk199937】
- WhatsApp营销群发软件/ws协议号/ws频道号/ws拉群
- 时空商业的奇幻掌故:全球app云筛在全球用户沟通中的关键作用
- 跨境电商群发拉群智能数据解读:WhatsApp代筛料子引领您的数据分析之旅
- Instagram营销群发软件,Ins一键群发工具,助你实现快速推广!
- 华秋荣膺2023年度中国智能生产杰出应用奖,一站式数智化服务引领电子产业创新升级
- 代写EL1205编程、代做c/c++程序语言
- 专业品牌,专业推广! 跨境电商Telegram代拉群群发软件,塑造您品牌的推广专业形象
- 精准管理网络通信:Line协议号注册器助力工程师轻松分配标识
- 代写CS6114 Coding Video for Streaming
- 未来之商:2024年跨境电商WhatsApp筛选器拉群是否还是通往未知商机的时空门户
- 外贸小白晋级手册 WhatsApp拉群工具是我事业腾飞的不二之选
- instagram营销软件,ins群发拉群助手,爆粉营销欢迎测试联系
推荐
- 升级的脉脉,正在以招聘业务铺开商业化版图 长久以来,求职信息流不对称、单向的信息传递 科技
- B站更新决策机构名单:共有 29 名掌权管理者,包括陈睿、徐逸、李旎、樊欣等人 1 月 15 日消息,据界面新闻,B站上周发布内部 科技
- 全力打造中国“创业之都”名片,第十届中国创业者大会将在郑州召开 北京创业科创科技中心主办的第十届中国创业 科技
- 如何经营一家好企业,需要具备什么要素特点 我们大多数人刚开始创办一家企业都遇到经营 科技
- 丰田章男称未来依然需要内燃机 已经启动电动机新项目 尽管电动车在全球范围内持续崛起,但丰田章男 科技
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬 瘫痪十四年后,老杨第一次再度抓握住一瓶水,他 科技
- 创意驱动增长,Adobe护城河够深吗? Adobe通过其Creative Cloud订阅捆绑包具有 科技
- 智慧驱动 共创未来| 东芝硬盘创新数据存储技术 为期三天的第五届中国(昆明)南亚社会公共安 科技
- 苹果罕见大降价,华为的压力给到了? 1、苹果官网罕见大降价冲上热搜。原因是苹 科技
- 疫情期间 这个品牌实现了疯狂扩张 记得第一次喝瑞幸,还是2017年底去北京出差的 科技