Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

Differentiate 3sin(9x+2x)

Answered: 1 week ago