Concept explainers
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 +
End While
Display "Time's up!"
Learn your wayIncludes step-by-step video
Chapter 5 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Java: An Introduction to Problem Solving and Programming (7th Edition)
Database Concepts (8th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out with Java: Early Objects (6th Edition)
Starting out with Visual C# (4th Edition)
- Why does the following pseudocode not perform as indicated in the comments? // This program gets a dollar amount from the user // and validates the input. Declare Real amount // Get the amount from the user. Display "Enter a dollar amount" Input amount // Make sure the amount is not less than zero. If it is, // get a new amount from the user. While amount < 0 Display "ERROR: The dollar amount cannot be less than 0." Display "Enter a dollar amount." End Whilearrow_forwardIn Ruritania, fractional numbers are rounded up to the next integer if the fractional part is at least 0.25. However, if they are negative, they are rounded down to the next lower integer if the fractional part is more than 0.75. For example, 2.5 → 32.25 → 32.24 → 2-2.3 → -2-2.76 → -3-3.25 → -3 Complete the following program to print out the integer, using Ruritanian rounding. No loops or if statements.arrow_forwardWrite the Pseudocode for the given Problems below. Create a pseudocode that will compute two constant numbers. Display the sum, difference, product, and quotient. Write the pseudocode given the following expressions, re-write, and add parentheses based on the sequence of how they will be evaluated. You have to add static value for each of the variables. 1) a / b ^ c ^ d – e + f – g * h + I 2) 3 * 10 *2 / 15 – 2 + 4 ^ 2 ^ 2 3) r ^ s * t / u – v + w ^ x – y+arrow_forward
- Summary During winter when it is very cold, typically, everyone would like to know the windchill factor, especially, before going out. Meteorologists use the following formula to compute the windchill factor, W: W = 35.74 + 0.6215 × T - 35.75 × V0.16 + 0.4275 × T × V0.16 where V is the wind speed in miles per hour and T is the temperature in degrees Fahrenheit. Instructions Write a program that prompts the user to input the wind speed in miles per hour, and the temperature in degrees Fahrenheit. The program then outputs the current temperature and the windchill factor. Your program must contain at least two functions: one to get the user input and the other to determine the windchill factor.arrow_forwardComplete the pseudocode below (using C++) by including a SWITCH statement that takes the user input (an integer between 26-30) and prints out a count up in its English equivalent. For example: if the user inputs “26”, the code will print “twenty-six”, “twenty-seven” on the next line, and so on up to “thirty”. If the user inputs “30”, the code will print “thirty” and finish. CREATE inputNum PRINT ("Please enter a number between 26-30 to start counting from:") READ inputNum WHILE inputNum >= 26 AND inputNum <= 30 BEGIN WHILE END WHILEarrow_forwardWrite the pseudo code for this problem based on what you learned from the video. The purpose is to design a modular program that asks the user to enter a distance in kilometers and then converts that distance to miles. The conversion formula is as follows: Miles = Kilometers x 0.6214arrow_forward
- Write the pseudocode on a piece of paper and explain your answer. 1. Write the pseudocode to represent the logic of a program that allows the user to input the temperature of a patient in degrees Fahrenheit. It should compute the equivalent temperature in degrees centigrade. The program should display the temperature in degrees centigrade and degrees Fahrenheit. (C = (Fahrenheit – 32) * 5 / 9)arrow_forwardThe following formula gives the distance between two points, (x₁,y₁) and (x₂,y₂) in the Cartesian plane: \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}(x2−x1)2+(y2−y1)2 Given the center and a point on the circle, you can use this formula to find the radius of the circle. Instructions Write a program that prompts the user to enter the center and a point on the circle. The program should then output the circle’s radius, diameter, circumference, and area. Your program must have at least the following functions: distance: This function takes as its parameters four numbers that represent two points in the plane and returns the distance between them. radius: This function takes as its parameters four numbers that represent the center and a point on the circle, calls the function distance to find the radius of the circle, and returns the circle’s radius. circumference: This function takes as its parameter a number that represents the radius of the circle and returns the circle’s circumference.…arrow_forwardShow the value of x after each of the following statements is performed:a) x = fabs(7.5);b) x = floor(7.5);c) x = fabs(0.0);d) x = ceil(0.0);e) x = fabs(-6.4);f) x = ceil(-6.4);g) x = ceil(-fabs(-8 + floor(-5.5)));arrow_forward
- The variable x starts with the value 0.The variable y starts with the value 5.Add 2 to X.Add 2 to y.Add x and y, and store the result in y.Display the value in y on the screen.arrow_forwardPROBLEM:Write a program that prompts the user to input any digit then swap the position of the first and the last digit. Next, the user will be prompt to select what arithmetic operation he/she want to employ on the first and last digit based on the following choices: 1. Sum of their square 2. Product of their square root 3. Square of their product The output will display the result of the arithmetic operation followed by the digit with a swapped position of “first” and “last” digit. Then finally display the equivalent uppercase alphabet for the first digit and lowercase alphabet for the last digit respectively after swapping. Note: 1. If the last digit of the inputted digit from the user is zero, it must display that there is no equivalent alphabet for that digit. 2. If the user chooses arithmetic operation No.2, format the output to three decimal placesarrow_forwardDetermine if the expression is true or false. A true expression is equivalent to one, a false expression is equivalent to zero. a) if (12%15 > 0) True False b) if ((5 <= 10) && (36/4 < 4)) True False c) if (strlen("hello") != 6) True Falsearrow_forward
- 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