Skip to content

d. Applied Task

VCE Applied Computing - Student Task Sheet

Unit 1 Area of Study 2 - Testing, Debugging and Maintainability


Scenario

You are reviewing a small School Excursion Cost Calculator.

The module rules are:

  • the number of students must be between 1 and 30
  • the cost per student must be positive
  • the total cost should be calculated correctly

The current code is difficult to read and may contain an error.


Task 1 - Improve maintainability

(4 marks)

The code below needs improvement:

int x = 12;
double y = 15.00;
double z = x * y;
Console.WriteLine(z);

a. Rewrite the variable names so their purpose is clear.

b. Explain one reason why this change improves maintainability.


Task 2 - Add internal documentation

(4 marks)

Add:

  • one useful header comment
  • two useful internal comments

Avoid comments that simply repeat what the code obviously does.


Task 3 - Construct test data

(6 marks)

Create three test cases for the module.

Your set must include:

  • one valid case
  • one boundary case
  • one invalid case
Test case Number of students Cost per student Type of data
1
2
3

Task 4 - Testing and debugging reflection

(4 marks)

Explain:

  • how expected results and actual results help identify an error
  • one debugging technique you could use after a failed test
  • what you would look for while using that technique

Extension Discussion (2 marks optional)

Explain why a program can still be poor quality even if it produces the correct output once.