Concept explainers
a.
Boolean expression:
The Boolean expression evaluates the statement and returns either “True” or “False” with the help of “if” statement.
- The relational operator is used to form the Boolean expression that is tested by “if” statement.
- Some of the relational operators used in Boolean expression are “>”, “<” and “==”.
b.
Explanation of Solution
8 <= (2 + 6)
The given Boolean expression “8<=(2+6)” returns “true” because the expression ȁ...
c.
Explanation of Solution
5 == 15
The given Boolean expression “5==15” return...
d.
Explanation of Solution
3 >= 3
The given Boolean expression “3>=3...
e.
Explanation of Solution
3 * 3 == 2 * 4
The given Boolean expression “3*3==2*4” returns “false” because “3*3” return...
f.
Explanation of Solution
5 < 8 – 3
The given Boolean expression “5<8-3” returns “false” because...
g.
Explanation of Solution
7 != 7
The given Boolean expression “7!=7” returns “false”...
h.
Explanation of Solution
8 != (2 + 5)
The given Boolean expression “8!=(2+5)” returns true because the expression “...
i.
Explanation of Solution
10 – 20 == -10
The given Boolean expression “10-20==-10” returns “true” because the expres...
j.
Explanation of Solution
3 + 2 * 6 == 15
The given Boolean expression “3+2*6” returns “true” because the expression “2*6” returns &...
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Java Programming
- programming language c++arrow_forwardQ4/ Draw y1= sin(x);y2 = sin(2*x);y3 = sin(4*x);y4 = sin(8*x); the result must be in one figure Matlabarrow_forwardIn C++ (Algebra: solve 2 × 2 linear equations) You can use Cramer’s rule to solve the following 2 × 2 system of linear equation: ax + by = ecx + dy = fx = (ed - bf) / (ad - bc)y = (af - ec) / (ad - bc) Write a program that prompts the user to enter a, b, c, d, e and f and displays the result. If ad - bc is 0, report that “The equation has no solution”. Sample Run 1 Enter a, b, c, d, e, f: 9.0 4.0 3.0 -5.0 -6.0 -21.0 x is -2 and y is 3 Sample Run 2 Enter a, b, c, d, e, f: 1.0 2.0 2.0 4.0 4.0 5.0 The equation has no solutionarrow_forward
- An argument is expressed in English below. Sara is not excited. If Sara is not excited, then Sara will go to the party. Sara is sleepy. 4 : Sara will go to the party and Sara is sleepy. Variable names are assigned to each English phrase as follows: • q: Sara is excited •r: Sara will go to the party • : Sara is sleepy What is the form of the argument? Pick Pick v .: Pick 2 Check Nextarrow_forwardQuestion: For 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 endsPlease check work for A = B = C =arrow_forwardThe two roots of a quadratic equationax2 + bx + c = 0 can be obtained using the following formula:b2 - 4ac is called the discriminant of the quadratic equation. If it is positive, theequation has two real roots. If it is zero, the equation has one root. If it is negative,the equation has no real roots.Write a program that prompts the user to enter values for a, b, and c and displaysthe result based on the discriminant. If the discriminant is positive, display tworoots. If the discriminant is 0, display one root. Otherwise, display “The equationhas no real roots.”Note you can use Math.pow(x, 0.5) to compute √x. Here are some sampleruns: Enter a, b, c: 1.0 3 1 ↵EnterThe equation has two roots -0.381966 and -2.61803arrow_forward
- Matlab Write a statement that assigns windChill (C) with the wind chill given airTemp (T) and windSpeed (W).arrow_forward2- AB . AB =? 3- A + B + C+ 1 =? 4- A. B. C.D =?arrow_forwardC++ Programming Exercise: A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter: a. The total number of of units. b. The rent to occupy all the units. c. The increase in rent that results in a vacant unit. d. Amount to maintain a rented unit. The program then outputs the number of units to be rented to maximize the profit.arrow_forward
- For 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_forwardUsing C Language: Write a program that consists of 2 guessing game. The first game: It is a guessing game in which the computer picks a specific number from 1 to 10, then the user guesses the number chosen by the computer and has ten attempts, and in each attempt the chosen number by the computer changes. The second game: A guessing game. The computer also chooses a three-digit number, for example: 950 and you have ten attempts to predict the number chosen by the computer. For example, the user types 390, the computer will tell him that the first digit is wrong, the second digit is correct, but it is not in the correct location, and the last digit, which is 0, is correct. And the user makes repeated attempts to find the correct whole numberarrow_forwardThe correct statements are: For L = 0, L* = {e} For L = {e}, L* = {e} OL+ = LL* L* = LL+arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning