0% found this document useful (0 votes)
243 views

TDB4333STQA Assignments2

The document outlines 6 programming scenarios for a software testing assignment. Students must: 1) Develop code to solve each scenario and apply software testing techniques like flow charts and data/control flow graphs. 2) Calculate cyclomatic complexity and develop test cases for each scenario. 3) Submit reports and source code by the due date. Scenarios include programs to calculate sales commissions, find distinct numbers in an array, compute water bills, check for leap years, determine car registration fees based on weight and year, and calculate hospital charges.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
243 views

TDB4333STQA Assignments2

The document outlines 6 programming scenarios for a software testing assignment. Students must: 1) Develop code to solve each scenario and apply software testing techniques like flow charts and data/control flow graphs. 2) Calculate cyclomatic complexity and develop test cases for each scenario. 3) Submit reports and source code by the due date. Scenarios include programs to calculate sales commissions, find distinct numbers in an array, compute water bills, check for leap years, determine car registration fees based on weight and year, and calculate hospital charges.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

TDB4333Z STQA Assignment 2

Objective The main objective of this assignments is to apply the concept of


Software Testing techniques in software Development and
development the test Cases accordingly
Assignment Group assignment – based on your project group.
Mode

Deliverables All group must do all the programming Scenarios (1-6) as below. Below
are the tasks that all group need to complete :-

Task 1- Develop a success programming code for all programming


scenario. Run and Report the code
Task 2 – Apply the software testing techniques –
 Develop Flow Chart
 Develop Control Flow graph (Path Selection - statement,
branches and Predicate)
 Develop Data flow graph
 Apply the Black box testing techniques
Task 3- Calculate the cyclomatic complexity
Task 4- Develop Test Cases and Report
Task 5- Submit all the reports

Language Any programming Language

Submission mode Online / Via Ulearn

Important date Due Date : 29/11/2019 – week 13 ( before 3pm)


Task Programming Scenario
No
1 A company has 10 salespeople who are paid on a commission basis. The salespeople
receive $200 per week plus 9% of their gross sales for that week. For example, a
salesperson who grosses $5000 in sales in a week receives: $200 + 0.9 x $5000 =
$650. The program shall determine how many of the salespeople earned salaries in
each of the following ranges (assume that each salesperson’s salary is truncated to
an integer amount): $200 - $299, $300 - $399, $400 - $499, $500 - $599, $600 - $699,
$700 - $799, $800 - $899, $900 - $999, $1000 and over. Write program that uses
array(s) to solve the aforesaid problem.

2 Write program that reads in ten numbers and displays distinct numbers (i.e., if a
number appears multiple times, it is displayed only once). (Hint: Read a number and
store it in an array if it is new. If the number is already in the array, discard it. After
the input, the array contains the distinct numbers).

3 Indah Water Inc. wishes to compute the water bill for its clients. It levies 5 cents per
unit for the first 1000 units of water consumed, 7 cents per unit for the next 1000
units and 10 cents per unit if the number of units consumed exceeds 2000. Given the
names, addresses, old, and new meter readings, write a complete program to
compute and print the amount each customer owes to Indah Water Inc.

4. Leap Year: All years that are evenly divisible by 400 or are evenly divisible by four
and not evenly divisible 100 are leap years. For example, since 1600 is evenly divisible
by 400, the year 1600 was a leap year. Similarly, since 1988 is evenly divisible by four
but not 100, the year 1988 was also a leap year. Using this information, write a
program that accepts the year as user input, determines if the year is a leap year,
and displays an appropriate message that tells the user whether the entered year is
or is not a leap year.

5 Based on an automobile’s model year and weight, Jabatan Pengangkutan Jalan


(JPJ) determines the car’s weight class and registration fee using the following schedule:

Model Year Weight Weight Class Registration


Fee
1970 or earlier Less than 2700 lbs 1 RM 16.50
2700 to 3800 lbs 2 RM 25.50
More than 3800 3 RM 46.50
1971 to 1979 Less than 2700 lbs 4 RM 27.00
2700 to 3800 lbs 5 RM 30.50
More than 3800 6 RM 52.50
1980 or later Less than 3500 lbs 7 RM 19.50
3500 or more lbs 8 RM 52.50

Using this information, write a program that accepts the year and weight of an
automobile and determines and displays the weight class and registration fee
for the car.

6. Write a program that computes and displays the charges for a patient’s hospital stay.
First, the program should use a function named getPatientData to get patient’s
name, IC number and ask if the patient was admitted as an in-patient or an out-
patient. This function receives reference parameters (name and ic) and returns type
of admittance. This function will be called from the main function.
Then, depending on the type of admittance returned to the main function, if the
patient was an in-patient, the following data should be entered (in the main
function):

 The number of days spent in the hospital


 Hospital medication charges
 Charges for hospital services (lab test, etc)

Otherwise, the program should ask for the following data if the patient was an out-
patient:
 Charges for hospital services (lab test, etc.)
 Hospital medication charges

Then, the program will proceed with the calculation of the total charges for the
patient. The calculation should also be done in a function named
calculateInPatientCharges for in-patient or calculateOutPatientCharges for out-
patient. Both functions should return the calculated charges.

NOTE: Define the daily hospitalization rate as a constant (e.g., RM50 per day).
Input validation: Do not accept negative numbers for any data.

You might also like