Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
5th Edition
ISBN: 9780134801155
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 5.3, Problem 5.16CP
Look at the following pseudocode. If it were a real program, what would it display?
Declare Integer counter =
Constant Integer MAX = 8
While counter <= MAX
Display counter
Set counter = counter + 1
End While
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
The code below is expected to count to 60 and then say time's up, why will it not perform as expected?
counter = 1
limit = 60
while counter < limit:
print(counter)
counter = counter + 1
print("Time's up")
Write the missing lines for a program that will allow the user to enter how many ages they want to enter and then find the average.
Declare Integer counter
Declare Integer totalAge = 0
Declare Real averageAge = 0
Declare Integer age
Declare Integer number
Display “How many ages do you want to enter: “
Input ___________________________
For counter = 1 to number
Display “Enter age: “
Input ___________________
Set totalAge = _________________ + ________________
End For
averageAge = ___________________ / ___________________
Display “The average age is “, _______________________
answer with proper explanation and step by step solution.
Question
The programmer intended the following pseudocode to display the numbers 1 through 60, and then display the message “Time’s up!” It will not function as intended, however. Find the error.
Declare Integer counter = 1
Const Integer TIME_LIMIT = 60
While counter < TIME_LIMIT
Display counter
Set counter = counter + 1
End While
Display “Time’s up!”
Chapter 5 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Ch. 5.1 - What is a repetition structure?Ch. 5.1 - What is a condition-controlled loop?Ch. 5.1 - What is a count-controlled loop?Ch. 5.2 - What is a loop iteration?Ch. 5.2 - What is the difference between a pretest loop and...Ch. 5.2 - Does the While loop test its condition before or...Ch. 5.2 - Does the Do-While loop test its condition before...Ch. 5.2 - What is an infinite loop?Ch. 5.2 - What is the difference between a Do-While loop and...Ch. 5.3 - What is a counter variable?
Ch. 5.3 - What three actions do count-controlled loops...Ch. 5.3 - When you increment a variable, what are you doing?...Ch. 5.3 - Look at the following pseudocode. If it were a...Ch. 5.3 - Prob. 5.14CPCh. 5.3 - Look at the following pseudocode. If it were a...Ch. 5.3 - Look at the following pseudocode. If it were a...Ch. 5.3 - Look at the following pseudocode. If it were a...Ch. 5.3 - Look at the following pseudocode. If it were a...Ch. 5.4 - A program that calculates the total of a series of...Ch. 5.4 - Prob. 5.20CPCh. 5.4 - Should an accumulator be initialized to any...Ch. 5.4 - Look at the following pseudocode. If it were a...Ch. 5.4 - Look at the following pseudocode. If it were a...Ch. 5.5 - Prob. 5.24CPCh. 5.5 - Why should you take care to choose a unique value...Ch. 5 - A ______ controlled loop uses a true/false...Ch. 5 - A ______ controlled loop repeats a specific number...Ch. 5 - Each repetition of a loop is known as a(n) ______....Ch. 5 - The Whi1e loop is a ______ type of loop. a....Ch. 5 - The Do-Whi1e loop is a ______ type of loop. a....Ch. 5 - The For loop is a ______ type of loop. a. pretest...Ch. 5 - A(n) ______ loop has no way of ending and repeats...Ch. 5 - A _______ loop always executes at least once. a....Ch. 5 - Prob. 9MCCh. 5 - A(n) ______ is a special value that signals when...Ch. 5 - A condition-controlled loop always repeats a...Ch. 5 - The While loop is a pretest loop.Ch. 5 - The Do-While loop is a pretest loop.Ch. 5 - You should not write code that modifies the...Ch. 5 - You cannot display the contents of the counter...Ch. 5 - Prob. 6TFCh. 5 - The following statement decrements the variable x:...Ch. 5 - It is not necessary to initialize accumulator...Ch. 5 - In a nested loop, the inner loop goes through all...Ch. 5 - To calculate the total number of iterations of a...Ch. 5 - Why should you indent the statements in the body...Ch. 5 - Describe the difference between pretest loops and...Ch. 5 - What is a condition-controlled loop?Ch. 5 - What is a count-controlled loop?Ch. 5 - What three actions do count-controlled loops...Ch. 5 - What is an infinite loop? Write the code for an...Ch. 5 - A For loop looks like what other loop in a...Ch. 5 - Why is it critical that accumulator variables are...Ch. 5 - What is the advantage of using a sentinel?Ch. 5 - Prob. 10SACh. 5 - Design a Whi1e loop that lets the user enter a...Ch. 5 - Design a Do-Whi1e loop that asks the user to enter...Ch. 5 - Design a For loop that displays the following set...Ch. 5 - Design a loop that asks the user to enter a...Ch. 5 - Design a For loop that calculates the total of the...Ch. 5 - Design a nested loop that displays 10 rows of #...Ch. 5 - Convert the Whi1e loop in the following code to a...Ch. 5 - Convert the Do-Whi1e loop in the following code to...Ch. 5 - Convert the following Whi1e loop to a For loop:...Ch. 5 - Convert the following For loop to a Whi1e loop:...Ch. 5 - Find the error in the following pseudocode....Ch. 5 - The programmer intended the following pseudocode...Ch. 5 - The programmer intended the following pseudocode...Ch. 5 - Bug Collector A bug collector collects bugs every...Ch. 5 - Calories Burned Running on a particular treadmill...Ch. 5 - Budget Analysis Design a program that asks the...Ch. 5 - Sum of Numbers Design a program with a loop that...Ch. 5 - Tuition Increase At one college, the tuition for a...Ch. 5 - Distance Traveled The distance a vehicle travels...Ch. 5 - Average Rainfall Design a program that uses nested...Ch. 5 - Celsius to Fahrenheit Table Design a program that...Ch. 5 - Pennies for Pay Design a program that calculates...Ch. 5 - Largest and Smallest Design a program with a loop...Ch. 5 - First and Last Design a program that asks the user...Ch. 5 - Calculating the Factorial of a Number In...Ch. 5 - Multiplication Table Design a program that uses...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
The ________ object is assumed to exist and it is not necessary to include it as an object when referring to it...
Web Development and Design Foundations with HTML5 (8th Edition)
Define the three types of recursive binary relationships, and give an example of each, other than the ones show...
Database Concepts (8th Edition)
Consider the adage Never ask a question for which you do not want the answer. a. Is following that adage ethica...
Experiencing MIS
What are hardware and software?
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
In Exercises 33 through 40, determine the output displayed in the list box by the lines of code.
Introduction To Programming Using Visual Basic (11th Edition)
You can use this class to display dialog boxes. a. JOptionPane b. BufferedReader c. InputStreamReader d. Dialog...
Starting Out with Java: From Control Structures through Data Structures (3rd 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
- IN pseudocode Write a program that requires you to calculate a shop’s total money in a specific register. Allthe different notes should be added to calculate how much money is in the register. The coinsare added together manually and then added to the total. Required input values are:o The amount of 10 rand notes.o The amount of 20 rand notes.o The amount of 50 rand notes.o The amount of 100 rand notes.o The amount of 200 rand notes.o The total of the coins.The output is the total cash in the register.arrow_forwardARM Assembly Language: Write a program that takes 2 integer inputs from user and then divides them together(using __aeabi_idiv) Thank you so much! Please type answer no write by hend.arrow_forwardProblem: Suppose you want to compute the average temperature for the seven days in a week. You might use the following code: Scanner keyboard = new Scanner(System.in); System.out.println("Enter 7 temperature:"); double sum = 0; for (int count = 0; count < 7; count++) { double next = keyboard.nextDouble(); sum = sum + next; } double average = sum / 7; This works fine if all you want to know is the average. But let's say you also want to know which temperatures are above and which are below the average. Now you have a problem in order to compute the average, you must read the seven temperatures, and you must compute the average before comparing each temperature to it. Thus, to be able to compare each temperature to the average, you must remember the seven temperatures. How can you do this? The obvious answer is to use seven variables of the type of double. This is a bit awkward, because seven is a lot of variables to declare, and in other situations, the…arrow_forward
- What will be the value of RBX after the following instructions execute?mov rbx,0FFFFFFFFFFFFFFFFhand rbx,80harrow_forwardWhat symbol in flowcharting you will use for the given statement below? counter=counter+1 Select one: a. hexagon b. diamond c. parallelogram d. rectangle An electronic system designed to manipulate data, these are machines for storing, moving, adding/subtracting, and evaluating. Select one: a. all of the choices b. computer hardware c. computer d. calculatorarrow_forwardWrite a pseudocode that directs a cashier how to give change. The program has two inputs: theamount due and the amount received from the customer. Display the dollars, quarters, dimes,nickels, and pennies that the customer should receive in return.- A dollar is worth 100 cents- A quarter is worth 25 cents- A dime is worth 10 cents- A nickel is worth 5 cents- A penny is worth 1 centarrow_forward
- Use AWT for this Write an AWT Java program that simulate the PINCODE process. The system has a default PINCODE of 6 digit numbers; the user should enter 6 digit numbers using the NUMBER PAD button. To verify the correct PINCODE the user should click the ENTER button. It will display a dialog box “You are authorized” if the user entered a correct PINCODE otherwise it will display a dialog box “You are not authorized!!!”arrow_forwardIn assembly language, assign a number to a register or a variable, pass a number to the function and display the result, 'odd' or 'even'. The result should be displayed on the console. The function should check whether the number is an even or an odd number.arrow_forwardDraw a flowchart and write pseudocode (in python) to represent the logic of a program that allows the user to enter a value for one edge of a cube. The program calculates the surface area of one side of the cube, the surface area of the cube, and its volume. The program outputs all the results.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Structured Chart; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=vdUO-sGA1DA;License: Standard YouTube License, CC-BY
Introduction to Structure Charts; Author: Christopher Kalodikis;https://www.youtube.com/watch?v=QN2bjNplGlQ;License: Standard Youtube License