Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question
NL Can is a local can-making company that makes cans using an eco-friendly materlal. Recently a number of
new eco-friendly palnt companles have started up In the area and they have been placing large orders for
materlal used for the quantity of cans ordered, and the total cost of the order with appropriate descriptive
labels, as shown In the sample output
palnt cans In whlch to put their eco-friendly palnt. NL Can has asked you to design, Implement and test a
Python class, CanOrder, to generate order objects for cans with the following attributes (Instance varlables)
Also Include a main function to test the defined class as follows:
and class varlables.
• create 2 CanOrder objects
• print Information about each order using the special stz ) method
• change the helght of the can In the second order and print the order ID, the updated helght and the
Class variables:
• NoOfOrders Is a class varlable that keeps track of the number of orders created (Initially O):
NoOFOrders automatically Increments with each new object created, I.e., when the first object Is
created, NoO£Orders should become 1, when the second object is created, No0FOrders should
updated total cost of the order with approprlate descriptive labels
• print the total number of orders with an approprlate descriptive label
change to 2, etc.
• NextOrderNo is a class varlable, Initlalized to 100, which Is used to generate the orderiD number for
each order as a sequence of even numbers, starting with 100; I.e., the first order would have an orderiD of
100, the second order created would have an orderID of 102, etc.
Instance variables:
• orderID Is a unique number Identifylng the can order and Is set using the NextOrderNo class varlable
• quantityOrdered is the number of cans ordered (default value 0)
• rzdius is the radlus of the can In Inches (default value 0.0)
• height Is the height of the can In Inches (default value 0.0)
• handle isa True/False value Indicating If the cans In the order should have a handle (True) or not (False)
(default value False)
• print the total cost of all the orders (both orders, Including the effect of the changed helght of the second
order), with an approprlate descriptive label
Call the file contalning your class and main function, nl_cans.py.
Sample Input/output:
Order ID: 100
Also include the following methods:
a constructor method for the CanOrder class with default values for all 4 parameters (not Including the
self parameter)
• three accessor methods, one to retrieve the ID of the order, one for the radlus, and one for the helght
• two mutator methods, one to change the radlus of the can, and one to change the helght of the can
• a method called getTotalsurfacekrea to compute and return the total surface area of all cans
ordered; the formula for the surface area of a can Is: 2ar- 2arh (note: use the math library to get the
constant varlable pi and the pow function)
• a method called getTotal1cost to compute and return the total cost of the order, where the cost of the
materlal used Is half of a cent (So.005) per square centimetre of surface area and If handles are required,
then an extra fifty cents ($0.50) Is added for each can
• the speclalstr_() method to print the Information about the order Including the orderiD, the radlus
and the helght of the can, the quantity ordered, the handle optlon (True/False), the total surface area of
Can Radius: 5 cm
Can Height: 10 cm
Quantity Ordered: 100 cans
Handle Needed? False
Total Surface Area: 47123.89 =q. cm.
Total Cost: $235.62
Order ID: 102
Can Radius: 7.5 cm
Can Height: 20 cm
Quantity Ordered: 300 cans
Handle Needed? True
Total Surface Area: 388772.09 g.cm.
Total Cost: $2093.86
materlal used for the quantity of cans ordered, and the total cost of the order with appropriate descriptive
1- ... ta al.-..---.
The height of cans for Order ID 102 has been changed to 21.00.
The new cost of for Order ID 102 is $2164.55.
--
The total number of orders received was 2.
O Download
A Print
>
The tota1 cost of all orders received was $2400.17.
expand button
Transcribed Image Text:NL Can is a local can-making company that makes cans using an eco-friendly materlal. Recently a number of new eco-friendly palnt companles have started up In the area and they have been placing large orders for materlal used for the quantity of cans ordered, and the total cost of the order with appropriate descriptive labels, as shown In the sample output palnt cans In whlch to put their eco-friendly palnt. NL Can has asked you to design, Implement and test a Python class, CanOrder, to generate order objects for cans with the following attributes (Instance varlables) Also Include a main function to test the defined class as follows: and class varlables. • create 2 CanOrder objects • print Information about each order using the special stz ) method • change the helght of the can In the second order and print the order ID, the updated helght and the Class variables: • NoOfOrders Is a class varlable that keeps track of the number of orders created (Initially O): NoOFOrders automatically Increments with each new object created, I.e., when the first object Is created, NoO£Orders should become 1, when the second object is created, No0FOrders should updated total cost of the order with approprlate descriptive labels • print the total number of orders with an approprlate descriptive label change to 2, etc. • NextOrderNo is a class varlable, Initlalized to 100, which Is used to generate the orderiD number for each order as a sequence of even numbers, starting with 100; I.e., the first order would have an orderiD of 100, the second order created would have an orderID of 102, etc. Instance variables: • orderID Is a unique number Identifylng the can order and Is set using the NextOrderNo class varlable • quantityOrdered is the number of cans ordered (default value 0) • rzdius is the radlus of the can In Inches (default value 0.0) • height Is the height of the can In Inches (default value 0.0) • handle isa True/False value Indicating If the cans In the order should have a handle (True) or not (False) (default value False) • print the total cost of all the orders (both orders, Including the effect of the changed helght of the second order), with an approprlate descriptive label Call the file contalning your class and main function, nl_cans.py. Sample Input/output: Order ID: 100 Also include the following methods: a constructor method for the CanOrder class with default values for all 4 parameters (not Including the self parameter) • three accessor methods, one to retrieve the ID of the order, one for the radlus, and one for the helght • two mutator methods, one to change the radlus of the can, and one to change the helght of the can • a method called getTotalsurfacekrea to compute and return the total surface area of all cans ordered; the formula for the surface area of a can Is: 2ar- 2arh (note: use the math library to get the constant varlable pi and the pow function) • a method called getTotal1cost to compute and return the total cost of the order, where the cost of the materlal used Is half of a cent (So.005) per square centimetre of surface area and If handles are required, then an extra fifty cents ($0.50) Is added for each can • the speclalstr_() method to print the Information about the order Including the orderiD, the radlus and the helght of the can, the quantity ordered, the handle optlon (True/False), the total surface area of Can Radius: 5 cm Can Height: 10 cm Quantity Ordered: 100 cans Handle Needed? False Total Surface Area: 47123.89 =q. cm. Total Cost: $235.62 Order ID: 102 Can Radius: 7.5 cm Can Height: 20 cm Quantity Ordered: 300 cans Handle Needed? True Total Surface Area: 388772.09 g.cm. Total Cost: $2093.86 materlal used for the quantity of cans ordered, and the total cost of the order with appropriate descriptive 1- ... ta al.-..---. The height of cans for Order ID 102 has been changed to 21.00. The new cost of for Order ID 102 is $2164.55. -- The total number of orders received was 2. O Download A Print > The tota1 cost of all orders received was $2400.17.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY