Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Define the computer models, prices, and specifications in separate lists
- computermodels = ["Home Basic", "Office", "Gamer", "Studio"]
- computerprices = [900, 1200, 1500, 2200]
- computerspecs = [
- "4GB RAM, Built-in Graphics, 20” Monitor",
- "8GB RAM, Built-in Graphics, 23” Monitor",
- "16GB RAM, 4GB Nvidia Graphics, 27” Monitor",
- "16GB RAM, 4GB Quadro Graphics, Dual 23” Monitors"
- ]
- # Define a procedure to display the banner
- def jcbanner():
- print("Welcome to Jim's Computer Store")
- print("=================================")
- # Input customer's name and age
- customername = input("Enter your name: ")
- customerage = int(input("Enter your age: "))
- # Check if the customer is eligible to purchase
- if customerage < 18:
- print(f"Sorry, {customername}, you need to keep saving and come in store.")
- else:
- # Input the desired computer price and available money
- desiredprice = float(input("Enter the computer price you want: $"))
- availablemoney = float(input("Enter the amount of money you have: $"))
- # Display the banner again
- jcbanner()
- if availablemoney >= desiredprice:
- print(f"Congratulations, {customername}! You have enough money to make the purchase.")
- print("Please come in store to complete your purchase.")
- else:
- print(f"Sorry, {customername}, you do not have enough money.")
- if customerage >= 18:
- print("We can offer you financing options. Please come in store for more information.")
- else:
- print("You need to keep saving and then come in store.")
- # Display the computer specifications
- print("\nComputer Specifications:")
- for i in range(len(computer_models)):
- print(f"{computer_models[i]}: ${computer_prices[i]} - {computer_specs[i]}")
- Make sure to test the program with different ages and cash amounts to ensure it works as expected.
Advertisement
Add Comment
Please, Sign In to add comment