Reference no: EM132381658
G-4478/8936 Introduction to Information Technology - Programming Assignment, University of Canberra, Australia
This assignment will test a student's knowledge of, and skills in writing application software for a task, understanding the business rules of a particular problem, coding these in a computer program, developing a graphical user interface, reading data from a text file on disk, and connecting to an SQL database from within the program. 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 correct working solution.
The context of this programming assignment is human Space Exploration (possibly inspired by the 50th anniversary of the moon landing!).
For this assignment, students will use the Python programming language (version 3.x) and development will be on the IDLE platform as practised in the computer lab classes. This assignment consists of four stages.
- Stage 1: A simple Python program using an interactive text based menu (no GUI)
- Stage 2: The same (stage 1) but wrapped in a GUI
- Stage 3: Input comes from a text file - read only once, then information stored in a suitable data structure. (Advanced GUI)
- Stage 4: Input comes from an SQL database file. Generates a Database Report.
Planetary Exploration App -
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 on the trip, including tools and personal items. The amount they're allowed depends on their job description.
Flight crew are allowed a total of 100kg; Mission specialists are allowed a total of 150kg.
Each of these solar system bodies (celestial bodies) has less gravity than the earth. For example, this means that a mass of 100kg on earth will weigh 100kg, but on the Moon, a mass of 100kg will weigh the equivalent of 16.6kg.
You will be calculating 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. You will also calculate the weight of the average available personal mass allowance on the celestial body the astronauts are travelling to.
Stage 1 -
You will need a list that contains the names of the celestial bodies that our astronauts may travel to and their Mass multipliers:
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
|
These details can be hardcoded in your program.
In Stage 1, you will be developing a Python program without a GUI. Input and output are via the Python shell. Write a Python program that displays a text based interactive menu to allow the users to:
- Display list of celestial bodies that are possible destinations along with their mass multipliers.
- Display the weight allowances for the two different types of astronaut.
- Calculate personal mass allowances along with the total mass available.
- Calculate the average available mass available for personal items.
Students may use a nested list to store the name of the celestial body and its mass multiplier. You can assume there are three crew astronauts and three mission specialists. You may wish to store the mass of their tools in a list as well.
Notes:
- You should use functions for each task in the program, for example a printMenu function to print a menu and calculcateAverageMass to calculate the average available mass etc.
- Your program should have a main() function to appropriately direct the program.
What the tutors will be looking for - The tutor's instructions include:
- Constants vs literals. Using constants is important for the ease of maintenance. Not using constants will result in lower marks. For example, consider constants for the mass multipliers for each celestial body and the upper limit for each type of astronaut.
- Program code layout. Separate blocks of code by a blank line. Use comments.
- Program is written using well-defined functions including a main() function to direct the program.
- 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.
- The program must have a prologue. Check style against the Python style guide attached below.
- Good names for your variables and constants. Check style against the Python style guide attached.
- Does the program work correctly?
Please refer to the Programming Assignment Marking Rubric for details on marks.
Stage 2 -
In stage1, the user input and output is not very satisfactory from the human computer interaction and usability point of view, your task in this stage is to design and implement a Graphical User interface (GUI) using buttons and labels for the Astronaut Allowance Calculator that provides an easy to use interface.
This GUI application must allow a user to input the various data elements. To this end, the user can
- input the data using an entry widget
- click on a Calculate button that starts the calculation of the available personal weight allowances, total and average values and
- an Exit or Quit button to properly close the program.
Use the same code for the calculations from Stage 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.
What the tutors will be looking for
The tutor's instructions include:
- Constants vs literals. Using constants is important for the ease of maintenance. Not using constants will result in lower marks. For example, in addition to Stage 1, consider constants for the default width and height of the labels, buttons and entry widgets to easily achieve a uniform look.
- GUI Design. Is it simple to use and easy to understand? Are all required components there? Grid layout is used to place widgets.
- Program is written using well-defined functions including a main() function to direct the program.
- Program code layout. Separate blocks of code by a blank line. Use comments.
- Separate GUI functionality from calculations. Students should use a separate method for the calculations. It is good practice and follows good programming style to separate GUI code from other code.
- A comment is not an essay. Comments are important for the maintenance of a program and should contain enough details but keep them concise. Don't comment every single line.
- The program must have a prologue. Check style against the Python style guide attached below.
- Good names for your variables and constants. Check style against the Python style guide attached below.
- Does the program work correctly?
Please refer to the Programming Assignment Marking Rubric for details on marks.
Stage 3 -
Complete the Stage 1 & Stage 2 plus: The program will determine the list of chook food at run time. Do this by reading this data from the file astronaut.txt and data will be stored in a nested list. austronaut.txt is available on IIT Canvas site.
The file astronaut.txt 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 kgs.
Moon, 0.166, 92, 93, 90, 135, 140, 143
You will need to copy astronaut.txt into the same directory as your Python files. When marking, the details in the file may change, but the structure will not.
Your task will be to add code to your program that reads the astronaut tool weight data from the text file, 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 text file contains more destinations than given in stage 1. The list of different destinations should be displayed to the user by using a listbox widget. You should also use the advanced Python GUI components to create a graph to compare the mass multipliers of the different destinations.
Notes:
- Celestial body (destination) should be displayed to the user in ascending order of mass multiplier.
- 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.
- Write a Function called readFile to read the data from the text file.
What the tutors will be looking for - The tutor's instructions include (apart from the usual such as good variable names, prologue / comments, code layout, ...)
- Use of constants. Think about where you could use constants here.
- 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.
- Program is written using well-defined functions including a main() function to direct the program.
- Correct display of mass multipliers based on the details in the text file.
- There are various ways you can store the data when reading the file. You could use a nested list.
Stage 4 -
Here, the input will now come from an SQL database contained in the MS Access file astronaut.mdb. This file is available on the IIT site on Canvas. There is only one table in the database tblAstronaut tblAstronaut contains fields Desination, MassMultiplier, CrewToolWeight1, CrewToolWeight2, CrewToolWeight3, MSToolWeight1, MSToolWeight2, MSToolWeight3. A typical record would be <Titan, 0.143, 80, 71, 93, 132, 145,150>.
Write a Python program using a GUI (Note: extending your GUI program from stage 3 is acceptable, but you could also write a separate Python file for Stage 4, either way is ok)
- Let the user select the name of a destination (e.g. from a list) and display the mass multiplier along with the astronauts' tool weights.
- Create a database report consisting of all destinations and the average available weight on each destination. You report should include Destination, Mass Multiplier, Total Available tool mass, average available tool mass and average available weight on destination. The report should be in ascending alphabetical order of Destination. It should be written to a file "database_report.txt".
Make sure that your columns are properly aligned. Text columns should be left aligned, number columns right aligned and rounded to 2 decimal places.
What the tutors will be looking for - The tutor's instructions include (apart from the usual such as good variable names, prologue / comments, code layout ...)
- Correct connection to the database.
- Correct identification of all the different destinations and their related data.
- Make sure that the lines in the database reports are split into pages and the columns are lined up and correctly formatted.
- Program is written using well-defined functions including a main() function to direct the program.
Note - Your programs should be Simple, Easy to read and understand, Well structured and Easy to maintain. Simple programs are just that. Avoid convoluted logic, nested if-statements and loops, duplicating execution (such as reading files multiple times), repeated code, being "clever". Programs can be made easier to read by following the "Layout" and "Comments" guidelines below. Well-structured code uses functions to help tame complexity. If programs are simple, easy to understand and well-structured they will be easy to maintain. Easily maintained programs will also use constants rather than literals and use built-in functions and types.
Attachment:- Information Technology - Programming Assignment File.rar