AXES Bank provides various kind of services to its customers. To provide banking services, bank needs a valid contact details of customers.
Write a program to get customer details, validate the email id and contact number and add the details to a List.
Create a Customer.py with the following private attributes
DataType | Attribute Name |
---|---|
String | __customerId |
String | __username |
String | __password |
String | __name |
String | __email |
String | __contactNumber |
Use init() constructor to initialize the variables with respective to class.
Note : Include appropriate getters and setters for the attributes
And include a def display( ) function to print customer details as shown in the output.
The Main.py must have the following functions
Function | Description |
---|---|
def validateEmail(self,email) | Validates the email to return true if valid and false if invalid |
def validateContact(self,contact) | Validates the contact to return true if valid and false if invalid |
Note:
- Email-should be in lower case
- email-format:“part1@part2.part3”
where,
part1 can contain alphabets and numbers
part2 and part3 can contain alphabet only - Contact should be a 10 digit value.
Write a function in main.py to drive the program.
[All text in bold corresponds to the input and rest corresponds to output]
Sample input and output 1:
Enter the Customer Details
Enter customer id:
24
Enter name:
Tejasri
Enter user name:
teju24
Enter password:
teju24
Enter email:
teju24@gmail@yahoo.in
Enter contact number:
1234567890
Invalid email or contact. Please enter a valid one!
Enter email:
teju24@gmail24.in
Enter contact number:
1234567890
Invalid email or contact. Please enter a valid one!
Enter email:
teju24@gmail.in
Enter contact number:
1234567890
Do you want to continue adding customer details?
Type ‘yes’ to continue!
yes
Enter the Customer Details
Enter customer id:
thigazhKarthigeyan
Enter name:
thigazh
Enter user name:
thigazh
Enter password:
thigazh6
Enter email:
thigazhKarthigeyan6@gmail.com
Enter contact number:
1234567890
Do you want to continue adding customer details?
Type ‘yes’ to continue!
no
Entered Customer Details are:
Customer1
CustomerId:24
Name:Tejasri
Username:teju24
Password:teju24
Email:teju24@gmail.in
ContactNumber:1234567890
Customer2
CustomerId:thigazhKarthigeyan
Name:thigazh
Username:thigazh
Password:thigazh6
Email:thigazhKarthigeyan6@gmail.com
ContactNumber:1234567890