Advertisement
Guest User

Paint Program PasteBin

a guest
Jan 16th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 12.74 KB | None | 0 0
  1. import os #Imports Operating System Library
  2. import time #Imports Time Library
  3.  
  4.  
  5.  
  6. #CUSTOMER ID SECTION
  7. while True:
  8.     print ("What is your first initial?")
  9.     Initial = input ("")
  10.     if Initial.isalpha() and len(Initial) == 1: #.isalpha checks if the variable is made from letters.
  11.         print ("First Initial is " + Initial.upper()) #.upper makes the variable all capital letters.
  12.         print ("")
  13.         break
  14.     else:
  15.         print ("Please enter your first initial only")
  16.  
  17. while True :
  18.     print ("What is your Surname?")
  19.     Surname = input ("")
  20.     if Surname.isalpha():
  21.         print ("Surname is " + Surname.title()) #.title makes the variable begin with a capital letter, and then lower case letters.
  22.         print ("")
  23.         break
  24.     else:
  25.         print ("Please enter a Surname")
  26.  
  27. Customer_Name = Initial.title() + Surname.title()
  28. print ("Your customer name is " + Customer_Name)
  29. print ("")
  30. #CUSTOMER ID SECTION
  31. time.sleep(3) #time.sleep makes the program wait a specified amount of time before continuing.
  32.  
  33.  
  34.  
  35. #CLEAR DEFINITION
  36. #This section creates a definition to clear the screen.
  37. def Clear():
  38.     clear = lambda: os.system ('cls')
  39.     clear()
  40.  
  41. Clear()
  42. #CLEAR DEFINITION
  43.  
  44.  
  45.  
  46. #ADDRESS SECTION
  47. while True :
  48.     print ("What is your house number?")
  49.     House_Number = input ("")
  50.     if House_Number.isnumeric(): #.isnumeric checks if the variable is all numbers.
  51.         print("Your house number is " + House_Number)
  52.         print("")
  53.         break
  54.     else:
  55.         print ("Please enter a house number")
  56.  
  57. while True:
  58.     print ("What is the name of the road you live on? (Do not state the address suffix and don't use spaces)")
  59.     Road_Name = input("")
  60.     if Road_Name.isalpha():
  61.         print("Your road name is " + Road_Name.title())
  62.         print("")
  63.         break
  64.     else:
  65.         print("Please enter your road name")
  66.  
  67. while True:
  68.     print ("What is your address suffix?")
  69.     Address_Suffix = input("")
  70.     if Address_Suffix.isalpha():
  71.         print ("Your address suffix is " + Address_Suffix.title())
  72.         print ("")
  73.         break
  74.     else:
  75.         print ("Please enter you address suffix")
  76.  
  77. Address_Complete = House_Number + " " + Road_Name.title() + " " + Address_Suffix.title()
  78. print ("Your address is " + Address_Complete)
  79. print (" ")
  80. #ADDRESS SECTION
  81. time.sleep(3)
  82. Clear()
  83.  
  84.  
  85.  
  86. #DATE
  87. print ("What is the date today? (dd/mm/yy)")
  88. Date = input("")
  89. print ("The date today is " + Date)
  90. print (" ")
  91. #DATE
  92. time.sleep(3)
  93. Clear()
  94.  
  95.  
  96.  
  97. #CUSTOMER ID
  98. print("Your customer ID is: " + Customer_Name + Road_Name.title())
  99. #CUSTOEMER ID
  100. time.sleep(5)
  101. Clear()
  102.  
  103.  
  104.  
  105. #AREA OF WALLS
  106. #WALL 1
  107. while True:
  108.     print ("What is the height of Wall 1? (Between 2.4m and 6.0m)(DO NOT TYPE M)")
  109.     WallHeight_1 = input ("")
  110.     if WallHeight_1.isalpha():
  111.         print ("Please enter a number between 2.4m and 6.0m.")
  112.     else:
  113.         fltWallHeight_1 = float (WallHeight_1)
  114.         if fltWallHeight_1 >= 2.4 and fltWallHeight_1 <= 6.0:
  115.             print ("The height of Wall 1 is " + WallHeight_1 + "m")
  116.             print (" ")
  117.             break
  118.         else:
  119.             print ("Please enter a correct height")
  120.  
  121. while True:
  122.     print ("What is the width of Wall 1? (Between 1.0m and 25.0m)(DO NOT TYPE M)")
  123.     WallWidth_1 = input ("")
  124.     if WallWidth_1.isalpha():
  125.         print ("Please enter a number between 1.0m and 25.0m.")
  126.     else:
  127.         fltWallWidth_1 = float (WallWidth_1)
  128.         if fltWallWidth_1 >= 1.0 and fltWallWidth_1 <= 25.0:
  129.             print ("The width of Wall 1 is " + WallWidth_1 + "m")
  130.             print (" ")
  131.             break
  132.         else:
  133.             print ("Please enter a correct Width")
  134.  
  135. WallArea_1 = fltWallHeight_1 * fltWallWidth_1
  136. strWallArea_1 = str (WallArea_1)
  137. print ("The area of Wall 1 is " + format(WallArea_1, '.2f') + "m squared.")
  138. #WALL 1
  139. time.sleep(3)
  140. Clear()
  141.  
  142.  
  143.  
  144. #WALL 2
  145. while True:
  146.     print ("What is the height of Wall 2? (Between 2.4m and 6.0m)(DO NOT TYPE M)")
  147.     WallHeight_2 = input ("")
  148.     if WallHeight_2.isalpha():
  149.         print ("Please enter a number between 2.4m and 6.0m.")
  150.     else:
  151.         fltWallHeight_2 = float (WallHeight_2)
  152.         if fltWallHeight_2 >= 2.4 and fltWallHeight_2 <= 6.0:
  153.             print ("The height of Wall 2 is " + WallHeight_2 + "m")
  154.             print (" ")
  155.             break
  156.         else:
  157.             print ("Please enter a correct height")
  158.  
  159. while True:
  160.     print ("What is the width of Wall 2? (Between 1.0m and 25.0m)(DO NOT TYPE M)")
  161.     WallWidth_2 = input ("")
  162.     if WallWidth_2.isalpha():
  163.         print ("Please enter a number between 1.0m and 25.0m.")
  164.     else:
  165.         fltWallWidth_2 = float (WallWidth_2)
  166.         if fltWallWidth_2 >= 1.0 and fltWallWidth_2 <= 25.0:
  167.             print ("The width of Wall 2 is " + WallWidth_2 + "m")
  168.             print (" ")
  169.             break
  170.         else:
  171.             print ("Please enter a correct Width")
  172.  
  173. WallArea_2 = fltWallHeight_2 * fltWallWidth_2
  174. strWallArea_2 = str (WallArea_2)
  175. print ("The area of Wall 2 is " + format(WallArea_2, '.2f') + "m squared.")
  176. #WALL 2
  177. time.sleep(3)
  178. Clear()
  179.  
  180.  
  181.  
  182. #WALL 3
  183. while True:
  184.     print ("What is the height of Wall 3? (Between 2.4m and 6.0m)(DO NOT TYPE M)")
  185.     WallHeight_3 = input ("")
  186.     if WallHeight_3.isalpha():
  187.         print ("Please enter a number between 2.4m and 6.0m.")
  188.     else:
  189.         fltWallHeight_3 = float (WallHeight_3)
  190.         if fltWallHeight_3 >= 2.4 and fltWallHeight_3 <= 6.0:
  191.             print ("The height of Wall 3 is " + WallHeight_3 + "m")
  192.             print (" ")
  193.             break
  194.         else:
  195.             print ("Please enter a correct height")
  196.  
  197. while True:
  198.     print ("What is the width of Wall 3? (Between 1.0m and 25.0m)(DO NOT TYPE M)")
  199.     WallWidth_3 = input ("")
  200.     if WallWidth_3.isalpha():
  201.         print ("Please enter a number between 1.0m and 25.0m.")
  202.     else:
  203.         fltWallWidth_3 = float (WallWidth_3)
  204.         if fltWallWidth_3 >= 1.0 and fltWallWidth_3 <= 25.0:
  205.             print ("The width of Wall 3 is " + WallWidth_3 + "m")
  206.             print (" ")
  207.             break
  208.         else:
  209.             print ("Please enter a correct Width")
  210.  
  211. WallArea_3 = fltWallHeight_3 * fltWallWidth_3
  212. strWallArea_3 = str (WallArea_3)
  213. print ("The area of Wall 3 is " + format(WallArea_3, '.2f') + "m squared.")
  214. #WALL 3
  215. time.sleep(3)
  216. Clear()
  217.  
  218.  
  219.  
  220. #WALL 4
  221. while True:
  222.     print ("What is the height of Wall 4? (Between 2.4m and 6.0m)(DO NOT TYPE M)")
  223.     WallHeight_4 = input ("")
  224.     if WallHeight_4.isalpha():
  225.         print ("Please enter a number between 2.4m and 6.0m.")
  226.     else:
  227.         fltWallHeight_4 = float (WallHeight_4)
  228.         if fltWallHeight_4 >= 2.4 and fltWallHeight_4 <= 6.0:
  229.             print ("The height of Wall 4 is " + WallHeight_4 + "m")
  230.             print (" ")
  231.             break
  232.         else:
  233.             print ("Please enter a correct height")
  234.  
  235. while True:
  236.     print ("What is the width of Wall 4? (Between 1.0m and 25.0m)(DO NOT TYPE M)")
  237.     WallWidth_4 = input ("")
  238.     if WallWidth_4.isalpha():
  239.         print ("Please enter a number between 1.0m and 25.0m.")
  240.     else:
  241.         fltWallWidth_4 = float (WallWidth_4)
  242.         if fltWallWidth_4 >= 1.0 and fltWallWidth_4 <= 25.0:
  243.             print ("The width of Wall 4 is " + WallWidth_4 + "m")
  244.             print (" ")
  245.             break
  246.         else:
  247.             print ("Please enter a correct Width")
  248.  
  249. WallArea_4 = fltWallHeight_4 * fltWallWidth_4
  250. strWallArea_4 = str (WallArea_4)
  251. print ("The area of Wall 4 is " + format(WallArea_4, '.2f') + "m squared.")
  252. #WALL 4
  253. time.sleep(3)
  254. Clear()
  255.  
  256.  
  257.  
  258. #AREA
  259. WallsArea = WallArea_1 + WallArea_2 + WallArea_3 + WallArea_4
  260. strWallsArea = str (WallsArea)
  261. print ("The area of all the walls is " + format(WallsArea, '.2f') + "m squared.")
  262. #AREA
  263. time.sleep(3)
  264. Clear()
  265. #AREA OF WALLS FINISHED
  266.  
  267.  
  268.  
  269. #AREA OF WINDOW
  270. while True:
  271.     print ("What is the height of the Window? (Between 0.9m and 1.5m)(DO NOT TYPE M)")
  272.     WindowHeight = input ("")
  273.     if WindowHeight.isalpha():
  274.         print ("Please enter a number between 0.9m and 1.5m")
  275.     else:
  276.         fltWindowHeight = float (WindowHeight)
  277.         if fltWindowHeight >= 0.9 and fltWindowHeight <= 1.5:
  278.             print ("The height of the Window is " + format(fltWindowHeight, '.2f') + "m")
  279.             print (" ")
  280.             break
  281.         else:
  282.             print ("Please enter a correct height")
  283.  
  284. while True:
  285.     print ("What is the width of the Window? (Between 0.9m and 2.0m)(DO NOT TYPE M)")
  286.     WindowWidth = input ("")
  287.     if WindowWidth.isalpha():
  288.         print ("Please enter a number between 0.9m and 2.0m.")
  289.     else:
  290.         fltWindowWidth = float (WindowWidth)
  291.         if fltWindowWidth >= 0.9 and fltWindowWidth <= 2.0:
  292.             print ("The width of the Window is " + format(fltWindowWidth, '.2f') + "m")
  293.             print (" ")
  294.             break
  295.         else:
  296.             print ("Please enter a correct Width")
  297.  
  298. WindowArea = fltWindowHeight * fltWindowWidth
  299. strWindowArea = str (WindowArea)
  300. print ("The area of the Window is " + format(WindowArea, '.2f') + "m squared.")
  301. #AREA OF WINDOW
  302. time.sleep(3)
  303. Clear()
  304.  
  305.  
  306.  
  307. #AREA
  308. RemoveArea = WindowArea
  309. PaintArea = WallsArea - RemoveArea
  310. strPaintArea = str(PaintArea)
  311. print ("The area of the walls is " + format(WallsArea, '.2f') + "m squared")
  312. time.sleep(2)
  313. print ("The area of the window is " + format(WindowArea, '.2f') + "m squared")
  314. time.sleep(2)
  315. print (" ")
  316. print (" ")
  317. print ("The area of what needs to be painted is " + format(PaintArea, '.2f') + "m squared")
  318. #AREA
  319. time.sleep(3)
  320. Clear()
  321.  
  322.  
  323.  
  324. #PAINT
  325. Luxury_Paint = 1.75
  326. Standard_Paint = 1.00
  327. Economy_Paint = 0.80
  328.  
  329. print ("Luxury paint is £1.75 per square metre.")
  330. print ("Standard paint is £1.00 per square metre.")
  331. print ("Economy paint is £0.80 per square metre.")
  332. print (" ")
  333.  
  334. while True:
  335.     print ("What type of paint is required? (Please enter Luxury, Standard or Economy)")
  336.     Required_Paint = input ("")
  337.     if Required_Paint.lower() == "luxury":
  338.         PaintTypePrice = Luxury_Paint
  339.         break
  340.     elif Required_Paint.lower() == "standard":
  341.         PaintTypePrice = Standard_Paint
  342.         break
  343.     elif Required_Paint.lower() == "economy":
  344.         PaintTypePrice = Economy_Paint
  345.         break
  346.     else:
  347.         print ("Please enter a correct paint type.")
  348.  
  349. strRequired_Paint = str(Required_Paint)
  350. strPaintTypePrice = str(PaintTypePrice)
  351.  
  352. print (" ")
  353. print ("The type of paint required is " + strRequired_Paint.title() + " and this costs £" + strPaintTypePrice + " per square metre.")
  354. print (" ")
  355. Full_Price = PaintTypePrice * PaintArea
  356. strFull_Price = str(Full_Price)
  357. print ("The price of the amount of " + strRequired_Paint.title() + " paint required to paint the walls is £" + format(Full_Price, '.2f'))
  358. #PAINT
  359. time.sleep(3)
  360. Clear()
  361.  
  362.  
  363.  
  364. #UNDERCOAT
  365. Undercoat = 0.45
  366.  
  367. while True:
  368.     print ("Is an Undercoat required?")
  369.     Undercoat_Required = input ("")
  370.     if Undercoat_Required.lower() == "yes":
  371.         Undercoat_Price = Undercoat * PaintArea
  372.         strUndercoat_Price = str(Undercoat_Price)
  373.         print (" ")
  374.         print ("The full price of the undercoat will be £" + format(Undercoat_Price, '.2f'))
  375.         Full_Price2 = Full_Price + Undercoat_Price
  376.         strFull_Price2 = str(Full_Price2)
  377.         print ("The full price is now £" + format(Full_Price2, '.2f'))
  378.         break
  379.     elif Undercoat_Required.lower() == "no":
  380.         Undercoat_Price = 0
  381.         Full_Price2 = Full_Price + Undercoat_Price
  382.         strFull_Price2 = str(Full_Price2)
  383.         strUndercoat_Price = str(Undercoat_Price)
  384.         break
  385.     else:
  386.         print ("Please enter Yes or No.")
  387. #UNDERCOAT
  388. time.sleep(3)
  389. Clear()
  390.  
  391.  
  392.  
  393. #FILE CREATING
  394. #This section creates a document and adds the users information.
  395. def filemake():
  396.     file = Customer_Name+Road_Name
  397.     Info = open(file+'.txt', 'a')
  398.     Info.write(Customer_Name + '\n')
  399.     Info.write(Address_Complete + '\n')
  400.     Info.write(Date + '\n')
  401.     Info.write("Undercoat: " + Undercoat_Required.title() + '\n')
  402.     Info.write("Undercoat price: £" + format(Undercoat_Price, '.2f') + '\n')
  403.     Info.write("Paint type: " + Required_Paint.title() + '\n')
  404.     Info.write("Paint price: £" + format(Full_Price, '.2f') + '\n')
  405.     Info.write("Overall price: £" + format(Full_Price2, '.2f') + '\n')
  406.     Info.write('\n')
  407.     Info.close()
  408.  
  409. filemake()
  410. #FILE CREATING
  411.  
  412. #FINAL INFO
  413. print ("FINAL INFORMATION")
  414. time.sleep(1)
  415. print ("Undercoat price = £" + format(Undercoat_Price, '.2f'))
  416. time.sleep(1)
  417. print ("Overcoat price = £" + format(Full_Price, '.2f'))
  418. time.sleep(1)
  419. print ("Final price = £" + format (Full_Price2, '.2f'))
  420. time.sleep(3)
  421. print ("Ending the program in...")
  422. time.sleep(0.5)
  423. print ("3")
  424. time.sleep(1)
  425. print ("2")
  426. time.sleep(1)
  427. print ("1")
  428. time.sleep(1)
  429. exit()
  430. #FINAL INFO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement