Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
11th Edition
ISBN: 9780134743356
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
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.
See picture for details.
Establish the limits of global and local variables. You should use whole sentences.
Chapter 5 Solutions
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
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
- give me correct solution.arrow_forwardAnswer the 2 subparts. You are obligated to answer 3 subpartsarrow_forwardWhat 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_forward
- 1. 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_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_forwardPlease list real life examples of call by reference and call by value. Explaining the concept of a function, input parameters and output values can be a very difficult topic to teach. A good metaphor can help students understand the notion of parameters, call-by-reference and call-by-value. For example, think about the difference between identity theft and auto theft. If you look at your parking space and your car isn’t there, you know it has been stolen. You don’t have it any more. Yet, if someone steals your identity, you still have it. You can’t even tell it has been stolen until somebody else uses it. In some ways, auto theft is like call by reference because any changes the thief makes to your car, scratched paint, torn upholstery, etc., will still be there when you get it back.arrow_forward
- The steps required to construct an ADT. Please complete the following sentences with your answer.arrow_forwardQuestions about Decision Structure What is the significance of using control structures? For you, which is preferably the most convenient control structure to be used in comparisons, IF-ELSE or SWITCH? Do SWITCH and IF-ELSE have differences?arrow_forwardDefine variable scope and describe the difference between local and global variables. Write in complete sentencesarrow_forward
- Refer to the following statement to answer parts (a) through (c) below, The professor is intelligent and an overachiever, or not an overachiever a. Write the statement in symbolic form Assign letters to simple statements that are not negated Choose the correct answer below OA. let p=The professor is intelligent and letq= The professor is not an overachiever, (p A q)v OB. let p= The professor is intelligent and let q= The professor is not an overachiever (p v q) A OC. let p= The professor is intelligent and let q= The professor is an overachiever (p A q) v -q O D. letp=The professor is intelligent and let q= The professor is an overachiever, (p v q) ^ -9 b. Construct a truth table for the symbolic statement in part (a) PAq (pAq) v -q T.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_forwardFor each statement below, decide whether it is true or false, if it is true, prove it, all parts refer to language over the alphabet (a, b) (a) if L₁ L₂ and L, is not regular, then L₂ is not regular (b) if L₁ L₂ and L₂ is not regular, then L, is not regular. (c) if L, and L₂ are non regular then L₁ L₂ is non regular.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