Introduction To Programming
10-152-310

Learning Plan 3 : Math and Operators

Student

  • Name:
  • Section:
  • Email:

Part 1

  1. Open this file in your browser and Microsoft Visual Studio
  2. Add your name, section, and email
  3. 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. Something like "// Variable declarations" would work!
      2. Create a variable named enteredNumber that will hold a number.
    2. Processing section
      1. Write a comment that starts this section.
      2. Prompt the user to enter a number and assign the entered value to the enteredNumber variable.
      3. Convert the entered value to a number and assign the number to the enteredNumber variable.
      4. Display the contents of the enteredNumber variable on the page with accompanying text.
      5. Prompt the user for a number again. Assign the new entered value to the enteredNumber variable.
      6. Convert the entered value to a number and, once again, assign it to the enteredNumber variable.
      7. Finally, display the enteredNumber variable on the page with some different accompanying text.

Sample Part 1 Output:

        You entered the number: 1234
        Then you entered the number: 4321
        

Your Part 1 Output:


        

Part 2

  1. Add code after the line: // PART 2: 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 that will hold a name.
      3. Create a variable that will hold a number.
      4. Create a variable that will hold a second number.
      5. Create a variable that will hold a total.
    2. Assignments section
      1. Write a comment that starts the assignments section.
      2. Assign the value "Fred" to the name variable.
      3. Assign the number 10 to the first number variable.
      4. Assign the number 20 to the second number variable.
    3. Calculation section
      1. Write a comment that starts the calculation section.
      2. Add the two number variables and assign the results to the total variable.
    4. Output section
      1. Write a comment that starts the output section.
      2. Display all the variables on the page each on their own line with labeling text.

Sample Part 2 Output:

        Name: Fred
        First number: 10
        Second number: 20
        Total: 30

Your Part 2 Output: