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 3, Problem 7AW
What will the following pseudocode program display?
Module main()
Declare Integer x = 1
Declare Real y = 3.4
Display x, " ", y
Call changeUs(x, y)
Display x, " " , y
End Module
Module changeUs(Integer Ref a, Real Ref b)
Set a = 0
Set b = 0.0
Display a, " ", b
End Module
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
What will the following pseudocode program display?Module main() Declare Integer x = 1 Declare Real y = 3.4 Display x, “ “ , y Call changeX(x) Call changeY(y) Display x, “ “ , yEnd ModuleModule changeX(Integer a) Set a = 0 Display aEnd ModuleModule changeY(Real Ref b) Set b = 0.0 Display bEnd Module
Course Level Programming Assignment - Programming a Calculator using Python
In this assignment you will write a computer program from scratch using the Python programming language. This program will function as a simple calculator.
Objectives
Write a simple Python program that performs arithmetic operations based on the user input
Stage 1: A simple calculator
Your calculator should provide the following arithmetic and control operations.
Arithmetic Operations
Addition (+) add(a,b)
Subtraction (-) subtract(a,b)
Multiplication (*) multiply(a,b)
Division (/) divide(a,b)
Power (^) power(a,b)
Remainder (%) remainder(a,b)
Control Operations
Terminate (#)
Reset ($)
Write a function select_op(choice) to select the appropriate mathematics function based on the users selection.
The behavior of the program should be as follows:
The program should ask the user to specify the desired operation…
Course Level Programming Assignment - Programming a Calculator using Python
In this assignment you will write a computer program from scratch using the Python programming language. This program will function as a simple calculator.
Objectives
Write a simple Python program that performs arithmetic operations based on the user input
Stage 1: A simple calculator
Your calculator should provide the following arithmetic and control operations.
Arithmetic Operations
Addition (+) add(a,b)
Subtraction (-) subtract(a,b)
Multiplication (*) multiply(a,b)
Division (/) divide(a,b)
Power (^) power(a,b)
Remainder (%) remainder(a,b)
Control Operations
Terminate (#)
Reset ($)
Write a function select_op(choice) to select the appropriate mathematics function based on the users selection.
The behavior of the program should be as follows:
The program should ask the user to specify the desired operation…
Chapter 3 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Ch. 3.1 - What is a module?Ch. 3.1 - Prob. 3.2CPCh. 3.1 - Prob. 3.3CPCh. 3.1 - Prob. 3.4CPCh. 3.1 - Prob. 3.5CPCh. 3.2 - In most languages, a module definition has what...Ch. 3.2 - Prob. 3.7CPCh. 3.2 - Prob. 3.8CPCh. 3.2 - Prob. 3.9CPCh. 3.3 - What is a local variable? How is access to a local...
Ch. 3.3 - What is a variables scope?Ch. 3.3 - Prob. 3.12CPCh. 3.3 - Prob. 3.13CPCh. 3.4 - Prob. 3.14CPCh. 3.4 - What are the variables that receive pieces of data...Ch. 3.4 - Prob. 3.16CPCh. 3.4 - Prob. 3.17CPCh. 3.4 - Prob. 3.18CPCh. 3.5 - What is the scope of a global variable?Ch. 3.5 - Give one good reason that you should not use...Ch. 3.5 - Prob. 3.21CPCh. 3 - A group of statements that exist within a program...Ch. 3 - Prob. 2MCCh. 3 - The first line of a module definition is known as...Ch. 3 - Prob. 4MCCh. 3 - Prob. 5MCCh. 3 - A design technique that programmers use to break...Ch. 3 - Prob. 7MCCh. 3 - A _____ is a variable that is declared inside a...Ch. 3 - A(n) ____ is the part of a program in which a...Ch. 3 - A(n) ____ is a piece of data that is sent into a...Ch. 3 - A(n) ____ is a special variable that receives a...Ch. 3 - When _____, only a copy of the argument's value is...Ch. 3 - When ____, the module can modify the argument in...Ch. 3 - A variable that is visible to every module in the...Ch. 3 - When possible, you should avoid using _____...Ch. 3 - The phrase divide and conquer means that all of...Ch. 3 - Prob. 2TFCh. 3 - Module names should be as short as possible.Ch. 3 - Prob. 4TFCh. 3 - A flowchart shows the hierarchical relationships...Ch. 3 - Prob. 6TFCh. 3 - A statement in one module can access a local...Ch. 3 - In most programming languages, you cannot have two...Ch. 3 - Programming languages typically require that...Ch. 3 - Most languages do not allow you to write modules...Ch. 3 - When an argument is passed by reference, the...Ch. 3 - Prob. 12TFCh. 3 - Prob. 1SACh. 3 - Prob. 2SACh. 3 - Prob. 3SACh. 3 - What is a local variable? What statements are able...Ch. 3 - In most languages, where does a local variables...Ch. 3 - What is the difference between passing an argument...Ch. 3 - Prob. 7SACh. 3 - Design a module named timesTen. The module should...Ch. 3 - Examine the following pseudocode module header,...Ch. 3 - Look at the following pseudocode module header:...Ch. 3 - Assume that a pseudocode program contains the...Ch. 3 - Design a module named getNumber, which uses a...Ch. 3 - What will the following pseudocode program...Ch. 3 - What will the following pseudocode program...Ch. 3 - Find the error in the following pseudocode. Module...Ch. 3 - Find the error in the following pseudocode. Module...Ch. 3 - Find the potential error in the following...Ch. 3 - Prob. 4DECh. 3 - Kilometer Converter Design a modular program that...Ch. 3 - Prob. 2PECh. 3 - How Much Insurance? Many financial experts advise...Ch. 3 - Prob. 4PECh. 3 - Prob. 5PECh. 3 - Prob. 6PECh. 3 - Calories from Fat and Carbohydrates A nutritionist...Ch. 3 - Prob. 8PECh. 3 - Prob. 9PECh. 3 - Monthly Sales Tax A retail company must file a...Ch. 3 - Prob. 11PE
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write a type definition for pointer variables that will be used to point to dynamic arrays. The array elements ...
Problem Solving with C++ (10th Edition)
Suppose that you have two text files that contain sequences of integers separated by whitespace (blank space, t...
Starting Out with C++: Early Objects
Describe the difference between making a class a member of another class (object aggregation), and making a cla...
Starting Out with C++ from Control Structures to Objects (9th Edition)
What is the difference between a class and an instance of a class?
Starting Out with Java: From Control Structures through Objects (6th Edition)
Is the increase method a mutator? If so, how could you demonstrate this?
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Write a loop that asks the user Do you want to repeat the program or quit? (R/Q). The loop should repeat until ...
Starting Out with C++ from Control Structures to Objects (8th 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
- Flowchart for this pseudocodearrow_forward//This pseudocode must obtain and print 7^2.5 Module main() Call raiseToPower (7, 2.5) End Module Module raiseToPower(Integer Real Declare Real result Set result=val^pow Display result End Modulearrow_forwardWhat will the following pseudocode program display? Module main() Declare Integer x = 1 Declare Real y = 3.4 Display x, " ", y Call changeUs(x, y) Display x, " ", yEnd ModuleModule changeUs(Integer a, Real b) Set a = 0 Set b = 0 Display a, " ", bEnd Modulearrow_forward
- INSTRUCTION: C++ languagearrow_forwardProgram 3-6 1 Module main () Declare Integer number Display "Enter a number and I will display" Display "that number doubled." 3 4 5 Input number 6 Call doubleNumber(number) 7 End Module 8 9 Module doubleNumber(Integer value) Declare Integer result Set result = value * 2 10 11 12 Display result 13 End Module Program Output (with Input Shown in Bold) Enter a number and I will display that number doubled. 20 [Enter] 40arrow_forwardRaptor flow chart for // Module Main() Constant Integer SIZE = 7 Declare Integer index, numbers, numberSize For index = 0 to SIZE - 1 Set numbers(index) = range <= 0 AND >= 9 For index = 0 to SIZE - 1 Display "Random number:", index + 1, " is: ", numbers(index) End For End Modulearrow_forward
- #3 – This pseudocode has multiple problems. Fix the calling statement and the definition below so that the routine accepts 3 grades as parameters and returns the average into a variable. Call calcPercentageof(Boolean Number) Module calcPercentageOf (numerator, num2) Set percentage = num / num2 * 100 End Module Write the correct call statement and module definition below:.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_forwardn this assignment you will write a computer program from scratch using the Python programming language. This program will function as a simple calculator. Objectives Write a simple Python program that performs arithmetic operations based on the user input Stage 1: A simple calculator Your calculator should provide the following arithmetic and control operations. Arithmetic Operations Addition (+) add(a,b) Subtraction (-) subtract(a,b) Multiplication (*) multiply(a,b) Division (/) divide(a,b) Power (^) power(a,b) Remainder (%) remainder(a,b) Control Operations Terminate (#) Reset ($) Write a function select_op(choice) to select the appropriate mathematics function based on the users selection. The behavior of the program should be as follows: The program should ask the user to specify the desired operation (addition/subtraction/multiplication/division/power/remainder/terminate/reset). You can…arrow_forward
- ind 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_forwardModule main() // Local variables Declare Integer gramsFat, calories // Get fat grams Set gramsFat = getFat() // Get calories Set calories = getCalories(gramsFat) // Show percent calories from fat Call showPercent(gramsFat, calories) End Module // The getFat function gets grams of fat Function Integer getFat () Declare Integer inputAmount // enter count Display “Enter grams of fat: “ Input inputAmount // validate rate While inputAmount < 0 Display “Quantity must not be less than 0!” Display “Enter a valid quantity.” Input inputAmount End While return inputAmount End Function // The getCalories function gets number of calories Function Integer getCalories(gramsFat) Declare Integer inputAmount, maxCalories Set maxCalories = gramsFat * 9 // enter count Display “Enter number of calories: “…arrow_forwardFind the error in the following pseudocode: Module main() Call getCalories() End Module Module getCalories() Declare Real calories Display "How many calories are in the first food?" Input calories Declare Real calories Display "How many calories are in the second food?" Input calories End Modulearrow_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 PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Graphical User Interfaces: Crash Course Computer Science #26; Author: CrashCourse;https://www.youtube.com/watch?v=XIGSJshYb90;License: Standard YouTube License, CC-BY
Python GUI | How To Make A GUI In Python | Best GUI Framework In Python | Edureka; Author: edureka!;https://www.youtube.com/watch?v=_PHJvjQJa3w;License: Standard Youtube License