Search this site
Embedded Files
Software Engineering
  • Home
  • Preliminary
    • Programming Fundamentals
      • Project 0 - Intro
        • Software Development Process
        • Waterfall Vs Agile
      • Project 1 - Mad Libs
        • Lab 1 - Hello World
        • Lab 2 - Hello, name
        • Lab 3 - Hello, full name
        • Lab 4 - Split String
      • Project 2 - Temperature Converter
        • Lab 1 - Numbers
        • Lab 2 - Number Operations
        • Lab 3 - Formatting Numbers
        • Lab 4 - Conditionals
      • Project 3 - Guessing Game
        • Lab 1 - While Loops
        • Lab 2 - For Loops
        • Lab 3 - Input Validation
        • Lab 4 - Random
      • Project 4 - Dice Roller
        • Lab 1 - Functions
        • Lab 2 - Parameters and Arguments
        • Lab 3 - Try / Except
      • Project 5 - To Do List
        • Lab 1 - Lists
        • Lab 2 - Advanced List Features
        • Lab 3 - Errors
      • Project 6 - Shopping List
        • Lab 1 - Dictionaries
        • Lab 2 - Lists and Dictionaries
        • Lab 3 - Data Dictionaries
      • Project 7 - Tic Tac Toe
        • Lab 1 - Intro to Connect Four
        • Lab 2 - IPO Diagram and Screen Design
        • Lab 3 - Structure Chart and Modular Design
        • Lab 4 - Starting Development & Basic Gameplay
        • Lab 5 - Core Game Mechanics
        • Lab 6 - Win and Draw Conditions
      • Project 8 - Contacts
    • Object Oriented Programming
      • Project 9 - Contacts (OOP)
        • Lab 1 - Paradigms
        • Lab 2 - Classes
        • Lab 3 - Methods
        • Lab 4 - Contacts Manager
      • Project 10 - Animal Kingdom
        • Lab 1 - Generalisation & Inheritance
        • Lab 2 - Polymorphism
        • Lab 3 - Zoo Management System
      • Project 11 - Shapes & Geometry
      • Project 12 - Inventory System
        • Lab 1 - Encapsulation Revisited
        • Lab 2 - The Facade Pattern
        • Lab 3 - User Interface
      • Project 13 - Banking System
      • Project 14 - Library System
        • Lab 1 - Basic Text IO
        • Lab 2 - Introduction to JSON
        • Lab 3 - Library System
      • Project 15 - D&D Character Creator
    • Programming Mechatronics
      • Intro to Mechatronics
        • Applications
        • Components
        • Microbit
      • Computer Architecture
        • Microcontrollers vs CPUs
        • Instruction Sets and Opcodes
        • Registers and Real-Time Systems
      • Sensors and Data
        • Sensor Basics
        • Compass
        • Thermostat
        • Mapping and Clamping
        • Night Light
        • Parking Sensors
      • Actuators and Mechanics
        • Actuator Basics
        • Actuator Selection
        • DC Motors
        • Servos
        • Grippers
        • Pick and Place
      • Control Systems
        • Intro to Control Systems
        • Bang-Bang Control
        • PID Control
        • Autonomous Control
      • Power, Electrical and Wiring
        • Power Requirements
        • Electrical and Wiring
  • HSC
    • Programming For The Web
      • Command Line Basics
      • HTML
        • Task 1 - Basic Page
        • Task 2 - Contact Form
        • HTML Quiz
      • CSS
        • Task 1 - Style Basic Page
        • Task 2 - Style Contact Form
        • CSS Quiz
      • Bootstrap
        • Task 1 - Basic Bootstrap Page
        • Task 2 - Bootstrap Contact Form
        • Bootstrap Quiz
      • Flask
        • Task 1 - Installation
        • Task 2 - Routes
        • Task 3 - Templates
        • Task 4 - Flask Contact Form
        • Flask Quiz
      • SQLite
        • Task 1 - SQL Basics
        • Task 2 - SQLite Basics
        • Task 3 - SQLite and Flask
        • Task 4 - Object-Relational Mapping
        • SQLite Quiz
      • The Internet
        • Data Transfer
        • Web Protocols
        • Dev Tools
        • Securing the Web
        • Big Data
        • Internet Quiz
      • PWA Assessment Task
        • Progressive Wep Apps
        • Project Setup and Planning
        • Backend Development with Flask
        • User Interface and Design
        • Application Features
        • PWA Features
    • Secure Software Architecture
      • Introduction
        • Unsecure PWA
        • Vulnerabilities
        • Cybersecurity Concepts
        • Case Studies
      • Benefits
        • Data Protection
        • Confidentiality, Integrity, Availability
        • Minimising Cyber Attacks and Vulnerabilities
        • Authentication, Authorisation, Accountability
      • Software Development Steps
      • Influence of End Users
      • Security Features Incorporated Into Software
      • Cryptography and Sandboxing
      • Testing and Evaluating Security and Resilience
        • SQL Injection
        • Cross Site Scripting
        • Broken Authentication
        • Cross Site Request Forgery
      • Design, Develop and Implement Secure Code
    • Software Automation
      • Introduction
      • Labs
        • Numpy
        • Matplotlib
        • Scikit - Linear Regression
        • Scikit - Logistic Regression
        • Scikit - KNN
        • Scikit - Polynomial Regression
      • Training Models
        • Supervised Learning
        • Unsupervised Learning
        • Semi-Supervised Learning
        • Reinforcement Learning
      • Applications of Key ML Algorithms
      • Decision Trees and Neural Networks
        • Decision Trees
        • Neural Networks
      • Machine Learning Algorithms
        • Linear Regression
        • Logistic Regression
        • K-Nearest Neighbour
      • Impact of Automation
    • Software Engineering Project
  • AI Tools
  • Software
  • Syllabus
  • Exam
Software Engineering

PROJECT 2
TEMPERATURE CONVERTER

Introduction

For Project 2, we'll be creating a temperature converter in Python.
You'll continue to learn more concepts in Python as well as reinforce some of the software development steps from the previous project.

What You Will Learn

By the end of this project, you will have gained valuable experience and foundational skills that will be useful for future projects:

  • Define and use the basic number types in Python

  • Perform basic operations and calculations using numbers

  • Learn how to format numbers for display

  • Use conditional statements to control the flow of execution

  • Using the software development process to create a project

These skills are essential for anyone starting in programming and will help you tackle more complex projects in the future.

1. Requirements Definition

Listen to Mary below, she has a program she wants you to build. If you're still not sure afterwards, you can chat with her using the chatbot below.
📖  Afterwards, write down three requirements into your workbook, in plain-English, that you think Mary wants you to include in the program.
An example of this might be: "The program should greet the user and explain that it is a Temperature Converter".

2. Determining Specifications:

Remember, specifications are a "blueprint" that describes how the Requirements will actually be implemented.
Here we are going to go into slightly more detail than the last project.


📖 In your workbook:

  • List the inputs and outputs of this program

  • Document the formulae to be used for calculations

  • Create an IPO Diagram for each pathway


Identifying Inputs and Outputs

This is slightly more complicated than last time, because this program can convert both ways.
One way you could define the inputs and outputs for a distance converter program:

Function: Centimetres to Inches Inputs: value (cm) Outputs: converted value (in)

Function: Inches to Centimetres Inputs: value (in) Outputs: converted value (cm)

Document the Formulae to be used for Calculations

Here you will need to find out the formulas used in each conversion. Here is how it might look for a distance converter:

Function: Centimetres to Inches Formula: in = cm / 2.54

Function: Inches to Centimetres Formula: cm = in * 2.54

IPO Diagrams

IPO (Input-Process-Output) Diagrams provide a visual representation of the flow of data in the program.

In future projects, you will skip straight to this step and identify the input, processing and output all at once. Here is how it might look for my distance converter program:

3. Design:

Design is your game plan. Before you start coding, you sketch out what steps your program needs to take and how it should flow.


📖 In your workbook, complete the screen design and flowchart activities.

Screen Design:

By completing this you can understand exactly how the program works from the user's perspective. Think about how the menu system and input/output will work.

------------ Distance Converter ------------


Select the conversion type:

1. Centimetres to Inches

2. Inches to Centimetres

Enter your choice (1/2): 1


Enter the distance in centimetres: 100


Conversion Result:

100.00 cm is equal to 39.37 inches

Flowchart:

Flowcharts provide a visual representation of the logic flow of the program, breaking it down into manageable pieces.

A reminder of the flowchart symbols:
Start/End: Rounded
Processes: Rectangles
Input/Output: Parallelograms
Decisions: Diamonds

4. Development:

Now comes the fun part: actually making your program. This is where you write the code.
There are four labs to complete in order to learn the concepts necessary to complete this project. Complete these first.

Lab 1 - Numbers

    • Learn how to define and use the basic number types in Python

    • Get set up on GitHub with Project 2

Lab 2 - Number Operations

    • Learn how to perform basic operations and calculations using numbers

Lab 3 - Formatting Numbers

    • Learn how to format numbers for display

Lab 4 - Conditionals

    • Learn how to use conditional statements to control the flow of execution.

Teacher's Requirements

Once again I have some further requirements for you to follow.

I have broken these down into two categories: less comfortable - for those of you that may be new to coding or currently find it challenging, and more comfortable - for those of you after a bit more challenge.


Less Comfortable:

  1. Select the conversion type using a menu system

  2. Perform the conversion accurately

  3. Round the final result to two decimal places

  4. Print out a message such as 33.00°C is equal to 91.40°F


More Comfortable

  1. Handle invalid inputs gracefully, preferably asking the user to try again

  2. Get rid of the menu system and allow the user to type in a temperature and unit.
    E.g. Type 33C and it will convert directly to 91.4F

  3. Loop to allow the user to perform another conversion

5. Testing and Debugging:

Testing:

This time we will be testing the project properly. This is crucial in determining the accuracy and reliability of the program.

Some different types of testing we can use on this project are:

  • Boundary values: Not as applicable, but we could use very large or very small values here

  • Path Coverage: Testing all pathways (choices) through the program

  • Faulty or Abnormal Data: To ensure the program can handle incorrect or unexpected input gracefully

📖 In your workbook, complete the testing table.

In the distance converter example I might produce a testing table something like this:

  • Both pathways are tested thoroughly by including a "Conversion Direction"

  • Values ranging from 0 to larger numbers are tested

  • Faulty and abnormal data are tested by including text and null values

6. Maintenance:

Sometimes programs are updated with more features or as bugs are found. In order to come back to a program we have previously worked on, or even work on someone elses code, we should ensure that our code is easily maintainable. For this project we can do this in two ways:

Meaningful Variable Names

Ensure you have used easy to read variable names that make sense.
E.g. Don't use 'n' when you could use 'name'.

Code Commenting

In addition to the above, it helps to explain what certain sections of code do and how they work with comments.
You don't need to comment every line either, be purposeful with your commenting.

Task

Go back through your program and ensure it is maintainable!

Hand-In + Quiz

Report abuse
Page details
Page updated
Report abuse