Answered step by step
Verified Expert Solution
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 ".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...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