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
Luba_88 [7]
3 years ago
14

A teacher wants to create a list of students in her class. Using the existing Student class in this exercise. Create a static Ar

rayList called classList that adds a student to the classList whenever a new Student is created. In the constructor, you will have to add that Student to the ArrayList.

Computers and Technology
1 answer:
aleksandr82 [10.1K]3 years ago
4 0

Answer:

Check the explanation

Explanation:

CODE:-

import java.util.ArrayList;

class Student

{

  private String name;

  private int grade;

  private static ArrayList<Student> classList = new ArrayList<Student>();

 

  public Student(String name, int grade)

  {

      this.name = name;

      this.grade = grade;

      classList.add(this);

  }

 

  public String getName()

  {

      return this.name;

  }

 

  /*Don't change the code in this method!

  This method will print out all the Student names in the classList Array

  */

  public static String printClassList()

  {

      String names = "";

      for(Student name: classList)

      {

          names+= name.getName() + "\n";

      }

      return "Student Class List:\n" + names;

  }

}

public class ClassListTester

{

  public static void main(String[] args)

  {

      //You don't need to change anything here, but feel free to add more Students!

      Student alan = new Student("Alan", 11);

      Student kevin = new Student("Kevin", 10);

      Student annie = new Student("Annie", 12);

      Student smith = new Student("Smith", 11);

      Student kane = new Student("Kane", 10);

      Student virat = new Student("Virat", 12);

      Student abd = new Student("ABD", 12);

      Student root = new Student("Root", 12);

      System.out.println(Student.printClassList());

  }

}

Kindly check the attached image below.

You might be interested in
What is the approximate boiling point
lesantik [10]
For water the approximate boiling point is 100 degrees Celsius.
<span />
4 0
3 years ago
A level breach of security could be expected to have a severe or catastrophic adverse effect on organizational operations, organ
rewona [7]

Answer:

Option D is correct.

Explanation:

A high-level safety violation could be anticipated to have a serious or disastrous negative impact on organisational activities, organisational assets.

The effect of the violation on an organisation may be staggering, and sometimes unknown until the outcomes are achieved. It is strange that, owing to harmful or neglectful acts, the greatest incidents of compromise come from within the business ; it requires time for an organisation to recover.

8 0
3 years ago
What type of purchase requisition is used to turn-in a recoverable/reparable material to the ssa?
m_a_m_a [10]

ZRX is the purchase requisition document type used to turn a recoverable repairable material for Remote customers to the SSA.

What is a purchase requisition?

Employees can start a purchase by sending internal documents called buy requisitions. A buy order is issued to a supplier to place the order for the goods/services in question once the purchase has received the relevant person or department's approval.

What is the purpose of a purchase requisition?

A purchase request form is a formal internal document that is utilized during the purchasing process. Employees utilize this to communicate the resources they require to department supervisors. Therefore, an employee will submit a formal request via a requisition form to the purchasing department if they have a requirement.

Learn more about purchase requisition: brainly.com/question/16413109

#SPJ4

5 0
2 years ago
Use the code below to answer the following questions. Note that the catch statements in the code are not implemented, but you wi
anzhelika [568]

Answer:

d) either e1 or e5

Explanation:

Here, the instruction i1 goes ahead in trying to open the given file through an input stream buffer reader. If the given file name is wrong, it will indicate that an e1 file is not found or if any other IO errors due to invalid stream, no disc in drive e5 IO exception will be drawn.

4 0
3 years ago
Ben chang noticed that his store was lagging in sales . He realized that his staff was not experienced enough . As the store man
dem82 [27]
Ben should set up a program to teach his staff about customer service, and communicating with clients. 
4 0
2 years ago
Read 2 more answers
Other questions:
  • How can you best protect yourself when using social media
    5·2 answers
  • What is the output of the following program? #include using namespace std; class TestClass { private: int val; void showVal() {
    5·1 answer
  • A star appears under the <br> menu of the word processing program.
    5·1 answer
  • What task does the casting director do, apart from auditioning actors?
    8·1 answer
  • On which of the following pointing devices can you control the pointer by sliding your fingertip?
    11·1 answer
  • Peripeteia is also referred to as __________.
    5·2 answers
  • A(n) _______ gate provides an output of 1 if either or both inputs are 1.
    14·2 answers
  • Task 2: Typing a School Speech
    12·1 answer
  • You have been elected to assist the school's yearbook committee and newspaper club in purchasing new computers. The current comp
    10·1 answer
  • What is not recyclable in a<br> hybrid car<br> hydrogen car<br> petrol car
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!