← Introduction to Programming

Interactive Purchase Calculator with Category-Based Pricing

You will create an interactive program that calculates the total cost of multiple purchases. Your program must:

  1. Loop to accept items until a stop word.
  2. Prompt for an item category (defined by your variant).
  3. Compute and show the item’s price using conditionals.
  4. Keep a running total.
  5. On finish, apply any discount/bonus based on total spending.
  6. Print a final receipt with: subtotal, discount/bonus (if any), final total.

Variant 1: Coffee Shop Order System

Context: You work at a coffee shop and need to create an order calculator.

Categories (drink sizes):

  • small - $3.50
  • medium - $4.50
  • large - $5.50

Stop word: done

Special offer: If the total is $20.00 or more, apply a $3.00 loyalty discount.

Sample interaction:

=== Coffee Shop Order System ===
Enter drink sizes: small, medium, or large
Type 'done' when finished ordering

Enter drink size: medium
Price: $4.50
Current total: $4.50

Enter drink size: large
Price: $5.50
Current total: $10.00

Enter drink size: small
Price: $3.50
Current total: $13.50

Enter drink size: large
Price: $5.50
Current total: $19.00

Enter drink size: medium
Price: $4.50
Current total: $23.50

Enter drink size: done

=== Order Summary ===
Subtotal: $23.50
Loyalty Discount: -$3.00
Final Total: $20.50
Thank you for your order!

Variant 2: Parking Garage Calculator

Context: You’re building a parking fee calculator for a garage.

Categories (day types):

  • weekday - $8.00 per hour
  • weekend - $6.00 per hour
  • holiday - $5.00 per hour

Stop word: done

Special offer: If the total is $50.00 or more, apply a $7.00 frequent parker discount.

Sample interaction:

=== Parking Garage Calculator ===
Enter day type: weekday, weekend, or holiday
Type 'done' when finished entering hours

Enter day type for 1 hour: weekday
Price: $8.00
Current total: $8.00

Enter day type for 1 hour: weekday
Price: $8.00
Current total: $16.00

Enter day type for 1 hour: weekend
Price: $6.00
Current total: $22.00

Enter day type for 1 hour: weekday
Price: $8.00
Current total: $30.00

Enter day type for 1 hour: weekday
Price: $8.00
Current total: $38.00

Enter day type for 1 hour: weekend
Price: $6.00
Current total: $44.00

Enter day type for 1 hour: holiday
Price: $5.00
Current total: $49.00

Enter day type for 1 hour: holiday
Price: $5.00
Current total: $54.00

Enter day type for 1 hour: done

=== Parking Summary ===
Subtotal: $54.00
Frequent Parker Discount: -$7.00
Final Total: $47.00
Thank you for parking with us!

Variant 3: Book Rental System

Context: You’re creating a rental calculator for a book rental service.

Categories (membership types):

  • student - $2.00 per book
  • regular - $4.00 per book
  • premium - $6.00 per book (includes newest releases)

Stop word: done

Special offer: If the total is $15.00 or more, apply a $2.50 bulk rental discount.

Sample interaction:

=== Book Rental System ===
Enter membership type: student, regular, or premium
Type 'done' when finished selecting books

Enter membership type: student
Price: $2.00
Current total: $2.00

Enter membership type: student
Price: $2.00
Current total: $4.00

Enter membership type: regular
Price: $4.00
Current total: $8.00

Enter membership type: premium
Price: $6.00
Current total: $14.00

Enter membership type: student
Price: $2.00
Current total: $16.00

Enter membership type: done

=== Rental Summary ===
Subtotal: $16.00
Bulk Rental Discount: -$2.50
Final Total: $13.50
Thank you for your rental!

Variant 4: Gym Class Registration System

Context: You’re creating a registration fee calculator for a fitness center’s class packages.

Categories (class levels):

  • beginner - $12.00 per class
  • intermediate - $15.00 per class
  • advanced - $18.00 per class

Stop word: done

Special offer: If the total is $60.00 or more, apply a $10.00 multi-class discount.

Sample interaction:

=== Gym Class Registration System ===
Enter class level: beginner, intermediate, or advanced
Type 'done' when finished registering

