(Repetition structure, while loop)
You are to write a program in C++ that will perform several conversions. The program should display a menu that will have the following options:
1. Convert Kilobytes to Megabytes.
2. Convert Megabytes to Gigabytes.
3. Convert Gigabyte to Terabytes.
4. Quit.
The program should receive the amount to convert to a specific unit and return the result of that conversion. The program should run several times until the user decides to quit it. Make sure that the program is well indented, free of bugs and logical errors.
Structures - 14 points
Appropriate variable names/data types - 8 points
Input/Output Statements/Menu - 12 points
Calculations - 8 points
Comments - 8 point
(Repetition structure, while loop)
You are to write a program in C++ that will perform several conversions. The program should display a menu that will have the following options:
1. Convert Kilobytes to Megabytes.
2. Convert Megabytes to Gigabytes.
3. Convert Gigabyte to Terabytes.
4. Quit.
The program should receive the amount to convert to a specific unit and return the result of that conversion. The program should run several times until the user decides to quit it. Make sure that the program is well indented, free of bugs and logical errors.
Structures - 14 points
Appropriate variable names/data types - 8 points
Input/Output Statements/Menu - 12 points
Calculations - 8 points
Comments - 8 point
A customer in a store is purchasing five items. Design a pseudo code argorithm that asks for the price of each item, and then displays the subtotal of the sale, the amount of sales tax, and the total. Assume sales tax is 6%
Some algorithms used in Artificial Intelligence can be differentiated as white-box and black-box machine learning algorithms. The former are those algorithms that provide results that are understandable for experts in the domain whereas the latter can hardly be understood even by domain experts.
Requirement: Read the relevant literature and suggest how the present black-box machine learning algorithms can be made transparent, interpretable and explainable.
A customer in a store is purchasing five items. Design a program that asks for the price of each item, and then displays the subtotal of the sale, the amount of sales tax, and the total. Assume sales tax is 6%
Draw a flowchart that will asks for the amount purchased by the customer. If the customer purchases more than 2,000 then 5%discount is given, Display net amount to be paid by the custom
Consider now the function f(x) = x^4-2x^3− 12x^2 + 16x − 4 which has four distinct roots.
Question 10
Choose the appropriate option:
(1) The secant method and Muller’s method are similar in the sense that they both start with two
points.
(2) The regula falsi and the secant methods are the same and convergence for the regula falsi is
guaranteed because the next approximation is bracketed.
(3) Muller’s method determines the next approximation by considering the intersection of a parabola
and the x-axis through three given points.
(4) Statements (2) and (3) are correct.
(5) none of the above statements
Consider now the function f(x) = x^4−2x^3 − 12x^2 + 16x − 4 which has four distinct roots.
Question 8
Which of the following options is FALSE?
(1) f'(x) has a local minimum at 2.
(2) f'(x) has a local maximum at −1.
(3) f(x) has no singularities and no obvious symmetries and the y-intercept is −4.
(4) f"(x) has a local maximum at x = 0.5.
(5) the two zeros of f"(x) are −1 and 2.
Question 9
Which of the following results is FALSE when applying the various methods as indicated:
(1) p = 0.88338140 when applying the secant method with starting points p0 = 0 and p1 = 1.
(2) p = 0.34170924 when applying the bisection method with the starting points p0 = 0 and p1 = 1.
(3) p = 0.34170924 when applying Newton’s method with starting point p0 = 0.
(4) p = 0.88338140 when applying Muller’s method with starting points p2 = 0, p0 = 1 and p1 = 5.
(5) p = 4.04823531 when applying the regula falsi method with starting points p0 = 1 and p1 = 5.
(For Questions 6 to 7 )
Consider the nonlinear equation sin x − e
−x = 0, which has a roots in the intervals [0, 1], [3, 4] and
[6, 7].
Question 7
Consider again the nonlinear equation sin x − e
−x = 0. Applying the regula falsi method, with
starting point p0 = 3 and p1 = 4 and a tolerance of 10−5 yields the following result :
(1) 0.589117 after at least three iterations
(2) 0.588641 after at most three iteration
(3) The method does not converge to a solution.
(4) 3.096308 after exactly three iterations
(5) None of the above is true.
Consider now the function f(x) = x
4 − 2x
3 − 12x
2 + 16x − 4 which has four distinct roots.
(For Questions 6 to 7 )
Consider the nonlinear equation sin x − e
−x = 0, which has a roots in the intervals [0, 1], [3, 4] and
[6, 7].
Question 6
Which of the following is FALSE.
(1) The fixed-point formula g(x) = x + sin x − e
−x converges to the approximate solution p =
3.09636393 if the initial approximation is p0 = 1.
(2) Newton’s method with p0 = 0.5 will converge to the approximate solution p = 0.588532744
after at most three iterations.
(3) The regula falsi method converges to p = 0.5885328664 if p0 = 0, p1 = 1 after ten iterations.
(4) Newton’s method with p0 = 1 will converge to the approximate solution p = 0.588532743982
after exactly 4 iterations
(5) The fixed-point method does not converge if p0 = 0.5.