CPNT 262 Day 7 - Validating value types, Scope and Review

Housekeeping

Trophy of the day


1. Spoiler demo: Tip calculator upgrade


2. Value validation

A common task in untyped languages is confirming the value type that you're working with.

Materials

Activity

  • Using your knowledge of comparison operators and conditional statements, add validation to your Tip Calculator that ensures that:
    1. Remove the required attribute from total field so we can test;
    2. The user entered a number for Bill Total (i.e. not empty);
    3. The entered Bill Total is greater than $0;
    4. Throw an error if total is negative or missing.

3. Scope

Materials


4. Activity: Text area counter

Materials

Activity


Lab Time


Prep

Validating value types

Scope

Forms