1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alik [6]
3 years ago
9

JAVA PROGRAMMING

Computers and Technology
1 answer:
VashaNatasha [74]3 years ago
8 0

Answer:

See explaination

Explanation:

import java.util.Scanner;

public class GtldValidation {

public static void main (String [ ] args) {

Scanner scnr = new Scanner(System.in);

// Define the list of valid core gTLDs

String [ ] validCoreGtld = { ".com", ".net", ".org", ".info" };

// FIXME: Define an array named validRestrictedGtld that has the names

// of the restricted domains, .biz, .name, and .pro

String [] validRestrictedGtld={".biz",".name",".pro"};

String inputName = "";

String searchName = "";

String theGtld = "";

boolean isValidDomainName = false;

boolean isCoreGtld = false;

boolean isRestrictedGtld = false;

int periodCounter = 0;

int periodPosition = 0;

int i = 0;

System.out.println("\nEnter the next domain name (<Enter> to exit): ");

inputName = scnr.nextLine();

while (inputName.length() > 0) {

searchName = inputName.toLowerCase();

isValidDomainName = false;

isCoreGtld = false;

isRestrictedGtld = false;

// Count the number of periods in the domain name

periodCounter = 0;

for (i = 0; i < searchName.length(); ++i) {

if (searchName.charAt(i) == '.') {

++periodCounter;

periodPosition = i;

}

}

// If there is exactly one period that is not at the start

// or end of searchName, check if the TLD is a core gTLD or a restricted gTLD

if ((periodCounter == 1) &&

(searchName.charAt(0) != '.') &&

(searchName.charAt(searchName.length() - 1) != '.')) {

isValidDomainName = true;

}

if (isValidDomainName) {

// Extract the Top-level Domain name starting at the period's position. Ex:

// If searchName = "example.com", the next statement extracts ".com"

theGtld = searchName.substring(periodPosition);

i = 0;

while ((i < validCoreGtld.length) && (!isCoreGtld)) {

if(theGtld.equals(validCoreGtld[i])) {

isCoreGtld = true;

}

else {

++i;

}

}

// FIXME: Check to see if the gTLD is not a core gTLD. If it is not,

// check to see whether the gTLD is a valid restricted gTLD.

// If it is, set isRestrictedGtld to true

}

System.out.print("\"" + inputName + "\" ");

if (isValidDomainName) {

System.out.print("is a valid domain name and ");

if (isCoreGtld) {

System.out.println("has a core gTLD of \"" + theGtld + "\".");

}

else if (isRestrictedGtld) {

System.out.println("has a restricted gTLD of \"" + theGtld + "\".");

}

else {

System.out.println("does not have a core gTLD."); // FIXME update message

}

}

else {

System.out.println("is not a valid domain name.");

}

System.out.println("\nEnter the next domain name (<Enter> to exit): ");

inputName = scnr.nextLine();

}

return;

}

}

You might be interested in
Which ofthe following calls on human feelings, basing the argument onaudience needs or sympathies?
Artyom0805 [142]

Answer: a) Emotional appeal

Explanation: Calls on feeling of human is referred as the emotion of the humans ,thus it is said to be an emotional appeal. Other appeals in the options are for the call on technical,logical or unexpected error reason and does not relate to the human audience needs or sympathies .But emotional appeal deals with these need on being called.  So, option (a) is the correct option .

5 0
3 years ago
It is the "executable" phrase of Word<br>Wide Web with dynamic applications,?<br>​
Mkey [24]

Answer:

It is the “executable” phrase of Word Wide Web with dynamic applications, interactive services, and “machine-to-machine” interaction. In Web 3.0, computers can interpret information like humans and intelligently generate and distribute useful content tailored to the needs of users.

4 0
3 years ago
Describe the positive and negative effects of Internet​
kvasek [131]

Answer:

pos-ugly

neg-gay

Explanation:

8 0
3 years ago
Read 2 more answers
Thirty percent of a magazine's subscribers are female. A random sample of 50 subscribers Answer the following questions using Ex
Ann [662]

Based on the mean of the subscribers, the sample size, and the standard deviation, the probability of females being at most 0.25 is 0.2202.

The probability that they are between 0.22 and 0.28 is 0.2703.

The probability that they are within 0.03 of the population proportion is 0.3566.

<h3>What is the probability that they are at most 0.25?</h3>

Using Excel, we shall assume that the distribution is normally distributed.

We can therefore use the NORM.DIST function:


=NORM.DIST(0.25,0.3,0.0648,TRUE)

= 0.2202

<h3 /><h3>What is the probability that they are between 0.22 and 0.28?</h3>

=NORM.DIST(0.28,0.3,0.0648,TRUE) - NORM.DIST(0.22,0.3,0.0648,TRUE)

= 0.2703

<h3>What is the probability that they are within 0.03 of the population proportion?</h3>

X high = 0.30 + 0.03

= 0.33

X low = 0.30 - 0.03

= 0.27

= NORM.DIST(0.33,0.3,0.0648,TRUE) - NORM.DIST(0.27,0.3,0.0648,TRUE)

= 0.3566.

Find out more on probability at brainly.com/question/1846009.

8 0
2 years ago
Alright, so im currently trying to pass a computer science class. i need it done in a little under 2 weeks. Ill just ask the one
Alla [95]

Answer:

B. Mesh

Explanation:

5 0
3 years ago
Other questions:
  • Suppose the program counter (pc) is set to 0x2000 0000. is it possible to use the jump (j) mips assembly instruction to set the
    15·1 answer
  • What is a digital certificate? Select one: a. It is a means of establishing the validity of an offer from a person, entity, web
    7·1 answer
  • What will be the output of “AAAAMMMMMHHHVV” using a file compression technique?
    10·1 answer
  • 1. Show the 16-bit representation of the decimal number 2437. Show your steps. 2. Convert the 16-bit representation of part (a)
    12·1 answer
  • Write a for loop that sets each array element in bonusScores to the sum of itself and the next element, except for the last elem
    11·2 answers
  • When a CPU executes each instruction in a program, it uses a process known as the __________.
    15·1 answer
  • Scenes for films are almost always filmed in the same sequence they appear in the script.
    14·1 answer
  • A part-time job performed while in high school must have the approval of your school counselor.
    7·2 answers
  • Given the code as follows: main() { int i = 3, n; float x; x = i; n = 8 % x; } What problem will occur? Group of answer choices
    12·1 answer
  • What does it mean when it says this person is unavailable on messenger.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!