Skip to content

Commit

Permalink
Laundary System in Python
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCodYrohit committed May 12, 2024
1 parent f06386d commit 54c4b12
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 0 deletions.
91 changes: 91 additions & 0 deletions Laundary System/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Laundry Service Class

## Overview
The LaundryService class is designed to manage customer details and calculate charges for a cloth and apparel cleaning service. It provides methods to create customer-specific instances, print customer details, calculate charges based on cloth type, branding, and season, and print final details including the expected day of return.

## Class Structure
### Methods
1. `__init__(name, contact, email, cloth_type, branded, season)`: Initializes a new customer instance with the provided details and assigns a unique customer ID.
- Parameters:
- `name`: String, name of the customer.
- `contact`: Numeric (integer), contact number of the customer.
- `email`: Alphanumeric (string), email address of the customer.
- `cloth_type`: String, type of cloth deposited (Cotton, Silk, Woolen, or Polyester).
- `branded`: Boolean (0 or 1), indicating whether the cloth is branded.
- `season`: String, season when the cloth is deposited (Summer or Winter).

2. `customerDetails()`: Prints out the details of the customer, including name, contact number, email, cloth type, and whether the cloth is branded.

3. `calculateCharge()`: Calculates the charge based on the type of cloth, branding, and season.
- Returns:
- Numeric, total charge for cleaning the cloth.

4. `finalDetails()`: Calls `customerDetails()` and `calculateCharge()` methods within itself and prints the total charge and the expected day of return.
- Prints:
- Total charge in Rupees.
- Expected day of return (4 days if total charge > 200, otherwise 7 days).

## Example Usage
```python
# Example usage:
name = input("Enter customer name: ")
contact = int(input("Enter contact number: "))
email = input("Enter email address: ")
cloth_type = input("Enter cloth type (Cotton/Silk/Woolen/Polyester): ")
branded = bool(int(input("Is the cloth branded? (Enter 0 for No, 1 for Yes): ")))
season = input("Enter season (Summer/Winter): ")

customer = LaundryService(name, contact, email, cloth_type, branded, season)
customer.finalDetails()


markdown
Copy code
# Laundry Service Class

## Overview
The LaundryService class is designed to manage customer details and calculate charges for a cloth and apparel cleaning service. It provides methods to create customer-specific instances, print customer details, calculate charges based on cloth type, branding, and season, and print final details including the expected day of return.

## Class Structure
### Methods
1. `__init__(name, contact, email, cloth_type, branded, season)`: Initializes a new customer instance with the provided details and assigns a unique customer ID.
- Parameters:
- `name`: String, name of the customer.
- `contact`: Numeric (integer), contact number of the customer.
- `email`: Alphanumeric (string), email address of the customer.
- `cloth_type`: String, type of cloth deposited (Cotton, Silk, Woolen, or Polyester).
- `branded`: Boolean (0 or 1), indicating whether the cloth is branded.
- `season`: String, season when the cloth is deposited (Summer or Winter).

2. `customerDetails()`: Prints out the details of the customer, including name, contact number, email, cloth type, and whether the cloth is branded.

3. `calculateCharge()`: Calculates the charge based on the type of cloth, branding, and season.
- Returns:
- Numeric, total charge for cleaning the cloth.

4. `finalDetails()`: Calls `customerDetails()` and `calculateCharge()` methods within itself and prints the total charge and the expected day of return.
- Prints:
- Total charge in Rupees.
- Expected day of return (4 days if total charge > 200, otherwise 7 days).

## Example Usage
```python
# Example usage:
name = input("Enter customer name: ")
contact = int(input("Enter contact number: "))
email = input("Enter email address: ")
cloth_type = input("Enter cloth type (Cotton/Silk/Woolen/Polyester): ")
branded = bool(int(input("Is the cloth branded? (Enter 0 for No, 1 for Yes): ")))
season = input("Enter season (Summer/Winter): ")

customer = LaundryService(name, contact, email, cloth_type, branded, season)
customer.finalDetails()
Usage Instructions
Create an instance of the LaundryService class by providing customer details as parameters to the constructor.
Use the finalDetails() method to print the customer details along with the calculated charge and expected day of return.


Contributors
(Rohit Raj)[https://github.com/MrCodYrohit]


75 changes: 75 additions & 0 deletions Laundary System/code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
id=1
class LaundryService:
def __init__(self,Name_of_customer,Contact_of_customer,Email,Type_of_cloth,Branded,Season,id):
self.Name_of_customer=Name_of_customer
self.Contact_of_customer=Contact_of_customer
self.Email=Email
self.Type_of_cloth=Type_of_cloth
self.Branded=Branded
self.Season=Season
self.id=id

def customerDetails(self):
print("The Specific Details of customer:")
print("customer ID: ",self.id)
print("customer name:", self.Name_of_customer)
print("customer contact no. :", self.Contact_of_customer)
print("customer email:", self.Email)
print("type of cloth", self.Type_of_cloth)
if self.Branded == 1:
a=True
else:
a=False
print("Branded", a)
def calculateCharge(self):
a=0
if self.Type_of_cloth=="Cotton":
a=50.0
elif self.Type_of_cloth=="Silk":
a=30.0
elif self.Type_of_cloth=="Woolen":
a=90.0
elif self.Type_of_cloth=="Polyester":
a=20.0
if self.Branded==1:
a=1.5*(a)
else:
pass
if self.Season=="Winter":
a=0.5*a
else:
a=2*a
print(a)
return a
def finalDetails(self):
self.customerDetails()
print("Final charge:",end="")
if self.calculateCharge() >200:
print("to be return in 4 days")
else:
print("to be return in 7 days")
while True:
name=input("Enter the name: ")
contact=int(input("Enter the contact: "))
email=input("Enter the email: ")
cloth=input("Enter the type of cloth: ")
brand=bool(input("Branded ? "))
season=input("Enter the season: ")
obj=LaundryService(name,contact,email,cloth,brand,season,id)
obj.finalDetails()
id=id+1
z=input("Do you want to continue(Y/N):")
if z=="Y":
continue
elif z =="N":
print("Thanks for visiting!")
break
else:
print("Select valid option")







0 comments on commit 54c4b12

Please sign in to comment.