• 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 5 pagina's
Samenvatting

Summary Programming Logic and Design Ch 2

Document preview thumbnail
Voorbeeld 2 van de 5 pagina's

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.

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

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

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
€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