Concept explainers
What output will be produced by the following code, when embedded in a complete
int x = SOME_CONSTANT;
cout << “Start\n”;
if (x < 100)
cout << “First Output. \n”;
else if (x > 100)
cout << “Second Output. \n”;
else
cout << x << endl;
cout << “End\n”;
SOME_CONSTANT is a constant of type int. Assume that neither “First Output” nor “Second Output” is output. So, you know the value of x is output.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Problem Solving with C++, Student Value Edition plus MyProgrammingLab with Pearson eText -- Access Card Package (9th Edition)
Additional Engineering Textbook Solutions
Introduction to Programming Using Visual Basic (10th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Starting Out with Programming Logic and Design (4th Edition)
Starting Out with Python (4th Edition)
Java How To Program (Early Objects)
- What is the output? #include <stdio.h> int main(void) { double dividend = 0.0; double divisor = 0.0; printf("%lf\n", dividend / divisor); dividend = 3.0; printf("%lf\n", dividend / divisor); return 0; } Question 5 options: inf nan nan inf inf 0.0 nan 0.0arrow_forward4. A) What will be the value of x after the following code is executed? int x, y = 4, z = 6; x = (y++) * (++z); B) Suppose a = 1. What is the value of a after the following code executes? Show the procedure to reach your answer if(a > 0) { switch(a) { case 1: a = a + 3; case 3: a++; case 6: a = a * 2; break; case 8: a--; break; default a++; } else a = a + 2; C) What would be the value of x after the following statements were executed? int x = 10; switch (x) { case 10: x += 15; case 12: x -= 5; break; default: x *= 3; }arrow_forwarda) Consider the following code snippet. {:[" if (aNumber ">=0)xi],[" if (anumber "==0" ) "{]:} system.out.println ("first string") ; else {system.out.println ("sécond string"); 3system.out.println("third string") ; i. What output do you think the code will produce if "aNumber" is 3? [2 marks] ii. Write a test program containing the previous code snippet; make "aNumber" 3. What is the output of the program? Explain why the output is what it is i.e what is the control flow for the code snippet? [4 marks] iii. Using only braces, spaces and line breaks, reformat the oode snippet to make the control flow easier to understand. [3 marks] b) Consider the following class: iv. What are the class variables? [1 mark] Solve wh x=7arrow_forward
- If the user types "2" at the "dd?" prompt and "9" at the "xx?" prompt, then what would be the output of the following program?Please note that the operation x % 10 (i.e., x modulo 10) is always the same as the rightmost digit of x (e.g., 123 % 10 = 3). Question options: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 None of these optionsarrow_forward(1) Prompt the user for an automobile service. Output the user's input. (1 pt)Ex: Enter desired auto service: Oil change You entered: Oil change (2) Output the price of the requested service. (4 pts)Ex: Enter desired auto service: Oil change You entered: Oil change Cost of oil change: $35 The program should support the following services (all integers): Oil change -- $35 Tire rotation -- $19 Car wash -- $7 If the user enters a service that is not listed above, then output the following error message: Error: Requested service is not recognized Pythonarrow_forward(1) Prompt the user for an automobile service. Output the user's input. (1 pt)Ex: Enter desired auto service: Oil change You entered: Oil change (2) Output the price of the requested service. (4 pts)Ex: Enter desired auto service: Oil change You entered: Oil change Cost of oil change: $35 The program should support the following services (all integers): Oil change -- $35 Tire rotation -- $19 Car wash -- $7 If the user enters a service that is not listed above, then output the following error message: Error: Requested service is not recognizedarrow_forward
- In the given code, the values of installment1.dueDate and installment2.dueDateis getting printed same but I want a difference of 5 months in both the dates.Please debug my code so that it gives correct output. var installmentDate = new Date();const installment1 = { "dueDate": Date(installmentDate), "paid":false };console.log(installment1.dueDate);installmentDate.setMonth(installmentDate.getMonth() + 5);const installment2 = { "dueDate": Date(installmentDate), "paid":false };console.log(installment2.dueDate);arrow_forwardWrite a pseudo code that calculates the total point earned by a football team over a series of games and calculate the average of team. It allow the user to enter the series of game points, As soon as the user enters a negative value -1 to program, it should calculate the average test score and display it. Team A series 1 point: 10Team A series 2 point: 5Team A series 3 point: 8Team A series 4 point: 9Team A series 5 point: 12Team A series 6 point: -1Average of Team A =8.8arrow_forwardGiven the code below: type point real a, b end type type (point) v read*, v z=v%a/v%b print*, z end What is the equivalent code for the above statements? Question 6 options: none of the given code choices type point real a, b end type type (point), dimension(2):: v read*, v do i=1, 2 z=v(i)%a/v(i)%b end do print*, z end all the given code choices type point real a, b end type type (point), dimension(2):: v read*, v where (i>0) z=v(i)%a/v(i)%b end where print*, z end real va, vb read*, va, vb z=va/vb print*, z endarrow_forward
- In the code given below, the values of installment1.dueDate and installment2.dueDateis getting printed same but I want a difference of 5 months in both the dates.Please debug the code so that it gives correct output. var installmentDate = new Date();const installment1 = { "dueDate": Date(installmentDate), "paid":false };console.log(installment1.dueDate);installmentDate.setMonth(installmentDate.getMonth() + 5);const installment2 = { "dueDate": Date(installmentDate), "paid":false };console.log(installment2.dueDate);arrow_forward4.20 LAB: Warm up: Automobile service cost (1) Prompt the user for an automobile service. Output the user's input. (1 pt)Ex: Enter desired auto service: Oil change You entered: Oil change (2) Output the price of the requested service. (4 pts)Ex: Enter desired auto service: Oil change You entered: Oil change Cost of oil change: $35 The program should support the following services (all integers): Oil change -- $35 Tire rotation -- $19 Car wash -- $7 If the user enters a service that is not listed above, then output the following error message: Error: Requested service is not recognized 344614.2153518.qx3zqy7 Use Python for this please.arrow_forwardThe steelwork.py program, given below, creates three types of steel objects. Carbon steel (Steel) is made of carbon and iron, alloy steel (AlloySteel) contains chromium in addition to carbon and iron. Stainless steel (StainlessSteel) contains nickel and a higher proportion of chromium. Write the missing code, in the designated locations (#TODO), in order for the program execution to yield the following output: ['Steel01', 0.6, 91] ['ALSteel02', 0.6, 91, 1] ['SSteel02', 0.6, 91, 11, 2]arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,