100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Summary

Summary Programming Logic and Design Ch 9

Rating
-
Sold
-
Pages
6
Uploaded on
15-11-2025
Written in
2025/2026

This document provides an in depth and thorough summary of chapter 9 of Programming Logic and Design. It is ready for exam and tests. Everything is laid out as it is in the textbook. All needed information is provided in short. It is written in an easy to study format and reads easy. I got distinctions in exams and tests.

Show more Read less
Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Institution
Course

Document information

Summarized whole book?
No
Which chapters are summarized?
9
Uploaded on
November 15, 2025
Number of pages
6
Written in
2025/2026
Type
Summary

Subjects

Content preview

Chapter 9

Name the parts of a method
 A program module that contains a series of statements that carry out a task
 Invoke or call a method from another program or method
 Any program can contain an unlimited number of methods
 Each method can be called an unlimited number of times
 Client- calling a program or method is called a method’s client
 A method must include:
 Method header (also called declaration or definition), includes identifying information
 Method body contains the implementation (statements that carry out the task)
 Method return statement- returns control to the calling method
 Local variables are declared in a method
 Keeping variables local helps them be more portable and less prone to error
 Global variables are known to all modules
 In scope, only recognised in a method


Design methods with no parameters
 When methods must share data
 Pass the data into and return the data out of methods,
 When you call a method from a program, you must know 4 things:
 What the method does, why are you calling the method
 Name of the called method
 Type of information to send to the method if any
 Type of return data to expect from any method if any




Design methods that require parameters
 Argument to the method- pass a data item into a method from a calling program
 Parameter to the method- method receives the data item
 When a method receives a parameter, you must provide a parameter list that includes:
 The type of parameter
 The local name for the parameter
 Signature- method’s name and parameter list
 Passed by value- copy of value is sent to method and stored in a new memory location
accessible to module
 The value remains unchanged in the main program even if it has been changed in the
module
 Each time a method executes, parameter variables listed in the method header are redeclared

,  myMethod (num myValue)
 Methods can require more than one parameter
 computerTax (num amount, num rate)
 List the arguments within the method call, separated by commas
 List a data type and local identifier for each parameter within the methods header’s
parentheses
 The data type must be repeated with each parameter
 Methods called, parameters have to be in the correct order, otherwise there will be logical
errors
 computerTax (num amount, num rate) cannot be called as computerTax (rate, amount)
 Arguments sent are called actual parameters
 Variables that accept the parameters in the method are called formal parameters


Design methods that return a value
 A variable declared within a method ceases to exist when the method ends (goes out of scope)
 To retain a value that exists when a method ends, return the value from the method back to
the calling method
 When a method returns a value, the method return type must match the data type of the value
that is returned
 Return type for a method
 Indicates the data type of the value that the method will send back
 Can be any type
 Also called a method’s type
 Listed in front of the method name when the method is defined
 Method can also return nothing
 Return type void
 Void method
 Example: num getHoursWorked (), returns numeric value
 Usually, you want to use the returned value in the calling method
 Not required Output “Hours worked is”,
 Store in variable or use directly without storing getHoursWorked ()
 Technically you are allowed to include multiple return statements in a method
 It’s not recommended
 Violates structured logic
 To use a method, you should know:
 What the method does in general
 The method’s name
 The method’s required parameters, if any
 The method’s return type, so you can use returned values appropriately
 Overhead refers to the extra resources and time required by an operation, such as calling a
method

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
tanjanel1303 Rosebank College (Pretoria)
Follow You need to be logged in order to follow users or courses
Sold
10
Member since
1 year
Number of followers
2
Documents
47
Last sold
2 months ago

5.0

2 reviews

5
2
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions