[SOLVED] COMP5710 Homework 6

25.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

 

Problem Descriptions:
You have just purchased a stereo system with price y with the following two credit plan choices: (1) down payment d < y/2, with interest rate r(%) per month of the remaining balance, and payoff in 12 months; and (2) down payment d >= y/2, with interest rate of r/2, and payoff in 6 months.
A function, cost calculates the total cost you pay for this stereo system. It takes in 3 parameters: (y, d, r) and returns the total payment as y + (y – d) * (r/100) * 12 when d < y/2 or y + (y – d) * (r/2/100) * 6 when d >= y/2 y: a positive float d: a positive float r: a positive float
Use functional equivalence partitioning approach to design test cases for this function.
You should have at least three levels of partition. You must show your partitioning tree. Generate one test case for each leaf node. Some invalid test cases must also be designed
Note each test case should look like:
((input_y, input_d, input_r), expected_output) For example:
((1000, 500, 5), 1075)
((1000,200,2), 1192)
((1500, -1.5, -5), exception)
((‘a’, ‘b’, ‘c’), exception)
…

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.