Enter class level: beginner
Price: $12.00
Current total: $12.00

Enter class level: beginner
Price: $12.00
Current total: $24.00

Enter class level: intermediate
Price: $15.00
Current total: $39.00

Enter class level: advanced
Price: $18.00
Current total: $57.00

Enter class level: beginner
Price: $12.00
Current total: $69.00

Enter class level: done

=== Registration Summary ===
Subtotal: $69.00
Multi-Class Discount: -$10.00
Final Total: $59.00
Thank you for registering!

Variant 5: Food Truck Order System

Context: You’re building an order calculator for a food truck.

Categories (food types):

  • appetizer - $5.00 per item
  • entree - $11.00 per item
  • dessert - $6.50 per item

Stop word: done

Special offer: If the total is $35.00 or more, apply a $4.50 combo deal discount.

Sample interaction:

=== Food Truck Order System ===
Enter food type: appetizer, entree, or dessert
Type 'done' when finished ordering

Enter food type: entree
Price: $11.00
Current total: $11.00

Enter food type: appetizer
Price: $5.00
Current total: $16.00

Enter food type: dessert
Price: $6.50
Current total: $22.50

Enter food type: entree
Price: $11.00
Current total: $33.50

Enter food type: dessert
Price: $6.50
Current total: $40.00

Enter food type: done

=== Order Summary ===
Subtotal: $40.00
Combo Deal Discount: -$4.50
Final Total: $35.50
Thank you for your order!

Variant 6: Car Wash Service Calculator

Context: You’re creating a pricing calculator for a car wash business.

Categories (service packages):

  • basic - $10.00 per wash
  • deluxe - $17.00 per wash
  • premium - $25.00 per wash

Stop word: done

Special offer: If the total is $45.00 or more, apply a $6.00 membership savings.

Sample interaction:

=== Car Wash Service Calculator ===
Enter service package: basic, deluxe, or premium
Type 'done' when finished selecting services

Enter service package: basic
Price: $10.00
Current total: $10.00

Enter service package: deluxe
Price: $17.00
Current total: $27.00

Enter service package: basic
Price: $10.00
Current total: $37.00

Enter service package: premium
Price: $25.00
Current total: $62.00

Enter service package: done

=== Service Summary ===
Subtotal: $62.00
Membership Savings: -$6.00
Final Total: $56.00
Thank you for choosing our service!

Variant 7: Streaming Movie Rental System

Context: You’re creating a rental calculator for a streaming service’s pay-per-view movies.

Categories (rental periods):

  • 24hour - $3.99 per rental
  • 48hour - $5.99 per rental
  • weekly - $8.99 per rental

Stop word: done

Special offer: If the total is $25.00 or more, apply a $3.50 binge watcher discount.

Sample interaction:

=== Streaming Movie Rental System ===
Enter rental period: 24hour, 48hour, or weekly
Type 'done' when finished selecting movies

Enter rental period: 24hour
Price: $3.99
Current total: $3.99

Enter rental period: 48hour
Price: $5.99
Current total: $9.98

Enter rental period: 24hour
Price: $3.99
Current total: $13.97

Enter rental period: weekly
Price: $8.99
Current total: $22.96

Enter rental period: 48hour
Price: $5.99
Current total: $28.95

Enter rental period: done

=== Rental Summary ===
Subtotal: $28.95
Binge Watcher Discount: -$3.50
Final Total: $25.45
Thank you for your rental!

Variant 8: Museum Admission Calculator

Context: You’re building an admission fee calculator for a museum with multiple exhibits.

Categories (exhibit types):

  • general - $9.00 per ticket
  • special - $14.00 per ticket
  • vip - $20.00 per ticket

Stop word: done

Special offer: If the total is $55.00 or more, apply a $8.00 group visit discount.

Sample interaction:

=== Museum Admission Calculator ===
Enter exhibit type: general, special, or vip
Type 'done' when finished selecting exhibits

Enter exhibit type: general
Price: $9.00
Current total: $9.00

Enter exhibit type: special
Price: $14.00
Current total: $23.00

Enter exhibit type: general
Price: $9.00
Current total: $32.00

Enter exhibit type: vip
Price: $20.00
Current total: $52.00

Enter exhibit type: special
Price: $14.00
Current total: $66.00

Enter exhibit type: done

=== Admission Summary ===
Subtotal: $66.00
Group Visit Discount: -$8.00
Final Total: $58.00
Thank you for visiting!

Variant 9: Laundromat Service Calculator

Context: You’re creating a pricing calculator for a laundromat’s washing machines.

Categories (machine sizes):

  • small - $4.50 per load
  • medium - $6.50 per load
  • large - $9.00 per load

Stop word: done

Special offer: If the total is $30.00 or more, apply a $4.00 frequent customer discount.

Sample interaction:

=== Laundromat Service Calculator ===
Enter machine size: small, medium, or large
Type 'done' when finished selecting loads

Enter machine size: medium
Price: $6.50
Current total: $6.50

Enter machine size: small
Price: $4.50
Current total: $11.00

Enter machine size: large
Price: $9.00
Current total: $20.00

Enter machine size: medium
Price: $6.50
Current total: $26.50

Enter machine size: small
Price: $4.50
Current total: $31.00

Enter machine size: done

=== Service Summary ===
Subtotal: $31.00
Frequent Customer Discount: -$4.00
Final Total: $27.00
Thank you for your business!

Variant 10: Pizza Shop Order System

Context: You’re creating an order calculator for a pizza restaurant.

Categories (pizza sizes):

  • personal - $7.00 per pizza
  • medium - $12.00 per pizza
  • family - $18.00 per pizza

Stop word: done

Special offer: If the total is $40.00 or more, apply a $5.00 party order discount.

Sample interaction:

=== Pizza Shop Order System ===
Enter pizza size: personal, medium, or family
Type 'done' when finished ordering

Enter pizza size: medium
Price: $12.00
Current total: $12.00

Enter pizza size: personal
Price: $7.00
Current total: $19.00

Enter pizza size: family
Price: $18.00
Current total: $37.00

Enter pizza size: personal
Price: $7.00
Current total: $44.00

Enter pizza size: done

=== Order Summary ===
Subtotal: $44.00
Party Order Discount: -$5.00
Final Total: $39.00
Thank you for your order!

Variant 11: Pet Grooming Service Calculator

Context: You’re building a pricing calculator for a pet grooming salon.

Categories (service packages):

  • bath - $15.00 per service
  • trim - $25.00 per service
  • full - $40.00 per service

Stop word: done

Special offer: If the total is $75.00 or more, apply a $12.00 multi-pet discount.

Sample interaction:

=== Pet Grooming Service Calculator ===
Enter service package: bath, trim, or full
Type 'done' when finished selecting services

Enter service package: bath
Price: $15.00
Current total: $15.00

Enter service package: trim
Price: $25.00
Current total: $40.00

Enter service package: full
Price: $40.00
Current total: $80.00

Enter service package: done

=== Service Summary ===
Subtotal: $80.00
Multi-Pet Discount: -$12.00
Final Total: $68.00
Thank you for choosing our salon!

Variant 12: Arcade Game Center Calculator

Context: You’re creating a payment calculator for an arcade’s pay-per-play games.

Categories (game types):

  • classic - $0.50 per game
  • modern - $1.50 per game
  • premium - $2.50 per game

Stop word: done

Special offer: If the total is $10.00 or more, apply a $1.50 token bonus credit.

Sample interaction:

=== Arcade Game Center Calculator ===
Enter game type: classic, modern, or premium
Type 'done' when finished playing

Enter game type: classic
Price: $0.50
Current total: $0.50

Enter game type: modern
Price: $1.50
Current total: $2.00

Enter game type: classic
Price: $0.50
Current total: $2.50

Enter game type: premium
Price: $2.50
Current total: $5.00

Enter game type: modern
Price: $1.50
Current total: $6.50

Enter game type: premium
Price: $2.50
Current total: $9.00

Enter game type: modern
Price: $1.50
Current total: $10.50

Enter game type: done

=== Game Summary ===
Subtotal: $10.50
Token Bonus Credit: -$1.50
Final Total: $9.00
Thank you for playing!