Can you find the reason that the following pseudocode does not perform as indicated in the comments?
// Find the error in the following pseudocode.
Module main()
Declare Real value, result
// Get a value from the user.
Display "Enter a value."
Input value
// Get 10 percent of the value.
Call tenPercent(value)
// Display 10 percent of the value.
Display "10 percent of ", value, " is " result
End Module
// The tenPercent function returns 10 percent
// of the argument passed to the function.
Function Real tenPercent(Real num)
Return num * 0.1
End Function
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Computer Science: An Overview (12th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
C How to Program (8th Edition)
Artificial Intelligence: A Modern Approach
- .Design Windows form application which will ask the user to input a number. Theprogram should print out the square of that number if the number is negative.arrow_forwardText Book: Starting Out with Programing Logic & Design 5 edition Write a program that will take in basic information from a student, including student name, degree name, number of credits taken so far, and the total number of credits required in the degree program. The program will then calculate how many credits are needed to graduate. Display should include the student name, the degree name, and credits left to graduate. Step 1: Examine the following algorithm. (Reference: Designing a Program, page 31). Get the student name. Get the degree program name. Subtract the number of credits taken so far from the required credits for the degree. Get the number of credits required for the degree program. Get the number of credits the student has taken so far. Display the input information in Step 1 and 2. Display the calculated information. Step 2: What logic error do you spot and how would you fix it? Step 3: What steps require user interaction (Ex: user must type in some…arrow_forward//This program calculates the balance of a savings account over a period of time. Module main () Call showMsg () Call user_input () Call monthly_calculations (ref Integer monthsPassed) Call displayOutput () End module //This displays an explanation to the end user about what this program does Module showMsg () Display “This program calculates your savings account balance, number of deposits, ” Display “number of withdrawals, and total interest earned over time.” End module //This module asks the user for the starting balance, annual interest rate, and //the amount of months since the account opened and stores the //users input in their corresponding variables Module user_input () Declare Real annual_interest_rate, balance Declare Integer monthsPassed Display “What is your account's starting balance?” Input balance Display “Please enter the annual interest rate for your account.” Input annual_interest_rate Display “How many months have passed…arrow_forward
- Text Book: Starting Out with Programing Logic & Design 5 edition Write a program that will take in basic information from a student, including student name, degree name, number of credits taken so far, and the total number of credits required in the degree program. The program will then calculate how many credits are needed to graduate. Display should include the student name, the degree name, and credits left to graduate. Step 1: Examine the following algorithm. (Reference: Designing a Program, page 31). Get the student name. Get the degree program name. Subtract the number of credits taken so far from the required credits for the degree. Get the number of credits required for the degree program. Get the number of credits the student has taken so far. Display the input information in Step 1 and 2. Display the calculated information. Step 3: What steps require user interaction (Ex: user must type in some input)?arrow_forwardFYI: Please write the code in Pseudocode (no programming language please) 1. Write pseudocode module that loops through random numbers until it generates the "lucky number". In the main(), ask the user to enter a lucky number between 1 to 10 Validate the user’s input Pass the lucky number to the module from the main() In the module, display each number that gets randomly generated. A number in the range of 1-10 Return a count of the number of times it took to get the “luck number” Write the entire program including the Main()arrow_forwardFind the error in the following pseudocode: Module main() Declare Real mileage Call getMileage() Display "You've driven a total of ", mileage, " miles." End Module Module getMileage() Display "Enter your vehicle’s mileage." Input mileage End Modulearrow_forward
- AutoSave AB2 PROORAMING EXERCISES Draw Design Insert Share Commants Arial Career Life Instructions A piece of wire is to be bent in the form of a circle to put around a picture frame. Write a program that prompts the user to input: 1. The length of the wire The program then outputs: 1. the radius and area of the circle. You may assume that TT = 3.1416. Declare PI as a named constant with this value. ge 5 of 9 1466 words Focus 123% 动 + --arrow_forwardind the error in the following pseudocode.Module main()Declare Real mileageCall getMileage()Display "You've driven a total of ", mileage, " miles."End ModuleModule getMileage()Display "Enter your vehicle's mileage."Input mileageEnd Modulearrow_forwardAssume that a pseudocode program contains the following module:Module display(Integer arg1, Real arg2, String arg3)Display "Here are the values:"Display arg1, " ", arg2, " ", arg3End Modulearrow_forward
- Flowchart, create. Writing Functions that Require Multiple Parameters in Python def calculateSum(num1,num2): #Function to calculate sum of two numbers result = num1 + num2 #saving the sum of two numbers into result print("The Sum of Two numbers is :",result) #printing the result def calculateDifference(num1,num2): #Function to calculate Difference of two numbers result = num1 - num2 #saving the difference of two numbers into result print("The Difference of Two numbers is :",result) #printing the result def calculateProduct(num1,num2): #Function to calculate product of two numbers result = num1 * num2 #saving the product of two numbers into result print("The Product of Two numbers is :",result) #printing the result if __name__ == "__main__": #main() number1 = int(input("Enter First Number:")) #Taking two numbers as input from the user number2 = int(input("Enter Second Number:")) calculateSum(number1,number2)…arrow_forwardDifferentiate between “Call by value” and “Call by Reference”.arrow_forwardHide Assignment Information Instructions The civil engineering department has asked you to write a program to compare three different designs of water towers shown in the diagrams below. The water towers are a cylinder topped with a half sphere. The engineers want to find the design that has the highest volume. The radius of the sphere and the radius and height of the cylinder for each of the three projects will need to be input by the user. The formula for the volume of a Sphere is:V = 4/3 π r3The formula for the volume of a Cylinder is:V = π r2 h Write two functions that will calculate the volume of a sphere and a cylinder respectively. Then, use these functions to write a program that will find the design with the largest volume. Hint: Remember that the tower only consists of a half sphere.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT