• Verkeerd document? Gratis ruilen
  • Geschreven door studenten die geslaagd zijn
  • Direct beschikbaar na je betaling
  • Online lezen of als PDF
Verkopen
Kies je studieland
Kies je taal
Document preview thumbnail
Voorbeeld 2 van de 6 pagina's
Samenvatting

Summary Programming Logic and Design Ch 9

Document preview thumbnail
Voorbeeld 2 van de 6 pagina's

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.

Voorbeeld van de inhoud

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

Gekoppeld boek
 image
Uitgever: 2023 ISBN: 9780357880876 Druk: Onbekend

Documentinformatie

Heel boek samengevat?
Nee
Wat is er van het boek samengevat?
9
Geüpload op
15 november 2025
Aantal pagina's
6
Geschreven in
2025/2026
Type
Samenvatting
€3,20

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
tanjanel1303
5,0
(2)
Verkocht
11
Volgers
2
Items
47
Laatst verkocht
1 maand geleden

Echte notities, van echte studenten
Elk document op Stuvia is geschreven door een medestudent die hetzelfde vak deed. Zo leer je van iemand die het al heeft gehaald.



Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen