Family Vacation

Write the programs in Python. Save your programs in 530/lab3 directory as lab31.py, lab32.py, lab33.py, lab34.py, and lab35.py.

  1. Two families meet at a park for a picnic. At the end of the day one family travels east at an average speed of 42 miles per hour and the other travels west at an average speed of 50 miles per hour. Both families have approximately 160 miles to travel.
    1. Find the time it takes each family to get home.
    2. Find the time that will have elapsed when they are 100 miles apart.
    3. Find the distance the eastbound family has to travel after the westbound family has arrived home.
  2. Mary needs to calculate the distance between two points in the Cartesian coordinate system. Each point in the system is represented by a pair of real values denoted by (x, y). Write a program to help her find the distance between two points. The program first reads two points; then it calculates and prints the distance between these two points. A sample run of the program looks like:

Enter the x value of the first point: 2.0

Enter the y value of the first point: -1.0

Enter the x value of the second point: 5.0

Enter the y value of the second point: 3.0

The distance between (2.0, -1.0) and (5.0, 3.0) is 5.0.

3. Bi-City Decor has a special sale on its top-of-the-line carpet. Mr. Woods wants to buy a piece of carpet to cover a floor. The store charges for stitching the sides of a piece of carpet. The tax rate is 7.5 percent. Write a program to read the sale price of the carpet ($ per square yard), the length and the width of the floor (in feet), and the stitching fee for each linear foot. Compute and print the cost of the carpet, stitching cost, sales tax, and amount due for Mr. Woods if he decides to buy the carpet from the store? Display the result to 2 decimal places. A sample run is given below:

Enter the cost of carpet per square yard: 12.00

Enter the length of the carpet (in feet): 20.00

Enter the width of the carpet (in feet): 4.50

Enter the stitching fee per linear foot: 1.00

The cost of the carpet = 120.00

The stitching fee = 49.00

Sales tax = 10.84

Amount due = 155.34

4. Julie works at the check-out counter at one of Wal-mart stores. Handing changes (the amount less than a dollar in coins) back to customers is not a trivial chore to her. You are asked to write a program to help her out. The program prompts for an integer that represents the amount of change (in cents) to be handed back to a customer. The program then determines and prints the minimum number of half dollars, quarters, dimes, nickels, and pennies that will make the correct change. A sample run of the program is given below:

Enter change [0..99]: 83

The minimum number of coins to return 83 cents are

Half(ves): 1

Quarter(s): 1

Dime(s): 0

Nickel(s): 1

Penny(ies): 3

Hint: Start with the coin with highest value and work all the way down to the coin with the lowest value.

Need help with this assignment or a similar one? Place your order and leave the rest to our experts!

Quality Assured!

Always on Time

Done from Scratch.