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
Which of the following statements about supervised learning is not correct?
Is it possible for an individual operation to stall out while it is still being carried out? You should expect that any remarks you make will be backed up with reason.
Why not make all variables global instead of just global within particular contexts, since global variables may be used everywhere in the program?Justify your answer.
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
- 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_forwardIf a pause doesn't happen soon, how long will it be? I don't see how this relates to shifting between different contexts.arrow_forwardDo the part b of the attached question thanksarrow_forward
- must be using same example but different ideaarrow_forwardProgram using C++ language without the use of logical operators(&&,||,!). Also, be careful with the operations! Because this RetailCost=(units*99)*.50; gives a warning and does not print out total cost purchase.arrow_forwardAfter going through the trouble of listing all of the different mathematical techniques, you should sort them into logical groups.arrow_forward
- I have provided a question with the answers.I want to understand the solution.how do we classify subquads in the task barrow_forwardA lady behaves like a teacher in a classroom, mother or daughter in a home and customer in a market. Here, a single person is behaving differently according to the situations. Consider the above real-life example and which concept you will use in 'c++'? Elaborate the concept.arrow_forward** **** Exercise: 3 stars, standard (swap_exercise) Write an Imp program [c] that swaps the values of [X] and [Y] and show that it satisfies the following specification: {{X <= Y}} c {{Y <= X}} Your proof should not need to use [unfold valid_hoare_triple]. Hints: - Remember that Imp commands need to be enclosed in <{...}> brackets. - Remember that the assignment rule works best when it's applied "back to front," from the postcondition to the precondition. So your proof will want to start at the end and work back to the beginning of your program. - Remember that [eapply] is your friend.) *) Definition swap_program : com (* REPLACE THIS LINE WITH ":= _your_definition_ ." *). Admitted. Theorem swap_exercise : {{X <= Y}} swap_program {{Y <= X}}.Proof. (* FILL IN HERE *) Admitted.(** [] *)From the book software Foundations Volume 2 coq proofarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr