SlideShare a Scribd company logo
1 of 12
Techno71 Gadget Factory
(Using Factory Design Pattern)
Presented by
Amit Chowdhury (CS-2001047)
Md. Alve Alam Authi (CS-2001051)
Jahirul Amin Fahim (CS-2001054)
Table of Contents
• Objectives
• Background Study
• Methodology
• Implementation
• Conclusion
Objectives
1. To develop a user-friendly interface for ordering electronic devices.
2. To allow customers to customize the specifications of their chosen
devices.
3. To implement a factory method design pattern for creating different
types of gadgets.
4. To provide a seamless shopping experience for tech-savvy
individuals in Bangladesh.
Background Study
In Bangladesh, the market for electronic gadgets is expanding rapidly,
driven by factors such as increasing disposable income, rising internet
penetration, and growing consumer awareness. However, the process
of purchasing gadgets can often be cumbersome and time-consuming,
especially when it comes to customizing specifications according to
individual preferences. To address this challenge, the Techno71 Gadget
Factory project aims to provide a solution that simplifies the ordering
process and offers a wide range of customizable options for customers.
Methodology (UML Design)
Fig: UML Diagram for Techno71 Gadget Factory
Implementation (Code)
from abc import ABC, abstractmethod
class Device(ABC):
@abstractmethod
def assemble(self, specifications):
pass
class Smartphone(Device):
def assemble(self, specifications):
print("Assembling Smartphone with
specifications:")
for key, value in specifications.items():
print(f"{key}: {value}")
class Camera(Device):
def assemble(self, specifications):
print("Assembling Camera with
specifications:")
for key, value in specifications.items():
print(f"{key}: {value}")
class Laptop(Device):
def assemble(self, specifications):
print("Assembling Laptop with
specifications:")
for key, value in specifications.items():
print(f"{key}: {value}")
class Desktop(Device):
def assemble(self, specifications):
print("Assembling Desktop with specifications:")
for key, value in specifications.items():
print(f"{key}: {value}")
class Monitor(Device):
def assemble(self, specifications):
print("Assembling Monitor with specifications:")
for key, value in specifications.items():
print(f"{key}: {value}")
class DeviceFactory(ABC):
@abstractmethod
def create_device(self):
pass
class SmartphoneFactory(DeviceFactory):
def create_device(self):
return Smartphone()
class CameraFactory(DeviceFactory):
def create_device(self):
return Camera()
Implementation (Code)
class LaptopFactory(DeviceFactory):
def create_device(self):
return Laptop()
class DesktopFactory(DeviceFactory):
def create_device(self):
return Desktop()
class MonitorFactory(DeviceFactory):
def create_device(self):
return Monitor()
def order_device(factory, cart):
device = factory.create_device()
specifications = {}
if isinstance(device, Smartphone):
specifications['model'] = input("Enter
smartphone model: ")
specifications['RAM'] = input("Enter
RAM capacity: ")
specifications['storage'] =
input("Enter storage capacity: ")
elif isinstance(device, Camera):
specifications['model'] = input("Enter camera model: ")
specifications['image_sensor'] = input("Enter camera image
sensor type: ")
specifications['resolution'] = input("Enter camera resolution:
")
specifications['zoom'] = input("Enter camera zoom level: ")
specifications['body_type'] = input("Enter camera body type
(mirrorless, slr, dslr, digital): ")
elif isinstance(device, Laptop) or isinstance(device, Desktop):
specifications['model'] = input("Enter {} model:
".format("laptop" if isinstance(device, Laptop) else "desktop"))
specifications['processor'] = input("Enter processor type: ")
specifications['RAM'] = input("Enter RAM capacity: ")
specifications['storage'] = input("Enter storage capacity: ")
if isinstance(device, Desktop):
specifications['motherboard'] = input("Enter motherboard
type: ")
specifications['gpu'] = input("Enter GPU type: ")
specifications['psu'] = input("Enter PSU wattage: ")
Implementation (Code)
elif isinstance(device, Monitor):
specifications['model'] = input("Enter monitor
model: ")
specifications['size'] = input("Enter monitor
size: ")
specifications['resolution'] = input("Enter
monitor resolution: ")
specifications['refresh_rate'] = input("Enter
monitor refresh rate (Hz): ")
device.assemble(specifications)
cart.append((device.__class__.__name__,
specifications))
def display_cart(cart):
if not cart:
print("nYour cart is empty.")
else:
print("nYour Cart:")
for index, item in enumerate(cart, start=1):
print(f"{index}. {item[0]}:")
for key, value in item[1].items():
print(f" - {key}: {value}")
print()
def checkout(cart):
if not cart:
print("nYour cart is empty. Please add items
before checking out.")
else:
print("nYour Purchased Items:")
for item in cart:
print(f"{item[0]}:")
for key, value in item[1].items():
print(f" - {key}: {value}")
print()
cart.clear()
def welcome_message():
print("Welcome to Techno71 Gadget Factory!!!")
def show_menu():
print("nSelect an option:")
print("1. Buy gadget")
print("2. View Cart")
print("3. Checkout")
print("4. Exit")
Implementation (Code)
if __name__ == "__main__":
welcome_message()
cart = []
while True:
show_menu()
choice = int(input("Enter your choice: "))
if choice == 1:
print("nSelect the device you want to order:")
print("1. Smartphone")
print("2. Camera")
print("3. Laptop")
print("4. Desktop")
print("5. Monitor")
device_choice = int(input("Enter your choice: "))
if device_choice == 1:
selected_factory = SmartphoneFactory()
elif device_choice == 2:
selected_factory = CameraFactory()
elif device_choice == 3:
selected_factory = LaptopFactory()
elif device_choice == 4:
selected_factory = DesktopFactory()
elif device_choice == 5:
selected_factory = MonitorFactory()
else:
print("Invalid choice!")
continue
order_device(selected_factory, cart)
elif choice == 2:
display_cart(cart)
elif choice == 3:
checkout(cart)
elif choice == 4:
print("nThank you for visiting Techno71 Gadget Factory!")
break
else:
print("nInvalid choice! Please select again.")
Output
Fig: Output of the Implementation
Conclusion
The Techno71 Gadget Factory project aims to revolutionize the way
electronic devices are ordered and customized in Bangladesh. By
providing a user-friendly interface and implementing the factory
method design pattern, the project offers a seamless shopping
experience for tech-savvy individuals.
Thank you

More Related Content

Similar to Techno71-Gadget-Factory (Amit Chowdhury).pptx

Use of Classes and functions#include iostreamusing name.docx
 Use of Classes and functions#include iostreamusing name.docx Use of Classes and functions#include iostreamusing name.docx
Use of Classes and functions#include iostreamusing name.docx
aryan532920
 
2011 py con
2011 py con2011 py con
2011 py con
Eing Ong
 

Similar to Techno71-Gadget-Factory (Amit Chowdhury).pptx (20)

Practical Google App Engine Applications In Py
Practical Google App Engine Applications In PyPractical Google App Engine Applications In Py
Practical Google App Engine Applications In Py
 
computerscience-170129081612.pdf
computerscience-170129081612.pdfcomputerscience-170129081612.pdf
computerscience-170129081612.pdf
 
Optimization in django orm
Optimization in django ormOptimization in django orm
Optimization in django orm
 
Building a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing StrategiesBuilding a Pyramid: Symfony Testing Strategies
Building a Pyramid: Symfony Testing Strategies
 
Use of Classes and functions#include iostreamusing name.docx
 Use of Classes and functions#include iostreamusing name.docx Use of Classes and functions#include iostreamusing name.docx
Use of Classes and functions#include iostreamusing name.docx
 
Ecad final
Ecad finalEcad final
Ecad final
 
Computer science class 12 project on Super Market Billing
Computer science class 12 project on Super Market BillingComputer science class 12 project on Super Market Billing
Computer science class 12 project on Super Market Billing
 
06 win forms
06 win forms06 win forms
06 win forms
 
How to create an Angular builder
How to create an Angular builderHow to create an Angular builder
How to create an Angular builder
 
Joy of scala
Joy of scalaJoy of scala
Joy of scala
 
Titanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersTitanium Appcelerator - Beginners
Titanium Appcelerator - Beginners
 
shiny_v1.pptx
shiny_v1.pptxshiny_v1.pptx
shiny_v1.pptx
 
CS Project-Source code for shopping inventory for CBSE 12th
CS Project-Source code for shopping inventory for CBSE 12thCS Project-Source code for shopping inventory for CBSE 12th
CS Project-Source code for shopping inventory for CBSE 12th
 
Kivy Talk Python Meetup Innsbruck 2017.04.25
Kivy Talk Python Meetup Innsbruck 2017.04.25Kivy Talk Python Meetup Innsbruck 2017.04.25
Kivy Talk Python Meetup Innsbruck 2017.04.25
 
Python Manuel-R2021.pdf
Python Manuel-R2021.pdfPython Manuel-R2021.pdf
Python Manuel-R2021.pdf
 
2011 py con
2011 py con2011 py con
2011 py con
 
The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210The Ring programming language version 1.9 book - Part 99 of 210
The Ring programming language version 1.9 book - Part 99 of 210
 
Web components with Angular
Web components with AngularWeb components with Angular
Web components with Angular
 
Practical work 1
Practical work 1Practical work 1
Practical work 1
 
Need for Speed: Removing speed bumps in API Projects
Need for Speed: Removing speed bumps in API ProjectsNeed for Speed: Removing speed bumps in API Projects
Need for Speed: Removing speed bumps in API Projects
 

Recently uploaded

21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
rahulmanepalli02
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
hublikarsn
 
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSORINTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
TanishkaHira1
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 

Recently uploaded (20)

Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...
Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...
Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptx
 
Presentation on Slab, Beam, Column, and Foundation/Footing
Presentation on Slab,  Beam, Column, and Foundation/FootingPresentation on Slab,  Beam, Column, and Foundation/Footing
Presentation on Slab, Beam, Column, and Foundation/Footing
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptx
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
 
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
Call for Papers - Journal of Electrical Systems (JES), E-ISSN: 1112-5209, ind...
 
Dynamo Scripts for Task IDs and Space Naming.pptx
Dynamo Scripts for Task IDs and Space Naming.pptxDynamo Scripts for Task IDs and Space Naming.pptx
Dynamo Scripts for Task IDs and Space Naming.pptx
 
Introduction to Geographic Information Systems
Introduction to Geographic Information SystemsIntroduction to Geographic Information Systems
Introduction to Geographic Information Systems
 
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSORINTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
Signal Processing and Linear System Analysis
Signal Processing and Linear System AnalysisSignal Processing and Linear System Analysis
Signal Processing and Linear System Analysis
 
Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...
Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...
Lect.1: Getting Started (CS771: Machine Learning by Prof. Purushottam Kar, II...
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Fundamentals of Internet of Things (IoT) Part-2
Fundamentals of Internet of Things (IoT) Part-2Fundamentals of Internet of Things (IoT) Part-2
Fundamentals of Internet of Things (IoT) Part-2
 

Techno71-Gadget-Factory (Amit Chowdhury).pptx

  • 1. Techno71 Gadget Factory (Using Factory Design Pattern) Presented by Amit Chowdhury (CS-2001047) Md. Alve Alam Authi (CS-2001051) Jahirul Amin Fahim (CS-2001054)
  • 2. Table of Contents • Objectives • Background Study • Methodology • Implementation • Conclusion
  • 3. Objectives 1. To develop a user-friendly interface for ordering electronic devices. 2. To allow customers to customize the specifications of their chosen devices. 3. To implement a factory method design pattern for creating different types of gadgets. 4. To provide a seamless shopping experience for tech-savvy individuals in Bangladesh.
  • 4. Background Study In Bangladesh, the market for electronic gadgets is expanding rapidly, driven by factors such as increasing disposable income, rising internet penetration, and growing consumer awareness. However, the process of purchasing gadgets can often be cumbersome and time-consuming, especially when it comes to customizing specifications according to individual preferences. To address this challenge, the Techno71 Gadget Factory project aims to provide a solution that simplifies the ordering process and offers a wide range of customizable options for customers.
  • 5. Methodology (UML Design) Fig: UML Diagram for Techno71 Gadget Factory
  • 6. Implementation (Code) from abc import ABC, abstractmethod class Device(ABC): @abstractmethod def assemble(self, specifications): pass class Smartphone(Device): def assemble(self, specifications): print("Assembling Smartphone with specifications:") for key, value in specifications.items(): print(f"{key}: {value}") class Camera(Device): def assemble(self, specifications): print("Assembling Camera with specifications:") for key, value in specifications.items(): print(f"{key}: {value}") class Laptop(Device): def assemble(self, specifications): print("Assembling Laptop with specifications:") for key, value in specifications.items(): print(f"{key}: {value}") class Desktop(Device): def assemble(self, specifications): print("Assembling Desktop with specifications:") for key, value in specifications.items(): print(f"{key}: {value}") class Monitor(Device): def assemble(self, specifications): print("Assembling Monitor with specifications:") for key, value in specifications.items(): print(f"{key}: {value}") class DeviceFactory(ABC): @abstractmethod def create_device(self): pass class SmartphoneFactory(DeviceFactory): def create_device(self): return Smartphone() class CameraFactory(DeviceFactory): def create_device(self): return Camera()
  • 7. Implementation (Code) class LaptopFactory(DeviceFactory): def create_device(self): return Laptop() class DesktopFactory(DeviceFactory): def create_device(self): return Desktop() class MonitorFactory(DeviceFactory): def create_device(self): return Monitor() def order_device(factory, cart): device = factory.create_device() specifications = {} if isinstance(device, Smartphone): specifications['model'] = input("Enter smartphone model: ") specifications['RAM'] = input("Enter RAM capacity: ") specifications['storage'] = input("Enter storage capacity: ") elif isinstance(device, Camera): specifications['model'] = input("Enter camera model: ") specifications['image_sensor'] = input("Enter camera image sensor type: ") specifications['resolution'] = input("Enter camera resolution: ") specifications['zoom'] = input("Enter camera zoom level: ") specifications['body_type'] = input("Enter camera body type (mirrorless, slr, dslr, digital): ") elif isinstance(device, Laptop) or isinstance(device, Desktop): specifications['model'] = input("Enter {} model: ".format("laptop" if isinstance(device, Laptop) else "desktop")) specifications['processor'] = input("Enter processor type: ") specifications['RAM'] = input("Enter RAM capacity: ") specifications['storage'] = input("Enter storage capacity: ") if isinstance(device, Desktop): specifications['motherboard'] = input("Enter motherboard type: ") specifications['gpu'] = input("Enter GPU type: ") specifications['psu'] = input("Enter PSU wattage: ")
  • 8. Implementation (Code) elif isinstance(device, Monitor): specifications['model'] = input("Enter monitor model: ") specifications['size'] = input("Enter monitor size: ") specifications['resolution'] = input("Enter monitor resolution: ") specifications['refresh_rate'] = input("Enter monitor refresh rate (Hz): ") device.assemble(specifications) cart.append((device.__class__.__name__, specifications)) def display_cart(cart): if not cart: print("nYour cart is empty.") else: print("nYour Cart:") for index, item in enumerate(cart, start=1): print(f"{index}. {item[0]}:") for key, value in item[1].items(): print(f" - {key}: {value}") print() def checkout(cart): if not cart: print("nYour cart is empty. Please add items before checking out.") else: print("nYour Purchased Items:") for item in cart: print(f"{item[0]}:") for key, value in item[1].items(): print(f" - {key}: {value}") print() cart.clear() def welcome_message(): print("Welcome to Techno71 Gadget Factory!!!") def show_menu(): print("nSelect an option:") print("1. Buy gadget") print("2. View Cart") print("3. Checkout") print("4. Exit")
  • 9. Implementation (Code) if __name__ == "__main__": welcome_message() cart = [] while True: show_menu() choice = int(input("Enter your choice: ")) if choice == 1: print("nSelect the device you want to order:") print("1. Smartphone") print("2. Camera") print("3. Laptop") print("4. Desktop") print("5. Monitor") device_choice = int(input("Enter your choice: ")) if device_choice == 1: selected_factory = SmartphoneFactory() elif device_choice == 2: selected_factory = CameraFactory() elif device_choice == 3: selected_factory = LaptopFactory() elif device_choice == 4: selected_factory = DesktopFactory() elif device_choice == 5: selected_factory = MonitorFactory() else: print("Invalid choice!") continue order_device(selected_factory, cart) elif choice == 2: display_cart(cart) elif choice == 3: checkout(cart) elif choice == 4: print("nThank you for visiting Techno71 Gadget Factory!") break else: print("nInvalid choice! Please select again.")
  • 10. Output Fig: Output of the Implementation
  • 11. Conclusion The Techno71 Gadget Factory project aims to revolutionize the way electronic devices are ordered and customized in Bangladesh. By providing a user-friendly interface and implementing the factory method design pattern, the project offers a seamless shopping experience for tech-savvy individuals.