Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can I get this in python. Topics: class, object, instantiation, print Problem Statement: Simple .edu Email Address Class: In this assignment, we will be designing

Can I get this in python.

image text in transcribed

Topics: class, object, instantiation, print Problem Statement: Simple .edu Email Address Class: In this assignment, we will be designing a simple .edu email address class. Email address consists of three main parts: username, an at ('@') symbol and domain information. The purpose of this lab is to gain experience in python's basic class definition and object instantiation. Class Definition: You need to write a simple class 'EmailAddress, where the class will have following instance variables and methods: 1. Instance variables: username, symbol and domain, all are string data type 2. _init_method: constructor method to initialize instance variables in #1. 3. _str_method: Print representation of an object. The _str_ method should return the full email address. 4. is_address_valid(): This method returns True if following all conditions hold: a. '.edu' is present in the domain name and b. '@' symbol is present in the symbol and C. length of username must be greater than 1 and d. length of domain information is more than 4 The method returns False if one of the above conditions do not hold. Object Creation/Instantiation and method calling: 1. You need to create three objects 'al','a2' and 'a3' with following information: Symbol Object a1 a2 Username john peter domain gmu.edu gmu.net & Comment valid invalid: no @ sign invalid: username is an empty string a3 '#empty string t.edu 2. Print the information of all objects. Hint: _str_() method invoking. 3. Call is_address_valid method with all objects and check if they return True or False. Print appropriate informational message as shown in sample outcome below. Sample output: EmailAddress object created john@gmu.edu peter&gmu.net john@gmu.edu is valid .edu email address peter&gmu.net is invalid.edu email address @t.edu is invalid .edu email address

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

13-4 What are alternative methods for building information systems?

Answered: 1 week ago