In: Computer Science
You built your own 3D printer and intend to make a business of
printing small parts for customers. After advertising your business
on campus, you receive hundreds of emails within the span of a few
days - all of which are fellow students asking for quotes on
printing their parts. You go through all of the STL files, and
record the approximate print time, material use and cost estimates
for each as follows: Order 1: Order 2: Print Time: 43 minutes Print
Time: 28 minutes Colour: Red Colour: Blue Material: 1.64 feet
Material: 0.91 feet Cost: 3.80 $USD Cost: 2.11 $USD Order #: Print
Time: ## minutes Colour: ... Material: #### feet Cost: #.## $ USD
You've recorded each customer order as shown above and intend to
start completing orders next week. Before hand, you want to know
the total amount of time the printing will take, the total amount
of material for each colour filament that you need to have on hand
and the total material costs. Seeing as there are hundreds of
orders on file you don't want to do these calculations manually, so
you decide to use Python instead. In this assignment, you will be
completing the function definition printing(orders), which has been
started for you in the code template notebook. This function takes
in a list of strings orders, where each element in the list is one
line from the orders file, such as: orders = ["Order 1:\tPrint
Time: 43 minutes\tColour: Red\tMaterial: 1.64 feet\tCost: 3.80
$USD", "Order 2:\tPrint Time: 28 minutes \tColour: Blue \tMaterial:
0.91 feet\tCost: 2.11 $USD"] You must complete the function
definition to satisfy the following requirements: 1. The program
computes the following 3 values: a. printTime = the total print
time for all orders, stored in a list: [hours, minutes] b. matlused
= the total material used for all orders, stored in a list based on
filament color: [Red_matlused, Blue_matlused, Yellow_matlused,
White_matlused, Black_matlused). Since your filament provider is
based out of Canada, you need to provide this measurement in metres
(1 metre = 3.28 feet). c. matlCost = the total material cost in
$CAD (1 $USD = 1.42 $CAD). d. profit = your estimated profit if you
charge 0.25 SCAD/minute of printing and only account for the
material cost in your expenses (profit = revenue - expenses). 2.
The program returns print Time, matlused, matlCost, and profit as
output (done for you in the code given). 3. Your name, Maced, and
the date are given in comments in the first Python cell. 4. Your
answers to the design questions and test plan are given in the
appropriate cells in the Python notebook. 5. Your program MUST have
valid Python syntax and it must run without errors. Ensure that
your
# Date: In [ ]: ######################################--
printing(orders) ###################################### def
printing (orders): # Modify/add to the code between here...
printTime = [] matlused = [0,0,0,0,0] matlCost = 0 profit = 0 #...
and here return printTime, matlused, matlcost, profit
##########---TEST YOUR CODE---#################### # Change the
values of orderTest to test with different values orderTest =
["order 1:\tPrint Time: 43 minutes\tcolour: Red\tMaterial: 1.64
feet\tCost: 3.80 $USD", "Order 2: \tPrint Time: 28 minutes\tcolour:
Blue\tMaterial: 0.91 feet\tCost: 2.11 $USD"] result = printing
(orderTest) ############## print("printTime=" ', result[0])
print("matlused =", result[1]) print("matlCost , result[2])
print("profit=" ", result[3])
solution for the question:
output:
Let me know if you have any doubts or if you need anything to change Through comment.
If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions : )
Thank You!
====================================================================