- TIE-0240x
- 4. Usable Programs: Unit Testing and Qt
- 4.4 Exercise (COMPULSORY): Repository-exercise on branches
Exercise (COMPULSORY): Repository-exercise on branches¶
Attention
Do the submissions in order if you want to avoid complications.
Exercise repository has a new directory GIT_EX that contains a python-script temperature.py
The script can be run using python3.6
Currently the script calculates falsely Celsius -> Fahrenheit transformation.
Input temperature: -2
-2.0 C = 30.8 F
Create a new branch temp_double_print.
Add functionality to the new branch that also calclulates Fahrenheit -> Celsius using the same (incorrect) formula in reverse.
Input temperature: 0
0.0 C = 32.0 F
0.0 F = -53.333333333333336 C
Input temperature: 32
32.0 C = 51.2 F
32.0 F = 0.0 C
Attention
If you accidentally altered master-branch version. Just do a new commit, where you have reverted to the old version of temperature.py. ( git checkout d4483927d05de2ef58dc89443e26c37b4504badc – temperature.py )
A+ presents the exercise submission form here.
After previous part you have decide to correct the mistake. Do the formula correction to both master and temp_double_print branches.
Hint:
Correct formula: TF = TC × 9/5 + 32
A+ presents the exercise submission form here.
New idea: The program should ask which transformation is done instead of doing both. Create a new branch direction_query where the transformation is queried. (See example below)
Select transform direction (CF) or (FC): CF
Input temperature: 23
23.0 C = 73.4 F
Select transform direction (CF) or (FC): FC
Input temperature: 73.4
73.4 F = 23.0 C
A+ presents the exercise submission form here.