answer.
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
jarptica
2 months ago
5

Write a method, isEmailAddress, that is passed a String argument. It returns true or false depending on whether the argument has

the form of an email address. In this exercise, assume that an email address has one and only one "@" sign and no spaces, tabs or newline characters.
Computers and Technology
1 answer:
Amiraneli [1K]2 months ago
8 0

Answer:

//This method takes a parameter called myString of type String

public static boolean isEmailAddress (String myString){

//verifying if the @ character exists in the string

if (myString.indexOf("@")!= -1) {

  //ensuring that only a single instance of @ appears in the string

   if (myString.indexOf("@") == myString.lastIndexOf("@")) {

   //confirming absence of space characters

  if (myString.indexOf(" ") == -1) {

    //checking for the absence of newline characters in the string

    if (myString.indexOf("\n") == -1) {

      //checking for absence of tab characters in the string

      if (myString.indexOf("\t") == -1) {

          return true;

      }

    }

  }

}

}

 return false;

}

Explanation:

The method takes a string presumed to be an email address and verifies whether it is valid, returning true if it is valid and false otherwise. The method checks the following conditions:

->The presence of the "@" character

->Only one occurrence of "@" exists in the string

->No spaces present

->No newline characters present

->No tab characters present

Returning true only if all these conditions are met.

You might be interested in
print_pattern() prints 5 characters. Call print_pattern() twice to print 10 characters. Example output: ***** ***** in python
Amiraneli [1052]

Response:

def print_pattern():

print("*****",end=" ")

print_pattern()

print_pattern()

5 0
3 months ago
Anna is making a presentation on the top five most visited cities in her state. she wants to make sure that she does not put in
Harlamova29_29 [1022]
Outline View. This mode displays solely the text of all slides on the left side, allowing Anna to determine if she has included too much or too little content on each slide.  She can also edit the text directly while simultaneously observing its impact on the slide.  
8 0
1 month ago
Read 2 more answers
A ____ partition contains the data necessary to restore a hard drive back to its state at the time the computer was purchased an
zubka84 [1067]
The answer is back up
8 0
1 month ago
Read 2 more answers
Write an if-else statement to describe an integer. Print "Positive even number" if isEven and is Positive are both true. Print "
Harlamova29_29 [1022]

Answer:

Below is the explanation for the C code.

Explanation:

#include <stdio.h>

#include <stdbool.h>

int main(void) {

int userNum;

bool isPositive;

bool isEven;

scanf("%d", &userNum);

isPositive = (userNum > 0);

isEven = ((userNum % 2) == 0);

if(isPositive && isEven){

  printf("Positive even number");

}

else if(isPositive &&!isEven){

  printf("Positive number");

}

else{

  printf("Not a positive number");

}

printf("\n");

return 0;

}

6 0
2 months ago
Your computer uses 4 bits to represent decimal numbers (0, 1, 2, 3 and so on) in binary. What is the SMALLEST number for which a
amid [951]

Response: C

Clarification:

The reason is that four binary bits are insufficient to represent the number sixteen. The maximum is 15.

3 0
3 months ago
Other questions:
  • Accenture is helping a large retailer transform their online sales and services. The Data Analyst audits the client’s customer j
    12·1 answer
  •  How does critically analyzing technology add value to interactions with people in personal and professional contexts?
    9·2 answers
  • Until 2015, each new Roblox user automatically had one friend. What was he called?
    12·2 answers
  • Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 the output is
    5·1 answer
  • Which generation of programming languages provides programmers with a visual environment for coding programs?
    12·1 answer
  • You work for a car rental agency and want to determine what characteristics are shared among your most loyal customers. To do th
    10·1 answer
  • What type of memory can support quad, triple, and dual channels?
    5·1 answer
  • Factoring of integers. Write a python program that asks the user for an integer and then prints out all its factors. For example
    13·1 answer
  • Team A found 342 errors during the software engineering process prior to release. Team B found 184 errors. What additional measu
    12·1 answer
  • Consider two different implementations, M1 and M2, of the same instruction set. There are three classes of instructions (A, B, a
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!