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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started