Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
7th Edition
ISBN: 9780134802213
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 3.5, Problem 3.17CP
Assume the variables a = 2, b = 4, and c = 6. Circle the T or F for each of the following conditions to indicate whether it is true or false.
a == 4 || b > 2 | T F |
6 <= c && a > 3 | T F |
1 ! = b && c != 3 | T F |
a >= -1 || a <= b | T F |
!(a > 2) | T F |
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Q17: Given that A and B are real variables with values 1.5, and 2.5 respectively, and C is integer variable with value 3, evaluate the following: NOT (A < 0) AND (B/C <= 0).
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;
Assume that x is 3 and y is 5. Write the values of the following expressions:a. x == yb. x > y-3c. x <= y-2d. x == y or x > 2e. x !=6 and y > 10f. x > 0 and x < 100
Chapter 3 Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Ch. 3.1 - Write an if statement that assigns 0 to x when y...Ch. 3.1 - Write an if statement that multiplies payRate by...Ch. 3.1 - Write an if statement that assigns 0.2 to...Ch. 3.1 - Write an if statement that sets the variable fees...Ch. 3.1 - Write an if statement that assigns 20 to the...Ch. 3.1 - Write an if statement that assigns 0 to the...Ch. 3.1 - Write an if statement that displays Goodbye if the...Ch. 3.2 - Write an if-else statement that assigns 20 to the...Ch. 3.2 - Write an if-else statement that assigns 1 to x...Ch. 3.2 - Write an if-else statement that assigns 0.10 to...
Ch. 3.2 - Write an if-else statement that assigns 0 to the...Ch. 3.3 - Write nested if statements that perform the...Ch. 3.3 - Write code that tests the variable x to determine...Ch. 3.4 - What will the following program display? public...Ch. 3.4 - The following program is used in a bookstore to...Ch. 3.5 - Prob. 3.16CPCh. 3.5 - Assume the variables a = 2, b = 4, and c = 6....Ch. 3.5 - Write an if statement that displays the message...Ch. 3.5 - Write an if statement that displays the message...Ch. 3.6 - Assume the variable name references a String...Ch. 3.6 - Prob. 3.21CPCh. 3.6 - Prob. 3.22CPCh. 3.8 - Rewrite the following if-else statements as...Ch. 3.9 - Complete the following program skeleton by writing...Ch. 3.9 - Rewrite the following if-else-if statement as a...Ch. 3.9 - Explain why you cannot convert the following...Ch. 3.9 - What is wrong with the following switch statement?...Ch. 3.9 - What will the following code display? int funny =...Ch. 3.10 - Assume the following variable declaration exists...Ch. 3.10 - Assume the following variable declaration exists...Ch. 3.10 - Assume the following variable declaration exists...Ch. 3.10 - Prob. 3.32CPCh. 3.10 - Prob. 3.33CPCh. 3.10 - Assume the following declaration exists in a...Ch. 3 - The if statement is an example of a __________. a....Ch. 3 - This type of expression has a value of either true...Ch. 3 - , , and = = are __________. a. relational...Ch. 3 - , | |, and ! are __________. a. relational...Ch. 3 - Prob. 5MCCh. 3 - To create a block of statements, you enclose the...Ch. 3 - This is a boolean variable that signals when some...Ch. 3 - How does the character A compare to the character...Ch. 3 - This is an if statement that appears inside...Ch. 3 - Prob. 10MCCh. 3 - When determining whether a number is inside a...Ch. 3 - Prob. 12MCCh. 3 - The conditional operator takes this many operands....Ch. 3 - This section of a switch statement is branched to...Ch. 3 - You can use this method to display formatted...Ch. 3 - True or False: The = operator and the == operator...Ch. 3 - True or False: A conditionally executed statement...Ch. 3 - Prob. 18TFCh. 3 - True or False: When an if statement is nested in...Ch. 3 - True or False: When an if statement is nested in...Ch. 3 - True or False: The scope of a variable is limited...Ch. 3 - Find the errors in the following code: 1. //...Ch. 3 - Find the errors in the following code: 2. //...Ch. 3 - Find the errors in the following code: 3. //...Ch. 3 - Prob. 4FTECh. 3 - Find the errors in the following code: 5. The...Ch. 3 - Find the errors in the following code: 6. The...Ch. 3 - The following statement should determine whether...Ch. 3 - Find the errors in the following code: 8. The...Ch. 3 - Prob. 9FTECh. 3 - Prob. 10FTECh. 3 - Write an if statement that assigns 100 to x when y...Ch. 3 - Write an if-else statement that assigns 0 to x...Ch. 3 - Using the following chart, write an if-else-if...Ch. 3 - Write an if statement that sets the variable hours...Ch. 3 - Write nested if statements that perform the...Ch. 3 - Write an if statement that prints the message The...Ch. 3 - Write an if statement that prints the message The...Ch. 3 - Write an if statement that prints the message The...Ch. 3 - Write an if-else statement that displays the...Ch. 3 - Convert the following if-else-if statement into a...Ch. 3 - Match the conditional expression with the if-else...Ch. 3 - Prob. 12AWCh. 3 - Prob. 13AWCh. 3 - Prob. 14AWCh. 3 - Explain what is meant by the phrase conditionally...Ch. 3 - Explain why a misplaced semicolon can cause an if...Ch. 3 - Why is it good advice to indent all the statements...Ch. 3 - What happens when you compare two String objects...Ch. 3 - Explain the purpose of a flag variable. Of what...Ch. 3 - What risk does a programmer take when not placing...Ch. 3 - Briefly describe how the operator works.Ch. 3 - Briefly describe how the | | operator works.Ch. 3 - Why are the relational operators called...Ch. 3 - When does a constructor execute? What is its...Ch. 3 - Roman Numerals Write a program that prompts the...Ch. 3 - Magic Dates The date June 10, 1960, is special...Ch. 3 - Body Mass Index Write a program that calculates...Ch. 3 - Test Scores and Grade Write a program that has...Ch. 3 - Mass and Weight Scientists measure an objects mass...Ch. 3 - Time Calculator Write a program that asks the user...Ch. 3 - Sorted Names Write a program that asks the user to...Ch. 3 - Software Sales A software company sells a package...Ch. 3 - Shipping Charges The Fast Freight Shipping Company...Ch. 3 - Fat Gram Calculator Write a program that asks the...Ch. 3 - Running the Race Write a program that asks for the...Ch. 3 - The Speed of Sound The following table shows the...Ch. 3 - Mobile Service Provider A mobile phone service...Ch. 3 - Mobile Service Provider, Part 2 Modify the program...Ch. 3 - Bank Charges A bank charges a base fee of 10 per...Ch. 3 - Book Club Points Serendipity Booksellers has a...Ch. 3 - Wi-Fi Diagnostic Tree Figure 3-23 shows a...Ch. 3 - Restaurant Selector You have a group of friends...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Is left recursion a problem for LR parsers?
Concepts Of Programming Languages
Name Formatting Create an application that lets the user enter a persons name as a last name, comma, and first ...
Starting Out With Visual Basic (7th Edition)
A liter is 0.264179 gallons. Write a program that will read in the number of liters of gasoline consumed by the...
Problem Solving with C++ (9th Edition)
Magic Dates The date June 10, 1960 is special because when we write it in the following format, the month times...
Starting Out with C++ from Control Structures to Objects (8th Edition)
Test Scores and Grade Write a program that has variables to hold three test scores. The program should ask the ...
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
What is a compiler?
Absolute Java (6th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- The following statement should determine if x is not greater than 20. What is wrong with it?arrow_forwardAt QT Sugar factory the amounts which go into bag of sugar are supposed to be normally distributed with mean 36 kg and standard deviation 0.1 kg. Once every 30 minutes a bag is selected from the production line, and its contents are noted precisely. If the amount of the bag goes below 35.8 kg or above 36.2 kg, then the bag will be declared out of control. a) If the process is in control, meaning u = 36 kg and o= 0.1 kg, find the probability that the bag will be declared out of control. b) In the situation of (a), find the probability that the number of bag found out of control in an eight-hour day (16 inspections) will be zero. c) In the situation of (a), find the probability that the number of bag found out control in an eight- hour day (16 inspections) will be exactly one. d) If the process shifts so that u =37 kg and o=0.4 kg find the probability that a bag will be declared out of control.arrow_forwardThe BITI Students Club is offering a new travelling package or membership. People can choose either one of three packages : a) business, b) family or c)single package. Each packages have different prices for monthly subscription. A business package is RM40, a family package is RM20 and single package is RM30. People can choose any package and duration-in-month for subscription. The program will calculate and display the total of payment. The program can be repeated as long as the option to exit is not selected. Any invalid input will result in an error message to retry. Create a program that have at least three user defined functions. Three of the functions are having the return type void and calculating the total of each packages. The display is done in separate function.arrow_forward
- Assume the variables x = 5, y = 10, and z = 20. Circle the T (true) or F (false) for each of the following conditions to indicate if it is true or false. x == 3 || y < 4 T F 8 <= z && x > 5 T F 2 != y && z != 25 T F p >= -2 || x <= y T F !(y < z) T Farrow_forwardConsider the following expression: not x >= 10 Which of the expressions below is equivalent? Select one: a.x < 10 b.x == 10 c.x > 10 or x == 10 d.x > 10 and x == 10arrow_forwardTo write an assignment statementarrow_forward
- B.Question The BITI Students Club is offering a new travelling package or membership. People can choose either one of three packages : a) business, b) family or single package. Each packages have different prices for monthly subscription. A business package is RM40, a family package is RM20 and single package is RM30. People can choose any package and duration-in-month for subscription. The program will calculate and display the total of payment. The program can be repeated as long as the option to exit is not selected. Any invalid input will result in an error message to retry. C) Sample Output BITI Caravan Travelling Club Membership 1. BUSINESS (RM40) 2. FAMILY 3. SINGLE 4. Quit the Program (RM20) (RM30) Enter your choice: 1 For how many months do you like to caravan with us ? 5 The total charges are RM200.e0 BITI Caravan Travelling Club Membership 1. BUSINESS (RM40) 2. FAMILY 3. SINGLE 4. Quit the Program (RM20) (RM30) Enter your choice:arrow_forwardStudy the following if statement: if x>10 or x<-10: print('big') elif x>1000000: print('very big') elif x<-1000000: print('very big') else : print('small') For what values of x will the above code print 'very big'?arrow_forwardPlease answer in matlab code.arrow_forward
- Nonearrow_forwardWrite aprogram using nestedif statements that perform the following test: If the variable employed is equal to 'Y' and if worklength is equal or greater than 5, then display the message "Your credit card application is accepted". However, if worklength is less than 5, then display the message "Please provide a guarantor". Otherwise, if the variable employed is equal to 'N', then display the message "Your credit card application is rejected". C.arrow_forwardWhen you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first months interest on $1,000 is 1000 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 6 = 19. This means after making the first payment, the loan amount is 1,000 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 5.89 = 19.11 and the remaining balance after the second payment is 981 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first months interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Control Structure in Data Structure - Data Structures - Computer Science Class 12; Author: Ekeeda;https://www.youtube.com/watch?v=9FTw2pXLhv4;License: Standard YouTube License, CC-BY