2. Based on the below code answer the questions that follows: #include Using Namespace std; double...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
2. Based on the below code answer the questions that follows: #include <iostream> Using Namespace std; double total, hours; int main () { endl; } 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)) else { } else ( } else cout << "\nYour total fee is RM2.00" << endl; if ((hours>3) && (hours<=15)) total = 2.00+ ((hours-3) *1.50); cout << "\nYour total fee is RM" << total << endl; if (hours>15) cout <<"\nYour total fee is RM20.00" << endl; cout <<"\nError! Please insert a valid number of hours" << system("PAUSE"); return 0; a) Draw a Flow Graph for the above procedure. b) Calculate the cyclomatic complexity of Figure 1 procedure. c) Identify and list down all independent paths based on your answer in (a) d) Design a test case to force execution down each independent path. Use a table when designing your test cases. 2. Based on the below code answer the questions that follows: #include <iostream> Using Namespace std; double total, hours; int main () { endl; } 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)) else { } else ( } else cout << "\nYour total fee is RM2.00" << endl; if ((hours>3) && (hours<=15)) total = 2.00+ ((hours-3) *1.50); cout << "\nYour total fee is RM" << total << endl; if (hours>15) cout <<"\nYour total fee is RM20.00" << endl; cout <<"\nError! Please insert a valid number of hours" << system("PAUSE"); return 0; a) Draw a Flow Graph for the above procedure. b) Calculate the cyclomatic complexity of Figure 1 procedure. c) Identify and list down all independent paths based on your answer in (a) d) Design a test case to force execution down each independent path. Use a table when designing your test cases.
Expert Answer:
Answer rating: 100% (QA)
b Cyclotic Complexity VG en2 where e is the no of edges n is no of vertices Cyclotic ... View the full answer
Related Book For
Microsoft Visual C# An Introduction to Object-Oriented Programming
ISBN: 978-1337102100
7th edition
Authors: Joyce Farrell
Posted Date:
Students also viewed these programming questions
-
Consider the following supply and demand schedule for steel from Problem 1: Price per ton (S) Qd Qs . . . 20 320 20 40 300 60 60 280 100 80 100 120 260 240 220 140 180 220 140 160 180 200 180 160 260...
-
The following questions are adapted from a variety of sources including questions developed by the AICPA Board of Examiners and those used in the Kaplan CPA Review Course to study property, plant,...
-
Alderon Industries manufactures chemicals for various purposes. One process that Alderon uses produces SPL-3, a chemical used in swimming pools; PST-4, a chemical used in pesticides; and RJ-5, a...
-
Journalize the following December 31 transactions for College Park Printing Services. No explanations are required. a. Equipment cost $24,000 and is expected to be useful for 10 years, at which time...
-
CBS News reported that 4% of adult Americans have a food allergy (June 1, 2017, cbsnews.com /news/food-allergies-in-america-new-report -shellfish-peanut-dairy, retrieved March 25, 2018). Consider...
-
Transmissibility is the ratio of a. force transmitted and exciting force b. force applied and the resulting displacement c. input displacement and output displacement
-
Herbert, Inc., acquired all of Rambis Companys outstanding stock on January 1, 2014, for $574,000 in cash. Annual excess amortization of $12,000 results from this transaction. On the date of the...
-
Noura Company offers an annual bonus to employees (to be shared equally) if the company meets certain net income goals. Prepare the journal entry to record a $13,000 bonus owed (but not yet paid) to...
-
Western Digital, a developer of storage devices and solutions, has grown dramatically since it was established in 1970. Based in San Jose, California, they employ more than 61,000 with locations...
-
You are the project manager of your company's new expansion project in the Northern Cape province of South Africa. In week eight (8) you have the following project information available to you:...
-
Three point charges are located on the x-axis at the following positions: Q1 = 1.7 C is at x = 0 m, Q2 = 5.22 C is at x = 1.45, and Q3 = 7.13 C is at x = 4.16 m. What is the magnitude of the electric...
-
Two students each build a piece of scientific equipment that uses a 655-mm-long rod. One student uses a glass rod, the other a copper rod. If the temperature increases by 4.0C, how much more does the...
-
A proton accelerates from rest in a uniform electric field of 618 N/C. At some later time, its speed is 1.48 x 106 m/s. (a) Find the magnitude of the acceleration of the proton. 5.9103407e m/s (b)...
-
Beam ABCD has a pin support at A and roller support at C. It supports a distributed load W as shown. Determine the vertical reactions at A and C, given that a = 1.75 m and W = 20 kN/m. Neglect the...
-
a) Use the Product Rule to find the derivative of the given function. b) Find the derivative by multiplying the expressions first. y= (5x+3)x a) Use the Product Rule to find the derivative of the...
-
As head of Adita Inc., potential investors are asking questions about the companys dividend payment history. The investors are also curious how dividend payments differed for common and preferred...
-
Phosgene, COCl2, is a toxic gas used in the manufacture of urethane plastics. The gas dissociates at high temperature. At 400oC, the equilibrium constant Kc is 8.05 104. Find the percentage of...
-
All employees at Kranston Sports Inc. are paid based on an annual salary rather than an hourly wage. However, some employees are paid weekly, while others are paid every other week (biweekly)....
-
Create a program that allows the user to enter the gender (either F or M) and GPA (0.0 through 4.0) for any number of students. The program should calculate and display the average GPA for all...
-
Use the sales array to answer. The array was declared using the int sales[5] = {10000, 12000, 900, 500, 20000}; statement. a. while (x
-
Describe the process of valuing the entrepreneurs ownership interest in a two-stage investment. Refer to Tables 13.10 and 13.13. Data from table 13.10 Data from table 13.13 Market potential...
-
Euro Exchange Rates. The exchange rate that we consider is the amount of euros that one can purchase for one U.S. dollar. We have \(T=699\) daily observations from the period April 1, 2005, through...
-
Evaluate the current yield curve level and structure using the following screens: a. YCRV or GC to access yield curves. b. FWCV to determine implied forward rates. c. USoo03M, USoo06M, USoo09M, and...
Study smarter with the SolutionInn App