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
EBK JAVA PROGRAMMING
- Question Using Java programming language write a program to manage a hotel with 24 rooms;10 rooms are Executive, with price Gh ₵ 2500.00 per night,7 rooms are Chalets, with amounts Gh ₵ 1500.00 per night7 rooms are Ordinary, with amount Gh ₵ 500.00 per night The program should allow customers to book for rooms for a number of nights, and update the number of empty rooms available for each category when a customer has paid fully and has checked-in; also update the number of empty rooms available when customer checks-out.Customers should make bookings with their first names, telephone number A customer should be prompted to know if a room is booked (meaning a another customer has booked it but has not paid fully, or has not checked-in) A customer should be prompted to know if a room is occupied (meaning a booked room has been fully paid for, or the customer has checked-in) A customer should be prompted to know if a room is available (meaning a room has neither been booked nor…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_forwardAn 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_forward
- Q2/ Simplify the expressions using Boolean postulates: F=AB+(AC) '+ AB'C (AB+ C).arrow_forwardWrite an expression that obtains a random integer between 34 and 55. Write an expression that obtains a random integer between 0 and 999. Write an expression that obtains a random number between 5.5 and 55.5.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
- 2- AB . AB =? 3- A + B + C+ 1 =? 4- A. B. C.D =?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_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_forward
- Use C++ programming language A customer in a store is purchasing five items. The prices of the five items are:Price of item 1 = $15.95Price of item 2 = $24.95Price of item 3 = $6.95Price of item 4 = $12.95Price of item 5 = $3.95Write a program that holds the prices of the five items in five variables. Display each item’sprice, the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is7%.arrow_forwardWrite a statement that assigns finalValue with the multiplication of userNum1 and userNum2. Ex: If userNum1 is 6 and userNum2 is 2, finalValue is 12. let userNum1 = 6; // Code tested with values: 6 and 4let userNum2 = 2; // Code tested with values: 2 and -2 let finalValue = 0;arrow_forwardProvide statements with combined assignment operators for the statements below: x = x + 5; y = y * 3; z = z - 8;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