PROBLEM SOLVING # 3 (GRADED): SOFTWARE VERIFICATION & VALIDATION
Instruction: This assignment consists of FOUR questions with total marks of 60. Answer all
questions. You may either do this assignment individually, or in pair.
Question 1
(15 marks)
You are assigned with a task to test an online car loan calculator application. The screen
snapshot for car loan calculator is presented in Figure 1 together with the system input
requirements. Analyse the figure to answer the following questions:
i.
ii.
List five (5) test conditions that needed to test the web application
(5 m)
Use the equivalence class partitioning technique to create test cases that relate to
the test conditions identify in (i).
(10 m)
Figure 1: Car Loan Calculator Form
Question 2
(10 marks)
Consider a module, called “ElecBill” which is part of Tenaga National Berhad (TNB) billing
application. The ElecBill module is to compute bill payment of electrical consumption for
different users. In order to promote saving, TNB charge a lower rate to users with lower
consumption as shown in Table 1.
User Type
[Jenis Pengguna]
Household
Office
First Rate
[Kadar Pertama]
0.10 for first 500 unit
Second Rate
[Kadar Kedua]
0.25 for the following
units
0.25 for first 1000 unit 0.50 for the following
units
Factory
0.50 for first 1500 unit 0.75 for the following
units
Table 1: Rate
Write test-cases for testing the functionality of this module by using equivalence partitioning
technique. Use data from boundary values analysis for each of your test case.
Question 3
(15 marks)
Based on Figure 2, answer the following questions:
#include <iostream>
Using Namespace std;
double total,hours;
int main()
{
cout << "Charges for the first 3 hours = RM2.00" << endl;
cout << "Additional charges for the next hours = RM1.50" << endl;
cout << "Maximum charges for any 24 hours = RM20.00" << endl;
cout << "\nPlease insert your hours = ";
cin >> hours;
if ((hours <=3) && (hours > 0))
cout << "\nYour total fee is RM2.00" << endl;
else
if ((hours>3) && (hours<=15))
{
total = 2.00+((hours-3)*1.50);
cout << "\nYour total fee is RM" << total << endl;
}
else
if (hours>15)
{
cout << "\nYour total fee is RM20.00" << endl;
}
else
cout << "\nError! Please insert a valid number of hours" <<
endl;
system(“PAUSE”);
return 0;
}
Figure 2
i.
Draw a Flow Graph for the procedure in Figure 2.
(5 marks)
ii.
Calculate the cyclomatic complexity of Figure 2 procedure.
(1 mark)
iii.
Identify and list down all independent paths based on your answer in (i) (4
marks)
iv.
Design a test case to force execution down each independent path. Use a table
when designing your test cases.
(5 marks)
Question 4
(20 marks)
Suppose a buy-online-ticket application for a theme park is selling tickets at prices as shown
in Table 2. The application will ask the a buyer for his/her age, and it will then identify the
required price for the ticket.
Table 2
Ticket Type
Price
1-Day Child Ticket
RM 80
(Age: 3-11)
1-Day Adult Ticket
RM 140
(Age:12-59)
1-Day Senior Ticket
RM 110
(Age: 60-75)
a) List all valid and invalid equivalence classes based on Table 2 (there should be 5
equivalence classes identified)
(5 marks)
b) Design test case using the equivalence class you have identified in (a) by filling in the
data in Table 3.
(5 marks)
Table 3
Equivalence Class #
Age
Expected Output
1
2
3
4
5
Study the codes in Figure 2, and then answer questions c) and d):
...
int driver_age, total_risk=1;
char car_type;
cout << “Enter your age AND car type: ”;
cin >> driver_age >> car_type;
if (driver_age>=20 && driver_age<=25)
total_risk = total_risk + 10;
if (car_type == 'X')
{
if (driver_age<25)
total_risk = total_risk + 8;
else
total_risk = total_risk + 6;
}
else if (car_type == 'C')
total_risk = total_risk + 4;
cout << “Your total risk is ” << total_risk;
...
Figure 3
c) Draw a flow graph diagram for the codes given in Figure 3.
(5 marks)
d) What is the cyclomatic complexity of the flow graph in question c)? List only THREE (3)
independent path based on the flow graph.
(5 marks)
© Copyright 2026 Paperzz