Skip to content

Commit 2731d2e

Browse files
Merge pull request #2190 from MrCodYrohit/master
Added Laundary System in Python
2 parents 240add2 + c0ef989 commit 2731d2e

File tree

2 files changed

+166
-0
lines changed

2 files changed

+166
-0
lines changed

Laundary System/README.md

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Laundry Service Class
2+
3+
## Overview
4+
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.
5+
6+
## Class Structure
7+
### Methods
8+
1. `__init__(name, contact, email, cloth_type, branded, season)`: Initializes a new customer instance with the provided details and assigns a unique customer ID.
9+
- Parameters:
10+
- `name`: String, name of the customer.
11+
- `contact`: Numeric (integer), contact number of the customer.
12+
- `email`: Alphanumeric (string), email address of the customer.
13+
- `cloth_type`: String, type of cloth deposited (Cotton, Silk, Woolen, or Polyester).
14+
- `branded`: Boolean (0 or 1), indicating whether the cloth is branded.
15+
- `season`: String, season when the cloth is deposited (Summer or Winter).
16+
17+
2. `customerDetails()`: Prints out the details of the customer, including name, contact number, email, cloth type, and whether the cloth is branded.
18+
19+
3. `calculateCharge()`: Calculates the charge based on the type of cloth, branding, and season.
20+
- Returns:
21+
- Numeric, total charge for cleaning the cloth.
22+
23+
4. `finalDetails()`: Calls `customerDetails()` and `calculateCharge()` methods within itself and prints the total charge and the expected day of return.
24+
- Prints:
25+
- Total charge in Rupees.
26+
- Expected day of return (4 days if total charge > 200, otherwise 7 days).
27+
28+
## Example Usage
29+
```python
30+
# Example usage:
31+
name = input("Enter customer name: ")
32+
contact = int(input("Enter contact number: "))
33+
email = input("Enter email address: ")
34+
cloth_type = input("Enter cloth type (Cotton/Silk/Woolen/Polyester): ")
35+
branded = bool(int(input("Is the cloth branded? (Enter 0 for No, 1 for Yes): ")))
36+
season = input("Enter season (Summer/Winter): ")
37+
38+
customer = LaundryService(name, contact, email, cloth_type, branded, season)
39+
customer.finalDetails()
40+
41+
42+
markdown
43+
Copy code
44+
# Laundry Service Class
45+
46+
## Overview
47+
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.
48+
49+
## Class Structure
50+
### Methods
51+
1. `__init__(name, contact, email, cloth_type, branded, season)`: Initializes a new customer instance with the provided details and assigns a unique customer ID.
52+
- Parameters:
53+
- `name`: String, name of the customer.
54+
- `contact`: Numeric (integer), contact number of the customer.
55+
- `email`: Alphanumeric (string), email address of the customer.
56+
- `cloth_type`: String, type of cloth deposited (Cotton, Silk, Woolen, or Polyester).
57+
- `branded`: Boolean (0 or 1), indicating whether the cloth is branded.
58+
- `season`: String, season when the cloth is deposited (Summer or Winter).
59+
60+
2. `customerDetails()`: Prints out the details of the customer, including name, contact number, email, cloth type, and whether the cloth is branded.
61+
62+
3. `calculateCharge()`: Calculates the charge based on the type of cloth, branding, and season.
63+
- Returns:
64+
- Numeric, total charge for cleaning the cloth.
65+
66+
4. `finalDetails()`: Calls `customerDetails()` and `calculateCharge()` methods within itself and prints the total charge and the expected day of return.
67+
- Prints:
68+
- Total charge in Rupees.
69+
- Expected day of return (4 days if total charge > 200, otherwise 7 days).
70+
71+
## Example Usage
72+
```python
73+
# Example usage:
74+
name = input("Enter customer name: ")
75+
contact = int(input("Enter contact number: "))
76+
email = input("Enter email address: ")
77+
cloth_type = input("Enter cloth type (Cotton/Silk/Woolen/Polyester): ")
78+
branded = bool(int(input("Is the cloth branded? (Enter 0 for No, 1 for Yes): ")))
79+
season = input("Enter season (Summer/Winter): ")
80+
81+
customer = LaundryService(name, contact, email, cloth_type, branded, season)
82+
customer.finalDetails()
83+
Usage Instructions
84+
Create an instance of the LaundryService class by providing customer details as parameters to the constructor.
85+
Use the finalDetails() method to print the customer details along with the calculated charge and expected day of return.
86+
87+
88+
Contributors
89+
(Rohit Raj)[https://github.com/MrCodYrohit]
90+
91+

Laundary System/code.py

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
id=1
2+
class LaundryService:
3+
def __init__(self,Name_of_customer,Contact_of_customer,Email,Type_of_cloth,Branded,Season,id):
4+
self.Name_of_customer=Name_of_customer
5+
self.Contact_of_customer=Contact_of_customer
6+
self.Email=Email
7+
self.Type_of_cloth=Type_of_cloth
8+
self.Branded=Branded
9+
self.Season=Season
10+
self.id=id
11+
12+
def customerDetails(self):
13+
print("The Specific Details of customer:")
14+
print("customer ID: ",self.id)
15+
print("customer name:", self.Name_of_customer)
16+
print("customer contact no. :", self.Contact_of_customer)
17+
print("customer email:", self.Email)
18+
print("type of cloth", self.Type_of_cloth)
19+
if self.Branded == 1:
20+
a=True
21+
else:
22+
a=False
23+
print("Branded", a)
24+
def calculateCharge(self):
25+
a=0
26+
if self.Type_of_cloth=="Cotton":
27+
a=50.0
28+
elif self.Type_of_cloth=="Silk":
29+
a=30.0
30+
elif self.Type_of_cloth=="Woolen":
31+
a=90.0
32+
elif self.Type_of_cloth=="Polyester":
33+
a=20.0
34+
if self.Branded==1:
35+
a=1.5*(a)
36+
else:
37+
pass
38+
if self.Season=="Winter":
39+
a=0.5*a
40+
else:
41+
a=2*a
42+
print(a)
43+
return a
44+
def finalDetails(self):
45+
self.customerDetails()
46+
print("Final charge:",end="")
47+
if self.calculateCharge() >200:
48+
print("to be return in 4 days")
49+
else:
50+
print("to be return in 7 days")
51+
while True:
52+
name=input("Enter the name: ")
53+
contact=int(input("Enter the contact: "))
54+
email=input("Enter the email: ")
55+
cloth=input("Enter the type of cloth: ")
56+
brand=bool(input("Branded ? "))
57+
season=input("Enter the season: ")
58+
obj=LaundryService(name,contact,email,cloth,brand,season,id)
59+
obj.finalDetails()
60+
id=id+1
61+
z=input("Do you want to continue(Y/N):")
62+
if z=="Y":
63+
continue
64+
elif z =="N":
65+
print("Thanks for visiting!")
66+
break
67+
else:
68+
print("Select valid option")
69+
70+
71+
72+
73+
74+
75+

0 commit comments

Comments
 (0)