a.
Explanation of Solution
Given: The expression, x + y < z + t.
To find: The value of the expression if x =-2, y = 5, z = 0, and t = -4.
Solution:
The expression is,
x + y < z + t
-2 + 5 < 0 + (-4)
3 < -4
0 (...
b.
Explanation of Solution
Given: The expression, x – 2 * y + y < z * 2 / 3.
To find: The value of the expression if x =-2, y = 5, z = 0, and t = -4.
Solution:
The given expression is,
x – 2 * y + y < z * 2 / 3
-2 – 2 * 5 + 5 < 0 * 2 / 3
-2 – 10 + 5 < 0 / 3
-2 – 10 + 5 < 0
- 12 + 5 < 0
-7 < 0
Substitute the values of x, y, z, and t in the given expression...
c.
Explanation of Solution
Given: The expression, 3 * y / 4 % 5 && y.
To find: The value of the expression if x =-2, y = 5, z = 0, and t = -4.
Solution:
The precedence of given operators, *, /, and %, is same, so it is computed from left to right.
3 * y / 4 % 5 && y
3 * 5 / 4 % 5 && 5
15 /4 % 5 &&...
d.
Explanation of Solution
Given: The expression, t || z < (y + 5) && y.
To find: The value of the expression if x =-2, y = 5, z = 0, and t = -4.
Solution:
The expression is,
t || z < (y + 5) && y
-4 || 0 < (5+ 5) && 5
-4 || 0 < 10 && 5
-4 || 0 < TRUE
TRUE || FALSE < TRUE
...
e.
Explanation of Solution
Given: The expression, !(4 + 5 * y >= z – 4) && (z – 2).
To find: The value of the expression if x =-2, y = 5, z = 0, and t = -4.
Solution:
The expression is,
!(4 + 5 * y >= z – 4) && (z – 2)
!(4 + 5 * 5 >= 0 – 4) && (0 – 2)
!( 4 + 25 >= 0 - 4) && -2
!( 29 >= - 4) && -2
...
Trending nowThis is a popular solution!
Chapter 5 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
- Evaluate the following expressions, assume the following declarations: int a=28; int b=4; int c=2; int z=0; z*=a/b-c; What is the value of z after expression is evaluated?arrow_forwardEvaluate the following expressions, assume the following declarations: int x = 4 /3 * 2; int y = 9/ 2; int num = 6; num *= x + y; What is the value of the num after expression is evaluated?arrow_forwardI need help with this I must use modular programming and declare variables. Write an application that computes a business's potential profits each year for 20 years using the //following assumptions: // 1 - Expenses in the first year are expected to be $35,000 //2 - Gross profit in the first year is projected to be $20,000 //3 - Net profit or loss is gross profit minus expenses //4 - Gross profits are expected to increase 10% each year //5 - Expenses are expected to increase 4% each year //Display the year, the gross profit, the expenses, and the net profit for each year.arrow_forward
- Given the following declarations, evaluate each of the following expressions and give the results. Declarations int I = 16; int a = 14; int b = 3; float c = 6.12; float num, price; double total, sum; Expression Result i = i/3; i = num = c/b*2-b%2; num = total = 12 – static_cast<float>(a)/b; total = price = a*3-static_cast<float>(a)/b; price = sum = static_cast<int>(c/b) + a%b – b/a; sum = please provide an explanation thank you!!arrow_forwardIn Python Text-based adventure game: Pretend you are creating a text-based adventure game. At different points in the game, you want the user to select to fight, run, or hide from certain enemies. The selection variable must be sent as an argument into the choice() function. The user should enter 1 to fight, 2 to run, or 3 to hide in the main(). The choice() function should print one of the three options. Add an if statement in the choice() function to make the correct selection.arrow_forwardint p = 200;int q = 100;if(p%2==0){q = q/50;}else{q = q/100;}q = ? What will be the final value of q . In C++arrow_forward
- 1a. It is known that x and n are integers, where x has a value of -1 and n has a value of 5. What is the valueof the following expression? !(++x || n) + 6 - (!n && n * (n < n)) I know this equals 6 but how do I work it out 1a .Compute the values of the following expressions if x is 1, y is 4 and z is 14. Assume thattrue relations have a value of 1 (I want to see how these problems are worked out) 1B. work out each of these. x+5<=z-(x||z)-y z/y%z-6<=!y x>=1&&y==3+y||z<14 x-!y-y<=z*z/6>yarrow_forwardFor the following code: for ( a = 1, b = 5, c = 3; a < 4; a++, b++ ) { c = a * b + c; } Indicate what values for the following variable will be when the code endsa=b=c=arrow_forwardFundamentals of Programming in C Language Write the value of each of the following expressions, using the following data declarations: double m = 17.5; int y = 9; 1. (m > 12.0) && (y / 2 <= 4) 2. (y % 3 != 0) 3. (m < 2 * y) 4. (2 == 3) || (m - 16 >= 0)arrow_forward
- Assuming X1,X2, Y1 are integer type variables, A,B,C are Bool type variables and Z as real type variable. Check the wrong statements Y1:=(X1 AND X2) +2; if A:=True Then B:=False; End_if; If Z>10 Then Y1:=X1 +4; End_if; C:=(A AND B ) +1; For Z:=1 to 10 Do Y1:=Y1 +1; End_For; While (AB) Do Y1:=Y1+1; End_While;arrow_forwardPython Code Needed Problem: A company wants a program that will calculate the weekly paycheck for an employee based on how many hours they worked. For this company, an employee earns $20 an hour for the first 40 hours that they work. The employee earns overtime, $30 an hour, for each hour they work above 40 hours. Example: If an employee works 60 hours in a week, they would earn $20/hr for the first 40 hours. Then they would earn $30/hr for the 20 hours they worked overtime. Therefore, they earned: ($20/hr * 40hrs) + ($30/hr * 20 hrs) = $800 + $600 = $1400 total. For this assignment, you must create pseudocode and a flowchart to design a program that will calculate an employee’s weekly paycheck. Write pseudocode to design a programming solution by outlining a series of steps and using appropriate indentation and keywords. As you write your pseudocode, be sure to consider the following: What input does the computer need? What steps does the program need to follow to process the input?…arrow_forwardQUESTION 8 Kebabo Internet Services offers customers with 600 weekday minutes for a flat rate of RM39.99. Night (8.00 P.M. to 7.00 A.M.) and weekend (Saturday to Sunday) minutes are free, but additional weekday minutes cost RMO.20 each. There are Service taxes (SST) of 6% on all charges. Write a program that prompts the user to enter the number of weekday minutes, night minutes, and weekend minutes used, and calculates the monthly bill and average cost of a minute before taxes. The program should display with labels all the input data, the pre-tax (amount before tax) bill and average minute cost, the SST cost and finally the total bill. Store all amount values as whole cents (rounding the taxes and average minute cost ie: RMS.54 and 253 minutes).arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning