Special offer for new customers: 5% OFF your first order! Use coupon: GWRITERSclose

Python code

USER – CONTACT
User Contact
Brinda has recently joined a company and she is working as a software engineer. She was associated with a project to work on relationships. To get hold of the topic she starts writing a code where she takes the details of her colleagues and displays them in an ordered way. Let’s help Brinda to complete her code.

Create User class as the parent with the following attributes.

Attribute    Data Type
name    str
age    int
gender    str
contact    Contact
Use __init__() constructor to initialize the variables with respect to class.

Create a class Contact class with the following attributes.

Attribute    Datatype
phone_no    int
email_id    str
address    str
Use the following method to display the details in both class.

Sl.No    Method    Description
1.    __str__()    This method is used to return the string which needs to be printed

Note:
Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, attribute names, and method names should be the same as specified in the problem statement.

Input Format:
The first line of the input consists of string value corresponding to the name.
The second line of the input consists of Integer value corresponding to age.
The third line of the input consists of string value corresponding to gender.
The fourth line of the input consists of an integer value corresponding to the phone number.
The fifth line of input consists of string value corresponding to the email id.
The sixth line of the input consists of string value corresponding to the address.

Output Format:
Refer sample input-output format for better understanding.

Sample input-output [All lines in bold corresponds to the input]:
Enter Name
Chandan v
Enter Age
22
Enter Gender
Male
Enter Phone Number
8892563578
Enter Email id
[email protected]
Enter Address
Ramakrishna nagar,Mysore.

Name:chandan v
Age:22
Gender:Male
Phone Number:8892563578
Email id:[email protected]
Address:Ramakrishna nagar,Mysore.

You can leave a response, or trackback from your own site.
Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes