Practical 3
Chapter 3: P r o c e s s i n g
Data
Submission guidelines:
• Keep the HCI principles in mind when designing your GUI.
• Make sure to use “save all” when you save your project.
• Make sure that you provide the name, number and your student
number for each program, e.g. Prac3 _Surname_12345678
• After completing all projects, combine ALL projects in the same
folder.
• Zip only the ONE folder before you submit the practical on eFundi.
Practical 3
Scenario: You are creating an application to help users estimate their travel costs and travel
time. The application will take inputs such as the distance to be travelled, the vehicle's fuel
efficiency, the current fuel price, and the travel speed. It will then calculate and display the
estimated fuel cost and travel time.
Instructions: Create a Windows form application (.NET Framework) called Prac3
_Surname_12345678.
Form Design:
• The main form of the application should display the necessary input fields and buttons
as shown in the output example provided.
Functionality:
1. Calculate button:
• In the event that the "Calculate" button is clicked, the application must:
• Retrieve the distance, fuel efficiency, fuel price, and speed as provided by the
user.
• Use the appropriate datatype for the variables.
• Calculate the fuel cost using the formula: fuelCost = (distance / fuelEfficiency) *
fuelPrice.
• Calculate the travel time using the formula: travelTime = distance / speed.
• Display the results in the output Label in the format: "The estimated fuel cost is
$X and the estimated travel time is Y hours".
o Where X is the fuelCost, displayed with the appropriate .ToString()
formatting.
o And Y is the travelTime, displayed with 2 decimal places, using the
appropriate .ToString() formatting.
2. Clear button:
• In the event that the "Clear" button is clicked, the application must clear all the
TextBoxes and the output Label.
3. Exit button:
• In the event that the "Exit" button is clicked, the application must close.
NB: Always remember that using comments is crucial, as is HCI compliance and the correct
use of naming conventions for controls.
Study the output example to see exactly what your output is expected to look like:
How to submit:
• Zip (compress) the assignment folder as per the instructions on eFundi.
• Submit the .zip as folder as per the instructions on eFundi.