Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3 (a) This program LaptopIns computes the cost of a Laptop insurance policy and outputs a value for the premium as denoted by p. It

3 (a) This program LaptopIns computes the cost of a Laptop insurance policy and outputs a value for the premium as denoted by p. It takes two inputs of integer age and Char OS (Operating System) type.

If the age entered is less than 16 or greater than 65 the program returns a premium of zero, i.e. p=0, as they are not allowed to be customers of this business.

The input for the Char OS takes the form of W for Windows, M for Macintosh, and L for Linux. If an incorrect value for the OS is entered, the program returns p=0.

In general, the insurance premium is 100, i.e. p=100.

However, if a person has a Windows laptop and whose age is between 16 and 25 then an extra 25 is added to the premium, p=125. If the person is aged between 40 and 60 (inclusive) and they have a Macintosh Laptop the premium falls by 10, p=90.

If the person is aged between 61 and 65 inclusive the premium falls by 5, p=95 no matter which operating system they own

image text in transcribed

Complete the Control Flow Graph (CFG) for the program laptopIns() using the source code provided. Label all the branches with the letters A to L

part (b):

For the program code given in section (a), derive the Test Coverage Items and Test Cases for the White Box Software testing method of Statement Testing. Create a table to show the tests and ensure to show the nodes covered by each set of test data.

part (c):

What Test Coverage Items and Test Data would you need to add to the test data to satisfy Branch Coverage?

Augment the table to satisfy the fault model of Branch Testing, also highlighting the Branches covered by the test data.

Code public int laptop Ins (int age, char Os) { int P OS!='L')) 000aWN Line No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 if ((age65) 11 (OS!='W' &&OS!="M' && p=; else { p=100; if ((age=40) && (age=61) && (age } return p} } Ps

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions