CS 5 Q2

0.0(0)
studied byStudied by 0 people
0.0(0)
call with kaiCall with Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/35

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 2:29 AM on 1/29/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

36 Terms

1
New cards

origin point

(0,0) - top right

2
New cards

+x

moves right

3
New cards

+y

moves down

4
New cards

when label is inside a group positioning is

relative to the group, Group coordinates + Label's offset = Final position

5
New cards

subtotal =

original bill amount (text from BillInput)

6
New cards

tipAmount =

subtotal x (tipPercent / 100)

7
New cards

taxAmount =

subtotal x (taxPercent / 100)

8
New cards

total =

subtotal + tipAmount + taxAmount

9
New cards

perPerson =

total / numberPeople

10
New cards

Common Errors: rounding too early

causes small errors that compound

11
New cards

Common Errors: Division by zero

If numberPeople = 0, app crashes or shows "NaN"

12
New cards

Common Errors: Blank inputs

If user doesn't enter a value, calculations fail

13
New cards

when to round

after full calculations

14
New cards

PascalCase

ForComponents (UI)

15
New cards

camelCase

forVariables (code)

16
New cards

InputScreen

Where users enter bill, tip, tax, number of people

17
New cards

ResultsScreen

Shows calculated breakdown

18
New cards

Why separate screens

  • Cleaner separation of input vs. output

  • Better visual hierarchy

  • Easier to maintain and debug

19
New cards

Visual Hierarchy

  • Largest font: PerPersonAmountLabel (the key result)

  • Right-aligned amounts: Creates a clean column of dollar values

  • Color contrast: Gold text on dark purple for readability

20
New cards

Scope

Available across all screens in a single app

21
New cards

Declaration

Created once, used anywhere

22
New cards

Initialization

Set to a starting value before use

23
New cards

Dark red

(128, 0, 0) #

24
New cards

Pure red

(255, 0, 0) #FF0000

25
New cards

Cyan

(0, 255, 255) #00FFFF

26
New cards

magenta

(255, 0, 255) #FF00FF

27
New cards

White

(255, 255, 255) #FFFFFF

28
New cards

Black

(0, 0, 0) #000000

29
New cards

higher numbers in RGB codes

brighter color

30
New cards

Concatenation

(joining text)
If you use + on text values: "10" + "5" = "105" (not 15)
Solution: Convert text to number before math:

set subtotal to BillInput's Text

Then use subtotal in calculations (Thunkable auto-converts).

31
New cards

"NaN" Error

Stands for: "Not a Number"
Causes:

  • User didn't enter anything in an input field

  • Trying to do math on blank/invalid text

  • Division by zero

32
New cards

When values are wrong:

  1. Check your comparison operator (>= vs >, <= vs <)

  2. Verify your loop condition (does it check all items?)

  3. Confirm you're incrementing the loop counter

  4. Make sure you're reading the correct list index

33
New cards

When the app crashes:

  1. Look for division by zero

  2. Check for out-of-bounds list access

  3. Ensure all inputs have values before calculating

34
New cards

When colors look wrong:

  1. Verify RGB values match your design

  2. Check text color vs. background color contrast

  3. Confirm colors are consistent across screens

35
New cards

Lists use indices

first item is #1, last is length

36
New cards

User input is text

convert before doing math