Project
Formulation - practicum 11
It is the right time to start thinking about an individual project. The project is a program written by you. At first, come up with an idea for the project and submit it (as a text file or pdf) before practical session 11.
During practical session 11, we will discuss the ideas in the class.
The program itself has to be released by practical session 15.
Project requirements
- The idea should be original - you should come up with it by yourself.
- The workload is about 20h (trace the working hours on the project and submit it in a separate file together with the project).
- The topic (subject) of the project should be interesting to you.
- The solution (program) must contain at least two functions (def) written by you and you should invoke them in the program.
- The program must also contain at least two conditional statements (if), at least one of them must contain else and/or elif part.
- The program must read or write into a file.
- The program must contain at least one (nested) loop (for and/or while).
- The program must contain try-except block to make sure that the program does not crash.
- The program must have a simple graphical design.
- The program must contain a list, a dictionary or a tuple.
Try to come up with an idea which meets the requirements and does not sound very artificial. In a very special case, it is possible to substitute some requirements (with an approval of the instructor).
Before session 11, upload only the project formulation (a text file or pdf)! The formulation must contain a general idea and a purpose of the program. Also say some words about the functions, conditional statements and loops (where in the program will they be created and used).
Samples of project ideas
Here are some examples of the project (in complete absence of inspiration (which is unlikely), you can use them). These ideas contain only a description of the project; in the project formulation you also need to write where the functions, conditionals and loop(s) will be used. Be specific in the project formulation, e.g. how the program accesses the data - is it asked from the user, read from a file, etc.
- The purchase of an aquarium. A person wants to buy a new aquarium, but different factors disturb his/her decision-making. These factors are the load-bearing capacity of the floor, the full weight of the aquarium (weight of the aquarium itself and the weight of the water in the aquarium). The user is prompted for the floor thickness, length and width. The data of each aquarium (type, length, width, capacity, weight) are read from a file and the whole weight of the aquarium is calculated. Finally, the program compares the carrying capacity of 1m3 of floor and the weight of the aquarium. The user is shown a list of the appropriate aquariums.
- Food calculator for hikers. The hiker's calculator computes the total amount of food in kilograms for the whole hiking group and for the whole duration of the trip. To make the computation precisely, the calculator prompts the user for the number of people, the number of hiking days, and the number of meals during the trip. Also the calculator takes into account the meal size in grams per person.
- Healthy lifestyle. The program prompts the user for his gender, age, weight and height. Based on this data, the program calculates the body mass index (BMI), and outputs the "category" according to the BMI range. Then the program calculates the user’s daily calorie intake. Finally, the program asks the user a question about three important conditions for a healthy lifestyle.
- Calculation of fabric for a skirt. The user has to enter his hip circumference, the desired skirt length and the style (cloche or pencil). The program calculates the required length of the fabric (if the width of the fabric is 90cm, 140cm or 150cm).
- Grading system for teachers. The teacher enters the maximum number of points for some task and the boundaries (scaling ranges) of the grades (in percent). The program calculates the number of points for each grade. The teacher can then enter the student’s points and the program calculates the grade.
A sample of a complete project formulation
Birthday finding system
1. What should the program do?
The program asks the user for the filename and the number of a month. In the file, there are national identification numbers of colleagues - each number is in a separate line. The program goes through the file and looks for all the people whose birthdays are on or after the month that is given in the input. The program outputs the birthday and gender of the people in the format: Month date (Gender).
2. An example of the program execution
File example.txt
looks as follows:
47503272715 -3412lökö4 37502273715 37507122715
Program output:
Enter the name of a file: example.txt Enter the number of a month: 3 Birthdays on or after March: March 27 (Female) July 12 (Male)
3. What can be given as an input?
The program prompts the user for the file name and the number of a month.
4. What is the desired output?
The program outputs the birthday and gender of all the people whose birthday is on or after the given month.
5. Where to use functions?
- There will be a function which returns the name of the month according to the number of the month.
- There will be a function which returns the gender of a person according to his/her national identification number.
- There can be more functions if needed.
6. Where to use a loop (for/while)?
I will use the for loop to go through all the numbers in the file.
7. Where to use if-else?
- The gender identification function uses if-else to make sure if the person is a male or a female.
- Another if-else will be used to check if the people in the file have their birthday on or after the month specified in the input.
8. How to check if the user input is correct and what will happen if it is not?
- There will be a try-except block for opening the file; if the file does not exist, the program quits nicely.
- There will be a try-except block and if-sentences to make sure that the national identification numbers are correct.
- There will be a try-except block to make sure that the user enters a valid number of a month.