Facebook
From gato, 3 Years ago, written in Python.
Embed
Download Paste or View Raw
Hits: 72
  1. amount = int(input())
  2. if amount<=0:
  3.      print("No change")
  4. else:
  5.      dollar = int(amount/100)
  6.      amount = amount % 100
  7.      quarter = int(amount/25)
  8.      amount = amount % 25
  9.      dime = int(amount/10)
  10.      amount = amount % 10
  11.      nickel = int(amount/5)
  12.      penny = amount % 5
  13.      if dollar >= 1:
  14.            if dollar == 1:
  15.                  print(str(dollar)+" Dollar")
  16.            else:
  17.                  print(str(dollar)+" Dollars")
  18.      if quarter >= 1:
  19.            if quarter == 1:
  20.                  print(str(quarter)+" Quarter")
  21.            else:
  22.                  print(str(quarter)+" Quarters")
  23.      if dime >= 1:
  24.            if dime == 1:
  25.                  print(str(dime)+" Dime")
  26.            else:
  27.                  print(str(dime)+" Dimes")
  28.      if nickel >= 1:
  29.            if nickel == 1:
  30.                  print(str(nickel)+" Nickel")
  31.            else:
  32.                  print(str(nickel)+" Nickels")
  33.      if penny >= 1:
  34.            if penny == 1:
  35.                  print(str(penny)+" Penny")
  36.            else:
  37.                  print(str(penny)+" Pennies")
  38. -------------------------------------------------------------------------------
  39. service = input('Enter desired auto service:\n')
  40. print('You entered:', service)
  41. if service == 'Oil change':
  42.     print('Cost of oil change: $35')
  43. elif service == 'Tire rotation':
  44.     print('Cost of tire rotation: $19')
  45. elif service == 'Car wash':
  46.     print('Cost of car wash: $7')
  47. else:
  48.     print('Error: Requested service is not recognized')
  49. --------------------------------------------------------------------------------
  50. print("Davy's auto shop services")
  51. print('Oil change -- $35')
  52. print('Tire rotation -- $19')
  53. print('Car wash -- $7')
  54. print('Car wax -- $12')
  55. print()
  56. service1 = input('Select first service:\n')
  57. service2 = input('Select second service:\n')
  58. print()
  59. print("Davy's auto shop invoice")
  60. print()
  61. if service1 == 'Tire rotation':
  62.     print('Service 1: Tire rotation, $19')
  63. if service1 == 'Oil change':
  64.     print('Service 1: Oil change, $35')
  65. if service1 == 'Car wash':
  66.     print('Service 1: Car wash, $7')
  67. if service1 == 'Car wax':
  68.     print('Service 1: Car wax, $12')
  69. if service1 == '-':
  70.     print('Service 1: No service')
  71. if service2 == 'Tire rotation':
  72.     print('Service 2: Tire rotation, $19')
  73. if service2 == 'Oil change':
  74.     print('Service 2: Oil change, $35')
  75. if service2 == 'Car wash':
  76.     print('Service 2: Car wash, $7')
  77. if service2 == 'Car wax':
  78.     print('Service 2: Car wax, $12')
  79. if service2 == '-':
  80.     print('Service 2: No service')
  81. print()
  82. if service1 == 'Tire rotation' and (service2 == 'Tire rotation'):
  83.     print('Total: $38')
  84. if service1 == 'Oil change' and (service2 == 'Oil change'):
  85.     print('Total: $70')
  86. if service1 == 'Car wash' and (service2 == 'Car wash'):
  87.     print('Total: $14')
  88. if service1 == 'Car wax' and (service2 == 'Car wax'):
  89.     print('Total: $24')
  90. if service1 == '-' and (service2 == '-'):
  91.     print('Total: $0')
  92. if service1 == 'Tire rotation' and (service2 == 'Oil change'):
  93.     print('Total: $54')
  94. if service1 == 'Tire rotation' and (service2 == 'Car wax'):
  95.     print('Total: $31')
  96. if service1 == 'Tire rotation' and (service2 == 'Car wash'):
  97.     print('Total: $26')
  98. if service1 == 'Tire rotation' and (service2 == '-'):
  99.     print('Total: $19')
  100. if service1 == 'Oil change' and (service2 == 'Car wash'):
  101.     print('Total: $42')
  102. if service1 == 'Oil change' and (service2 == 'Car wax'):
  103.     print('Total: $47')
  104. if service1 == 'Oil change' and (service2 == '-'):
  105.     print('Total: $35')
  106. if service1 == 'Car wash' and (service2 == 'Tire rotation'):
  107.     print('Total: $0')
  108. if service1 == 'Car wash' and (service2 == 'Oil change'):
  109.     print('Total: $0')
  110. if service1 == 'Car wash' and (service2 == 'Car wax'):
  111.     print('Total: $0')
  112. if service1 == 'Car wash' and (service2 == '-'):
  113.     print('Total: $7')
  114. if service1 == 'Car wax' and (service2 == 'Tire rotation'):
  115.     print('Total: $0')
  116. if service1 == 'Car wax' and (service2 == 'Oil change'):
  117.     print('Total: $0')
  118. if service1 == 'Car wax' and (service2 == 'Car wash'):
  119.     print('Total: $0')
  120. if service1 == 'Car wax' and (service2 == '-'):
  121.     print('Total: $12')
  122. if service1 == '-' and (service2 == 'Tire rotation'):
  123.     print('Total: $19')
  124. if service1 == '-' and (service2 == 'Oil change'):
  125.     print('Total: $35')
  126. if service1 == '-' and (service2 == 'Car wash'):
  127.     print('Total: $7')
  128. if service1 == '-' and (service2 == 'Car wax'):
  129.     print('Total: $12')
  130.