Introduction To Programming
10-152-310

Learning Plan 2 : Variables and Data Types

Student

  • Name:
  • Section:
  • Email:

Part 1

  • Open this file in your browser and Microsoft Visual Studio
  • Add your name, section, and email
  • After the line: PART 1: YOUR CODE STARTS AFTER THIS LINE:
    • Create a variable that will hold a price.
    • Prompt the user to enter a price and put the entered value into the price variable.
    • Convert the entered value into a number with the Number() function and store the number value into the price variable.
    • Write the number to the page with some text preceding it.
  • Sample output:
    You entered: 25

Your Part 1 Output:

        
        

Part 2

  • After the line: PART 2: YOUR CODE STARTS AFTER THIS LINE:
    • Create variables for the following data:
      • a price
      • a second price
      • a total price
    • Prompt the user for each price and store the entered values in the variables.
    • Convert each entered value into a number with the Number() function.
    • Add the first price to the second price and put the result in the total variable.
    • Display each entered price to the page with some text preceding it.
    • Display the total to the page with some descriptive text.
  • Sample output:
    The first price: 4.99
    The second price: 1.99
    The total price: 6.98

Your Part 2 Output:

			
        

Part 3

  • After the line: PART 3: YOUR CODE STARTS AFTER THIS LINE:
    • Create the following variables:
      • numberOne
      • numberTwo
      • numberThree
      • total
      • average
    • Prompt the user to enter three numbers and store them in the three number variables.
    • Convert each entered value into a number with the Number() function.
    • Add the three number variables together and put the results into the total variable.
    • Calculate the average of the three numbers by dividing the total variable by the number 3. Put the results into the average variable.
    • Display each entered number to the page with some text preceding it.
    • Display the total to the page with some descriptive text.
    • Display the average to the page with some descriptive text.
  • Sample output:
    The first number: 10
    The second number: 15
    The third number: 25
    The total: 50
    The average: 16.666666666666668
        

Your Part 3 Output: