Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Resumen

Summary Programming Logic and Design Ch 2

Puntuación
-
Vendido
-
Páginas
5
Subido en
15-11-2025
Escrito en
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.

Mostrar más Leer menos
Institución
Grado

Vista previa del contenido

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

Libro relacionado

Escuela, estudio y materia

Institución
Grado

Información del documento

¿Un libro?
No
¿Qué capítulos están resumidos?
2
Subido en
15 de noviembre de 2025
Número de páginas
5
Escrito en
2025/2026
Tipo
RESUMEN

Temas

$3.64
Accede al documento completo:

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF


Documento también disponible en un lote

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
tanjanel1303 Rosebank College (Pretoria)
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
10
Miembro desde
1 año
Número de seguidores
2
Documentos
47
Última venta
4 meses hace

5.0

2 reseñas

5
2
4
0
3
0
2
0
1
0

Documentos populares

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes