Question: Hi, I need help with this assignment: Write a class about domain names. Your class should have a single attribute, the domain name (for instance,

Hi, I need help with this assignment:

Write a class about domain names. Your class should have a single attribute, the domain name (for instance, www.mendocino.edu) (Links to an external site.)Links to an external site.. You class needs to be able to do the following (should have methods for):

return whether the domain name starts with "www"

returns the extension for the domain name (whatever follows the last dot, like "com", "edu"). If there is no dot in the domain name, your method should return "unknown"

returns the name (without the extension or the "www" or what is between the 2 dots like "mendocino"). If there are not 2 dots in the domain name, your method should return "unknown"

Please write a test program that tests all of your methods. This program should take user input for a domain name and then print out, the input domain name, whether it starts with "www" or not, the extension and the actual name.

--Thanks

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!