Task 6 Implement the design of the Laptop class so that the following output is| produced [You are not allowed to change the code below] Output Lenovo 5 # Write your code here lenovo = Laptop("Lenovo", 5); dell = Laptop("Dell", 7); print(lenovo.name, lenovo.count) print(dell.name, dell.count) print("Total number of Laptops", Laptop.laptopCount) Laptop.advantage() Laptop.resetCount() print("Total number of Laptops", Laptop.laptopCount) Dell 7 Total number of Laptops 12 Laptops are portable Total number of Laptops 0

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Answer in pyhton

Task 6
Implement the design of the Laptop class so that the following output is|
produced [You are not allowed to change the code below]
# Write your code here
Output
Lenovo 5
lenovo = Laptop("Lenovo", 5);
dell = Laptop("Dell", 7);
print(lenovo.name, lenovo.count)
print(dell.name, dell.count)
print("Total number of Laptops",
Laptop.laptopCount) Laptop.advantage()
Laptop.resetCount()
print("Total number of Laptops", Laptop.laptopCount)
Dell 7
Total number of Laptops 12
Laptops are portable
Total number of Laptops 0
Transcribed Image Text:Task 6 Implement the design of the Laptop class so that the following output is| produced [You are not allowed to change the code below] # Write your code here Output Lenovo 5 lenovo = Laptop("Lenovo", 5); dell = Laptop("Dell", 7); print(lenovo.name, lenovo.count) print(dell.name, dell.count) print("Total number of Laptops", Laptop.laptopCount) Laptop.advantage() Laptop.resetCount() print("Total number of Laptops", Laptop.laptopCount) Dell 7 Total number of Laptops 12 Laptops are portable Total number of Laptops 0
Design Cat class for the following code to get the output as shown.
You have already solved this problem in assignment 4 using constructor overloading.
Now, solve this again but this time DO NOT USE CONSTRUCTOR OVERLOADING.
Hint: You will have to use classmethods.
[You are not allowed to change the code below]
Output:
Total number of cats: 0
# Write your code here
print("Total number of cats:",
== White cat is sitting
Black cat is sitting
Brown cat is jumping
Red cat is purring
Grey cat is playing
Blue cat is sitting
Purple cat is jumping
Cat.Number_of_cats) c1 = Cat.no_parameter()
c2 = Cat.first_parameter("Black")
c3 = Cat("Brown", "jumping")
c4 = Cat("Red", "purring")
c5 = Cat.second_parameter("playing")
%==")
print("==
c1.printCat()
== Total number of cats: 5
c2.printCat()
c3.printCat()
c4.printCat()
c5.printCat()
c1.changeColor("Blue")
c3.changeColor("Purple")
c1.printCat()
c3.printCat()
print("=
print("Total number of cats:", Cat.Number_of_cats)
======")
Transcribed Image Text:Design Cat class for the following code to get the output as shown. You have already solved this problem in assignment 4 using constructor overloading. Now, solve this again but this time DO NOT USE CONSTRUCTOR OVERLOADING. Hint: You will have to use classmethods. [You are not allowed to change the code below] Output: Total number of cats: 0 # Write your code here print("Total number of cats:", == White cat is sitting Black cat is sitting Brown cat is jumping Red cat is purring Grey cat is playing Blue cat is sitting Purple cat is jumping Cat.Number_of_cats) c1 = Cat.no_parameter() c2 = Cat.first_parameter("Black") c3 = Cat("Brown", "jumping") c4 = Cat("Red", "purring") c5 = Cat.second_parameter("playing") %==") print("== c1.printCat() == Total number of cats: 5 c2.printCat() c3.printCat() c4.printCat() c5.printCat() c1.changeColor("Blue") c3.changeColor("Purple") c1.printCat() c3.printCat() print("= print("Total number of cats:", Cat.Number_of_cats) ======")
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY