Java How to Program, Early Objects (11th Global Edition) - Does NOT include MyLab Programming
11th Edition
ISBN: 9780134800301
Author: Harvey Deitel, Paul J. Deitel
Publisher: Pearson Global Edition
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 5, Problem 3.1E
Program Plan Intro
“while” loop:
The “while” loop first checks its expression and then the statements inside the loop are executed. It is also called as pretest loops.
- These loops do not have to be terminated with a semicolon.
- With the false expressions, the loops can be terminated.
- So, the “while” loop always used for sentinel-controlled iteration.
“do-while” loop:
- The “do-while” loops are called as posttest loops. The “do-while” loop does not check its expression till it has done iteration. This varies from the behavior of “while” loop.
- The “do-while” should be terminated with a semicolon (;). With the false expressions, the loops get terminated.
- The “do-while” loop make at-least single iteration even with the false expression.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Discuss the conditions where the “while” statement is preferable to the “for” statement.
Indicate the most appropriate if-then statement that the English sentence represents:
People 18 or older can vote in a Federal election.
A. No if-then statement would cover this situation.
B. If a person is 18 years old or older, then the person can vote in Federal elections.
C. If a person does not vote in a Federal election, they are not 18 years old or older.
D. If a pers is 18 years old or younger, then the person can vote in Federal elections.
By using examples differentiate between a single‐alternative and a dual‐alternativeif statement.
Chapter 5 Solutions
Java How to Program, Early Objects (11th Global Edition) - Does NOT include MyLab Programming
Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Fill in the blanks in each of the following...Ch. 5 - Prob. 1.6SRECh. 5 - Prob. 1.7SRECh. 5 - State whether each of the following is true or...Ch. 5 - State whether each of the following is true or...Ch. 5 - State whether each of the following is true or...
Ch. 5 - State whether each of the following is true or...Ch. 5 - Prob. 2.5SRECh. 5 - State whether each of the following is true or...Ch. 5 - Prob. 2.7SRECh. 5 - Prob. 3.1SRECh. 5 - Prob. 3.2SRECh. 5 - Write a Java statement or a set of Java statements...Ch. 5 - Prob. 3.4SRECh. 5 - Find the error in each of the following code...Ch. 5 - Find the error in each of the following code...Ch. 5 - Find the error in each of the following code...Ch. 5 - Find the error in each of the following code...Ch. 5 - Describe the four basic elements of...Ch. 5 - Compare and contrast the while and for iteration...Ch. 5 - Prob. 3.1ECh. 5 - Compare and contrast the break and continue...Ch. 5 - Find and correct the error(s) in each of the...Ch. 5 - The following code should print whether integer...Ch. 5 - Prob. 5.3ECh. 5 - Find and correct the error(s) in each of the...Ch. 5 - What does the following program do? 1 // Exercise...Ch. 5 - (Find the Smallest Value) Write an application...Ch. 5 - (Calculating the Product of Odd Integers) Write an...Ch. 5 - (Factorials) Factorials are used frequently in...Ch. 5 - (Modified Compound-Interest Program) Modify the...Ch. 5 - (Triangle Printing Program) Write an application...Ch. 5 - (Bar-Chart Printing Program) One interesting...Ch. 5 - (Calculating Sales) An online retailer sells five...Ch. 5 - (Modified Compound-Interest Program) Modify the...Ch. 5 - Assume that i = 1, j = 2, k = 3 and m = 2. What...Ch. 5 - (Calculating the Value of ) Calculate the value of...Ch. 5 - (Pythagorean Triples) A right triangle can have...Ch. 5 - (Modified Triangle-Printing Program) Modify...Ch. 5 - (De Morgans Laws) In this chapter, we discussed...Ch. 5 - (Diamond-Printing Program) Write an application...Ch. 5 - Prob. 21.1ECh. 5 - A criticism of the break statement and the...Ch. 5 - What does the following program segment do? 1 for...Ch. 5 - Describe in general how youd remove any continue...Ch. 5 - Prob. 25.1E
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
- Establish the limits of global and local variables. You should use whole sentences.arrow_forwardQuestion 2: DFAS For this question take E={a,b} (a) Make a DFA (state-diagram), that accepts all words that start with either 'ab' , or with 'aba', and end with the same pattern they started with. (b) Make a DFA that accepts all words that include the pattern "babaa" (c) Make a DFA that accepts all words that include the pattern "babaa" an odd number of times.arrow_forwardQuestion:: write out the four logical forms of the statement: Cats make great pets.(Lable the four forms: Statement, inverse, etc. and write them as if.. then..)arrow_forward
- What sentence correctly describes the relationship between a person and a hometown? Select one: a. A person may have a hometown and a town must be a hometown of one person at least b. Each person must have one hometown and a town may be a hometown of only one person c. A person may have more hometowns and a town must be a hometown of one person at least d. Each person must have one hometown and a town may be a hometown for more people e. Each person must have more hometowns and a town may be a hometown for more personsarrow_forward1. What is the significance of using control structures? 2. For you, which is is preferably the most convenient control structure to be used in comparisons, IF-ELSE or SWITCH? 3. Do SWITCH and IF-ELSE have differences?arrow_forwardIndicate the most appropriate if-then statement that the English sentence represents: People 18 or older can vote in a Federal election. If a person is 18 years old or younger, then the person can vote in Federal elections. No if-then statement would cover this situation. If a person is 18 years old or older, then the person can vote in Federal elections. If a person does not vote in a Federal election, they are not 18 years old or older.arrow_forward
- Write out the four logical forms of the statement: Cats make great pets. (Label the four terms: statement, inverse, etc., and write them as If..then..)arrow_forwardAnswer correctly (if u don’t want dislike and bad comment)arrow_forwardUsing the predicate symbols shown and appropriate quantifiers, write each English language statement as a predicate wff. (The domain is the whole world.)G(x): x is a gameM(x): x is a movieF(x, y): x is more fun than ya. Any movie is more fun than any game.b. No game is more fun than every movie.c. Only games are more fun than movies.d. All games are more fun than some movie.arrow_forward
- 2. In the programming I course, the students were given feedback on their assignment code from their instructor. Saleh received his feedback in four statements as shown below. Find the mistake in his program with the help of logical propositions. Explain your answer. (a) There is an undeclared variable or there is a syntax error in the first five lines. (b) If there is a syntax error in the first five lines, then there is a missing semicolon or a variable name is misspelled. (c) There is not a missing semicolon. (d) There is not a misspelled variable name.arrow_forwardPlease help eith the question below thanks! Subject: Program design methods Make Use Case Diagrams and Descriptions as well as Activity Diagrams for Online Food Ordering Systems: a. Use Case Diagram: pay attention to the rules and notations that need to be used, when to use verbs, nouns, and determine the actor correctly. b. Use Case Description: Please feel free to use the Use Case Description format, as long as you include references that serve as your reference. Each Use Case must be made a Use Case Description. c. Activity Diagram: Each Use Case must be made an Activity Diagram.arrow_forwardA midterm exam has two parts. Part 1 consists of ten multiple choice questions. Each question hasfour choices, labeled (a), (b), (c), and (d), and one may pick any combination of responses on each ofthese questions. For example, one could choose just (a) alone on one question, or both (b) and (c),or all four possibilities, or none of them. In Part 2, one may choose either to answer eight true/falsequestions, or to select the proper definition of each of seven terms from a list of ten possible definitions.Every question must be answered on whichever portion (true/false or definition) of Part 2 is chosen,but one is not allowed to complete both the true/false and the definition portions. How many waysare there to complete the exam?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education