Northcentral Technical College Introduction To Programming
10-152-310
Introduction to Programming with JavaScript NTC 10-152-310

Learning Plan 3 3.2 Assignment 1

# 3.2 Assignment 1

#### File: /Learning Plan 3/3.2assignment1.html

### Student

- Name:
- Section:
- Email:

## Part 1

1. Add code after the line: `// PART 1: YOUR CODE STARTS AFTER THIS LINE:` to complete the exercise.
   1. Variable declarations section
      1. Write a comment that starts the variable declaration section.
      2. Create a variable named `firstName`.
      3. Create a variable named `middleInitial`
      4. Create a variable named `lastName`
      5. Create a variable named `fullName`
   2. Assignments section
      1. Write a comment that starts the assignments section.
      2. Prompt the user for a first name and assign the entry to the firstName variable.
      3. Prompt the user for a middle initial and assign the entry to the middleInitial variable.
      4. Prompt the user for a last name and assign the entry to the lastName variable.
   3. Processing section
      1. Write a comment that starts the processing section.
      2. Create a full name string by concatenating firstName, then a space followed by the middleInitial, followed by a period and a space, and then lastName. Assign the string to the fullName variable. Do this with one JavaScript statement.
   4. Output section
      1. Write a comment that starts the output section.
      2. Write the fullName variable to the page.

> Sample Part 1 Output:

    John Q. Smith

### Your Part 1 Output:

## Part 2

### Problem Statement

> Write a program that will demonstrate concatenation versus addition. Ask the user to enter two numbers. The program will output the entered numbers, then output the results of concatenating the numbers, and then output the total of the numbers after they have been added together.

### The Program Planning Lists

- In the following pre tag, write the three planning lists based on the verbs and nouns you see in the problem statement.

    The List of Input Variables:

    The List of Output Variables:

    The Process Checklist:

> Sample Part 2 Output:

    First Number: 10
    Second Number: 25
    Concatenation: 1025
    Addition Total: 35

### Your Part 2 Output:

## Part 3

### Problem Statement

> Write a program that asks a user to enter 4 numbers. Display all entered numbers. Calculate a total by adding the first two numbers and then subtracting the last two numbers. Perform this calculation with one JavaScript statement. Output the total to the page showing all the numbers and the calculations as in the sample output.

### The Program Planning Lists

- In the following pre tag, write the three planning lists based on the verbs and nouns you see in the problem statement.

    The List of Input Variables:

    The List of Output Variables:

    The Process Checklist:

> Sample Part 3 Output:

    First Number: 50
    Second Number: 25
    Third Number: 20
    Fourth Number: 40

    50 + 25 - 20 - 40 = 15

### Your Part 3 Output:

## Submitting your work

- Zip and submit this page 3.2 Assignment 1