100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4,6 TrustPilot
logo-home
Samenvatting

Summary Programming Logic and Design Ch 2

Beoordeling
-
Verkocht
-
Pagina's
5
Geüpload op
15-11-2025
Geschreven in
2025/2026

This document provides an in depth and thorough summary of chapter 2 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.

Meer zien Lees minder
Instelling
Vak









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Gekoppeld boek

Geschreven voor

Instelling
Vak

Documentinformatie

Heel boek samengevat?
Nee
Wat is er van het boek samengevat?
2
Geüpload op
15 november 2025
Aantal pagina's
5
Geschreven in
2025/2026
Type
Samenvatting

Onderwerpen

Voorbeeld van de inhoud

Chapter 2

Declaring and using variables and constants
 Data type- a classification that describes the following:
 What values can be held by the item
 How item is stored in computer memory
 What operations can be performed on the item
 Numeric- data that consists of numbers/decimals, arithmetic operations performed
 Integer values- whole numbers / Floating point values (real numbers) -
decimal numbers
 String- data items that are non-numeric, cannot be used in arithmetic operations
 Numeric constant -Contains numbers that does not change
 String constant (Alphanumeric values) - Enclosed in quotation marks, contains characters
and numbers
 Variable -named memory locations, content can vary
 Numeric variable- holds digits, performs mathematical operations
 String variable- holds text, letter, special characters
 Declaration is a statement that provides a variable's:
 Data type
 Identifier (variable’s name)
 Optionally, an initial value
 Type-safety -Prevents assigning values of an incorrect data type
 Identifier- variable name
 Choose reasonable and descriptive name for variables
 Most languages allow letters and digits
 Some languages allow hyphens
 Reserved keywords are not allowed (num/string)
 Variable names- case sensitive
 Must be one word
 Must start with a letter
 Should have appropriate meaning
Variable Naming
Camel casing (lower) hourlyWage Snake casing hourly_wage
Pascal casing (upper) HourlyWage Underscore casing Hourly_Wage
Hungarian notation numHourlyWage Kebob casing hourly-wage


 Assignment statement- first calculates myNumber * 2, then stores computed value in
myAnswer
 set myAnswer = myNumber * 2
 Assignment operator
 Binary operator- requires two operands - one on each side

,  Operates from right to left, right-associativity or right-to-left associativity
 The result to the left of an assignment operator is called a Lvalue
 Initializing the variable - declare a starting value, variables must be declared before used in
program
 num yourSalary = 14.55 / num yourSalary
 string yourName = “Janita” / string yourName
 Garbage – a variable’s unknown value, till it is given a value (input yourSalary)
 Named constant- Uppercase with underscores
 Can be assigned a value only once
 Assign a useful name to a value that will never be changed during a program’s execution,
or change once to change all instances
 Magic number
 Unnamed constant
 Use taxAmount = price * SALES_TAX_AMOUNT instead of taxAmount = price * .06 (magic
number)


Performing arithmetic operations
 Standard arithmetic operators:
+ (plus sign)- addition * (asterisk)- multiplication = (equal)- assignment
− (minus sign)- / (slash)- division
subtraction


 Rules of precedence (Order of operations)
Parenthesis
 Dictate the order in which operations in the same statement are Multiplication and
carried out Division
Addition and
 All the arithmetic operators have left-to-right associativity
subtraction
 Dividing an integer by another integer is a special case
 Dividing two integers results in an integer, and any fractional part of the result is lost
 The decimal portion of the result is cut off, or truncated
 A remainder operator (modulo operator/ modulus operator) contains remainder of a
division operation
 24 Mod 10 is 4, Because when 24 is divided by 10, 4 is the remainder


The advantages of modularization
 Modules -Subunit of programming problem (subroutines, procedures, functions, or methods)
 Call a module is to use its name to invoke the module, causing it to execute
 Modularization -Breaking down a large program into modules (functional
decomposition)
 Abstraction
 Paying attention to important properties while ignoring nonessential details
 One broad statement corresponds to dozens of machine instructions
 Multiple programmers can work on one problem
€3,25
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten


Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

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 Rosebank College (Pretoria)
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
10
Lid sinds
1 jaar
Aantal volgers
2
Documenten
47
Laatst verkocht
2 maanden geleden

5,0

2 beoordelingen

5
2
4
0
3
0
2
0
1
0

Recent door jou bekeken

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

Veelgestelde vragen