Due Date: midnight, Friday, 14 September.

This assignment focuses on computing with numbers from Chapter 3.

Submit the following programs via Blackboard:

  1. Write a program that takes a length in yards and returns the number of miles and yards (recall that there are 1760 yards to a mile). For example, if the user entered, 2000, your program would output, 1 miles 240 yards. Note that you should use "miles" and "yards" for all inputs (even in the cases where it is grammatically incorrect).
  2. Chapter 3, #4 (lightning strike): write a program that determines the distance to a lightening strike based on the time elapsed between the flash and the sound of thunder. The speed of sound is approximately 1100 ft/sec and 1 mile is 5280 ft.
  3. Write a program that asks the user for a number and then displays a countdown from that number. That is, starts by displaying that number, then one less, and continuing until it reaches 1. Here is a sample interaction:
    Please enter a number: 5
    Blast off!
  4. Write a program to calculate how much money you would have if your money doubled every day. Your program should ask the user for the number of days and display the amount of money for each day. The starting amount of money is $1. Here is a sample interaction:
    Please enter the number of days:  8
    Day 1:  $1
    Day 2:  $2
    Day 3:  $4
    Day 4:  $8
    Day 5:  $16
    Day 6:  $32
    Day 7:  $64
    Day 8:  $128
  5. Chapter 3, #10 (ladder length): write a program to determine the length of a ladder required to reach a given height when leaned against a house. The height and angle of the ladder are given as inputs. To compute the length use: length = height/(sin angle)
    Note: the angle must be in radians. Prompt for an angle in degrees and use this formula to convert: radians = π*degrees/180
For more information on using Blackboard, see the first lab.

General Notes