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
blsea [12.9K]
2 years ago
6

You designed a program to create a username using the first three letters from the first name and the first four letters of the

last name. Usernames cannot have spaces. You are testing your program with a user whose name is Jo Wen. What step in the program plan do you need to revisit
Computers and Technology
1 answer:
Pavel [41]2 years ago
7 0

Answer:

See Explanation

Explanation:

The question would be best answered if there are options to select from; since none is provided, I will provide a general explanation.

From the question, we understand that, you are to test for Jo Wen.

Testing your program with this name will crash the program, because Jo has 2 letters (3 letters are required), and Wen has 3 letters (4 letters are required)

So, the step that needs to be revisited is when the username is generated.

Since the person's name cannot be changed and such person will not be prevented from registering on the platform, you need to create a dynamic process that handles names whose lengths are not up to the required length.

You might be interested in
For our computer club in school, we are making a discord server and seeing who can get the most members. I am making an Anime Se
Gwar [14]

Answer:

misteragua#1874

Explanation:

5 0
2 years ago
What is the newest iphone?
OlgaM077 [116]

xR max is the newest iPhone out right now

7 0
2 years ago
Read 2 more answers
Create a method called nicknames that passes an array as a parameter. Inside the method initialize it to hold 5 names of your ch
Gre4nikov [31]
<h2>Answer:</h2>

    //======METHOD DECLARATION=========//          

    //method name: nicknames                                          

    //method return type: void                                            

    //method parameter: an array reference                    

    public static void nicknames(String [] names){      

       //initialize the array with 5 random names              

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       //using an enhanced for loop, print out the elements in the array

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

<h2>Explanation:</h2>

The program is written in Java. It contains comments explaining important parts of the code. Kindly go through these comments.

A few things to note.

i. Since the method does not return any value, its return type is <em>void</em>

ii. The method is made public so that it can be accessible anywhere in and out of the class the uses it.

iii. The method is made static since it will most probably be called in the static main method (at least for testing in this case)

iv. The method receives an array of type <em>String </em>as parameter since the names to be stored are of type <em>String</em>.

v. The format of initializing an array manually should follow as shown on line 7. The <em>new</em> keyword followed by the array type (String), followed by the square brackets ([]) are all important.

vi. An enhanced for loop (lines 9 - 11) is a shorthand way of writing a for loop. The format is as follows;

=> The keyword <em>for</em>

=> followed by an opening parenthesis

=> followed by the type of each of the elements in the array. Type String in this case.

=> followed by a variable name. This holds an element per cycle of the loop.

=> followed by a column

=> followed by the array

=> followed by the closing parenthesis.

=> followed by a pair of curly parentheses serving as a block containing the  code to be executed in every cycle of the loop. In this case, the array elements, each held in turn by variable n, will be printed followed by a space.

A complete code and sample output for testing purposes are shown as follows:

==================================================

public class Tester{

    //The main method

    public static void main(String []args){

       

       String [] names = new String[5];

       nicknames(names);

    }

   

  //The nicknames method

    public static void nicknames(String [] names){

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

}

==================================================

<h2>Output:</h2>

John Doe Brian Loveth Chris

<em>NB: To run this program, copy the complete code, paste in an IDE or editor and save as Tester.java</em>

6 0
2 years ago
The four main structural elements of a computer system are:
Tom [10]
<span>Processor, Main Memory, I/O Modules, System Bus</span>
4 0
3 years ago
Write a program that first gets a list of six integers from input. The first five values are the integer list. The last value is
Andrew [12]

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

   

    int[] arr = new int[5];

   

    System.out.println("Enter values for integer list: ");

    for (int i=0; i<5; i++){

        arr[i] = input.nextInt();

    }

   

    System.out.print("Enter the threshold: ");

    int t = input.nextInt();

   

    outputIntsLessThanOrEqualToThreshold(arr, t);

   

}

public static void outputIntsLessThanOrEqualToThreshold(int[] arr, int threshold){

   

    for (int x: arr){

        if (x<threshold)

            System.out.print(x + " ");

    }

}

}

Explanation:

Create a function called outputIntsLessThanOrEqualToThreshold that takes two parameters, arr and threshold

Check each element in the arr. If they are smaller than the threshold, print the element

Inside the main:

Initialize the array with user inputs and get the threshold value

Call the outputIntsLessThanOrEqualToThreshold function with the entered array numbers and threshold value

6 0
2 years ago
Other questions:
  • The underline format will underline ____.
    14·1 answer
  • How do you increase the amount of data in a sampled Google Analytics report?
    8·1 answer
  • You receive a file named Project4.xlsx as an attachment to an email message. What do you expect the file to contain?
    8·1 answer
  • Which of the following statements is TRUE?
    11·1 answer
  • What kind of word is the pronoun in bold letters?
    5·2 answers
  • What is the next line?
    6·2 answers
  • In Java, Create a two part program. The first takes a user inputted number and lists the factors. The second, lists all the prim
    12·1 answer
  • A ________ is a device used to illegally capture the data stored on the magnetic stripe of an ATM card, credit card, or debit ca
    10·1 answer
  • Maria is conducting a security investigation and has identified a suspect. The suspect is an employee of the organization who ha
    15·1 answer
  • In your own opinion how comes the surface grinding machine is called a highly accurate machine tool?​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!