Skip to main content

Section 1.12 Unit 1 Projects

90 minutes
These projects were designed by Leigh Anne Fitz of Virginia Beach City Public Schools.

Subsection 1.12.1 Project 1: Road Trip Budget Planner

A family is planning a road trip and wants to estimate fuel costs, food costs, and see if they qualify for a random travel discount. You will write code to plan their road trip budget.
Program Requirements: Ask the user for the following information and store the input into variables.
Calculate the following and store the results into variables:
  • Gallons of gas needed
  • Fuel cost
  • Total food cost
  • Total trip cost
  • Average cost per traveler
  • Whole number of gas stops (assume there will be a stop every 120 miles)
  • Remaining miles after the last full gas stop
  • Random discount between 5% and 20% (divide by 100 to convert to decimal)
  • Discounted total
Display a formatted trip summary (see sample below).
Sample output:
---------------------------------
ROAD TRIP SUMMARY
β€”------------------------------
Driver: Maria
Number of Travelers: 4
Gas Needed: 30.18 gallons
Fuel Cost: $108.35
Food Cost: $220.00
Total Cost: $328.35
Average Cost Per Traveler: $82.09
Random Discount: 14%
Discounted Cost: $282.38
Estimated Gas Stops: 8
Miles After Last Stop: 45

Activity 1.12.1.

Calculate a road trip budget from the inputs of driver name, total trip miles, vehicle miles per gallon, gas price per gallon, number of travelers, and food budget per person. Calculate the gallons of gas needed, fuel cost, total food cost, total trip cost, average cost per traveler, whole number of gas stops, remaining miles after the last full gas stop, random discount, and discounted total. Display a formatted trip summary like below. Please use the variables provided in the starting code below. Run your code at least once with the following input for autograding:
Sample input: Pat, 200, 30, 4.00, 3, 15
---------------------------------
ROAD TRIP SUMMARY
---------------------------------
Driver: Pat
Number of Travelers: 3
Gas Needed: 6.67 gallons
Fuel Cost: $26.67
Food Cost: $45.00
Total Cost: $71.67
Average Cost Per Traveler: $23.89
Random Discount: 13%
Discounted Cost: $62.35
Estimated Gas Stops: 1
Miles After Last Stop: 80.00

Subsection 1.12.2 Unit 1 Coding Project 2: Event Invitation Generator

A community center is hosting its annual Community Fun Run and wants a program that automatically creates personalized invitations and printable name badges for participants. The program should personalize the invitation using information entered by the user.
Program Requirements: Ask the user for the following information and store the input into variables.
In your code, create the following:
Display the personalized invitation and name badge (see sample below).
Sample output:
===================================
Community Fun Run Invitation
===================================
Hello Dani Garcia!
You are officially invited to the Community Fun Run
October 12 at 9:00 AM
Riverside Park
Please wear something blue and be prepared
to share your favorite hobby: painting!
Invitation Code: Chpa428
Lucky Prize Number: 57
----------------------------------
NAME BADGE
----------------------------------
COMMUNITY FUN RUN
Name: Dani Garcia
Initials: DG
City: Chicago
Badge ID: DanGar84
----------------------------------
We look forward to seeing you!

Activity 1.12.2.

Create a personalized invitation and name badge from the inputs of first name, last name, favorite hobby, favorite color, and city. Create the full name, initials, badge id, invitation code, and lucky number. Display a formatted invitation and name badge like below. Use the variables provided in the starting code below. Run it at least once with the following input for auto-grading:
Input: Dani, Garcia, painting, blue, Chicago

Sample output:
===================================
Community Fun Run Invitation
===================================
Hello Dani Garcia!
You are officially invited to the Community Fun Run
October 12 at 9:00 AM
Riverside Park
Please wear something blue and be prepared
to share your favorite hobby: painting!
Invitation Code: Chpa428
Lucky Prize Number: 57
----------------------------------
NAME BADGE
----------------------------------
COMMUNITY FUN RUN
Name: Dani Garcia
Initials: DG
City: Chicago
Badge ID: DanGar84
----------------------------------
We look forward to seeing you!
You have attempted of activities on this page.