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
suter [353]
3 years ago
10

In JAVA,

Computers and Technology
1 answer:
Dahasolnce [82]3 years ago
5 0

Answer:

The program to this question as follows:

Program:

public class Main //define class main

{

public static void main(String[] args)  //define main method

{

boolean isAMember = false; //define boolean variable isAMember

int currentMembers[]={1,72,36,43,51,61,72,80}; //declare and initialized array.

int memberID=72; //define integer variable memberID.

for(int k = 0; k < currentMembers.length; k++) //loop.

{

if(currentMembers[k] == memberID) //conditional statement.

{

isAMember = true; //assign value true.

break;

}

System.out.print("true"); //print value.

}

}

}

Output:

true

Explanation:

The above java program to this question can be described as:

  • In java program we define a class that is "Main" inside this class we define a main method in the main method we define variables that are "k, memberID, isAMember, currentMembers".
  • The variable k and memberID is an integer variable that is used in the loop and use for match condition. and currentMembers is an integer array that is declared and initialized. and isAMember is a boolean variable that returns only true or false value.
  • Then we define a (for) loop in this loop we check condition we use if block. In if block, we check that currentMembers array value is equal to memberID. if this condition is true so we assign value true in "isAMember" variable and print its value.
You might be interested in
Cutting edge technoligies of Cisco​
DochEvi [55]
I’m sorry, what? I don’t quite know what the question is... if you comment me maybe I could help any further.
4 0
3 years ago
Write a short program that uses a for loop to populate an array. The array can store up to 10 integers. Modify the code slightly
mr Goodwill [35]

Answer:

  1. public class num16 {
  2.    public static void main(String[] args) {
  3.        //This code is designed to create and populate an array with
  4.        //Ten Integer values
  5.        Scanner in = new Scanner(System.in);
  6.        //Create the array
  7.        int [] intArray = new int [10];
  8.        //populating the array
  9.        for(int i =0; i<=10; i++){
  10.            System.out.print("Enter the elements: ");
  11.            intArray[i]= in.nextInt();
  12.        }
  13.        //Print the Values in the array
  14.        System.out.println(Arrays.toString(intArray));
  15.    }
  16. }

Explanation:

  • The above code looks like it will run successfully and give desired output.
  • But a bug has been introduced on line 9. This will lead to an exception called ArrayIndexOutOfBoundsException.
  • The reason for this is since the array is of length 10, creating a for loop from 0-10 will amount to 11 values, and the attempt to access index 10 for the eleventh element will be illegal
  • One way to fix this bug is to change the for statement to start at 1.
8 0
3 years ago
The algorithm ____ is used to find the elements in one range of elements that do not appear in another range of elements.
Musya8 [376]

Answer:

A. set_union

Explanation:

The algorithm set_union is used to find the elements in one range of elements that do not appear in another range of elements.

4 0
3 years ago
Todays hard drives give up to or more than 1000gb of space. true or false
olya-2409 [2.1K]
Its true because most 2017 harddrives come with at least 250gb 
3 0
4 years ago
Bill, a project manager, wants to hire external resources. What step should Bill take before hiring external resources?
solniwko [45]
The answer to this is verify the resources identified by experts 
7 0
3 years ago
Other questions:
  • If you need to add more data between column C and column D, you should _____.
    7·1 answer
  • In the state of Florida your first conviction for DUI can result in your vehicle being impounded for:
    14·2 answers
  • Budget at completion<br><br> What does this measurement tell you?
    8·1 answer
  • What is a System Software ?
    11·2 answers
  • A team is in the process of developing a motion picture. Currently, they are creating ideas for advertisements to make people in
    6·1 answer
  • Wow, in this century, technology have been the most valuable. What is the worst of using the hi-tech phones
    13·2 answers
  • Project: Math Tutor Program with Error Handling
    9·2 answers
  • Why are various creative works split up into different types under copyright law?
    9·1 answer
  • A company is deploying NAFDs in its office to improve employee productivity when dealing with paperwork. Which of the following
    11·1 answer
  • Apart from mATX and ATX what are the other form factors of power supply
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!