7f

jims computers

7f
Nov 4th, 2023
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1.  
  2. # Define the computer models, prices, and specifications in separate lists
  3. computermodels = ["Home Basic", "Office", "Gamer", "Studio"]
  4. computerprices = [900, 1200, 1500, 2200]
  5. computerspecs = [
  6. "4GB RAM, Built-in Graphics, 20” Monitor",
  7. "8GB RAM, Built-in Graphics, 23” Monitor",
  8. "16GB RAM, 4GB Nvidia Graphics, 27” Monitor",
  9. "16GB RAM, 4GB Quadro Graphics, Dual 23” Monitors"
  10. ]
  11.  
  12. # Define a procedure to display the banner
  13. def jcbanner():
  14. print("Welcome to Jim's Computer Store")
  15. print("=================================")
  16.  
  17. # Input customer's name and age
  18. customername = input("Enter your name: ")
  19. customerage = int(input("Enter your age: "))
  20.  
  21. # Check if the customer is eligible to purchase
  22. if customerage < 18:
  23. print(f"Sorry, {customername}, you need to keep saving and come in store.")
  24. else:
  25. # Input the desired computer price and available money
  26. desiredprice = float(input("Enter the computer price you want: $"))
  27. availablemoney = float(input("Enter the amount of money you have: $"))
  28.  
  29. # Display the banner again
  30. jcbanner()
  31.  
  32. if availablemoney >= desiredprice:
  33. print(f"Congratulations, {customername}! You have enough money to make the purchase.")
  34. print("Please come in store to complete your purchase.")
  35. else:
  36. print(f"Sorry, {customername}, you do not have enough money.")
  37. if customerage >= 18:
  38. print("We can offer you financing options. Please come in store for more information.")
  39. else:
  40. print("You need to keep saving and then come in store.")
  41.  
  42. # Display the computer specifications
  43. print("\nComputer Specifications:")
  44. for i in range(len(computer_models)):
  45. print(f"{computer_models[i]}: ${computer_prices[i]} - {computer_specs[i]}")
  46.  
  47. 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