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

Learning Plan 6 6.1 Assignment 2

# 6.1 Assignment 2

#### File: /Learning Plan 6/6.1assignment2.html

### Student

- Name:
- Section:
- Email:

## Part 1

1. Open this file in Firefox and Microsoft Visual Studio.
2. Add your name, section, and email
3. Open the file "/Learning Plan 6/jsFiles/6.1assignment2.js"
4. Locate the function named "assignment61_2Part1()".
5. Add code after the line: `// PART 1: YOUR CODE STARTS AFTER THIS LINE:` to complete the exercise.

### Part 1 Problem Statement

> Write a program that asks a user to enters pairs of numbers until they enter "quit". As each pair of numbers is entered and validated, add the numbers using a function. The function will have two parameters for the pair of numbers and will return the sum. After the user enters "quit", output all the pairs of numbers and their sums.

- Sample Part 1 Output:

Entries | Sum
2 | 3 | 5
20 | 40 | 60
5 | 12 | 17

### Your Part 1 Output:

## Part 2

1. Locate the function named "assignment61_2Part2()".
2. Add code after the line: `// PART 2: YOUR CODE STARTS AFTER THIS LINE:` to complete the exercise.

### Part 2 Problem Statement

> Write a program that asks a user to enter a string. Output the following for the entered string.

> - the original string.
> - the length of the string with: `string.length`.
> - the string in all uppercase letters with: `string.toUpperCase()`.
> - the string in all lowercase letters with: `string.toLowerCase()`.
> - the location of the first space in the string or the string "no spaces" with: `string.indexOf(" ")`. This functions returns `-1` of the search string is not present.

> Use a function to perform the calculations and return the formatted output string. Format the output with HTML tags.

- Sample Part 2 Output:

Entered String: "Hi, this is my string."

Length: 22

Uppercase: "HI, THIS IS MY STRING."

Lowercase: "hi, this is my string."

Location of first space: 3

### Part 2 Program Planning Lists

- Add your planning lists to the JavaScript code.

### Part 2 Test Plan

- Add your test plan to the JavaScript code.

### Part 2 Algorithms

- Add your algorithms to each function.

### Your Part 2 Output:

### Submitting your work

- Zip and submit 6.1 Assignment 2
- Don't forget to also zip and submit your JavaScript file 6.1assignment2.js.
- Make sure that both files are zipped and submitted together.