Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A top-level domain (TLD) name is the last part of an Internet domain name like .com. A core generic TLD (core gTLD) is a

A top-level domain (TLD) name is the last part of an Internet domain name like  For example: 1) If user input is

A top-level domain (TLD) name is the last part of an Internet domain name like ".com". A core generic TLD (core gTLD) is a TLD that is either ".com", ".net", ".org", or ".info". A second-level domain is a single name that precedes a TLD. For example, "apple" in "apple.com" is a second-level domain. Write a Java program that validates a domain name. More precisely, it is supposed to: 1) Use a loop to repeatedly prompt for a domain name. (Use empty string as an indicator for exiting) 2) (For each domain name) convert the string to lower cases. 3) Find the index of its period. 4) Extract the substring starting from the period, compare it with the four core gTLD's. 5) If the substring is a core gTLD, output "It is a second-level domain followed by a core gTLD." 6) If not, output "It is not a second-level domain followed by a core gTLD." For example: 1) If user input is "apple.com", the program should output "It is a second-level domain followed by a core gTLD." 2) If user input is "APPLE.COM", the program should output "It is a second-level domain followed by a core gTLD." 3) If user input is "www.apple.com", the program should output "It is not a second-level domain followed by a core gTLD." (Because we require a single word that precedes a TLD.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

import javautilScanner public class DomainValidator public static void mai... 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_2

Step: 3

blur-text-image_3

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

Law Business and Society

Authors: Tony McAdams

11th edition

78023866, 978-9814577311, 9814577316, 978-0078023866

More Books

Students also viewed these Programming questions

Question

What are the benefits of studying psychology? (p. 17)

Answered: 1 week ago

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago

Question

What do we know about police officers as eyewitnesses?

Answered: 1 week ago

Question

What do we know about elderly people as eyewitnesses?

Answered: 1 week ago