HTTP/1.0 200 OK Content-type: text/html How To -- Variables

,6/2 11:9 CDT,Due date-->9/20/2004 10:00 CDT

    How To Program

    The steps in programming are as follows:

    1. Identify variables. Always use variable names from the problem description.
    2. Identify data types used.
    3. Create two examples of input values and the expected output.
    4. Solve one simple problem at a time.
    5. Try your two examples to test for correctness.

    This test covers Steps One and Two.

    A car salesman is paid a commission of 3% of the sales price of a car.
  1. List the variables.

  2. What are the input variables?

  3. What are the data types of the variables?

  4. Read an hour value in military time and a minute value. Output an am/pm value. Example 13 42 == 1:42pm
  5. List the variables.

  6. What are the input variables?

  7. What are the data types of the variables?

  8. Read a temperature value in Centigrade and output the Fahrenheit equivalent. The formula is Fahrenheit=Centigrade x 9/5 + 32
  9. List the variables.

  10. What are the input variables?

  11. What are the data types of the variables?

  12. Read a month name and print the number of days in that month.
  13. List the variables.

  14. What are the input variables?

  15. What are the data types of the variables?

  16. Read a month, day, and year number then print the date. For example, 7 12 2003 would output July 12 2003
  17. List the variables.

  18. What are the input variables?

  19. What are the data types of the variables?

  20. Read two numbers and check if the first is a factor of the second. For example, 6 12 would output True; 3 7 False; 12 6 False
  21. List the variables.

  22. What are the input variables?

  23. What are the data types of the variables?

  24. Read the lengths of two sides of a right triangle. Output the length of the hypotenuse as the square root of the sum of the squares of the other two sides.
  25. List the variables.

  26. What are the input variables?

  27. What are the data types of the variables?

  28. Read a purchase price (less than $10 and a multiple of 25 cents) and assume the customer pays with a $10 bill. Make change with only $1 and quarters. For example, 7.75 would output $2 1 quarters
  29. List the variables.

  30. What are the input variables?

  31. What are the data types of the variables?