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
Masteriza [31]
4 years ago
5

Now that the classList Array has been implemented, we need to create methods to access the list items.

Computers and Technology
1 answer:
natima [27]4 years ago
7 0

The following code will be applied to Create the following static methods for the Student class

<u>Explanation:</u>

/* Note: Array index starts from 0 in java so ,, user ask for 1 index then the position will be i-1 , below program is based on this concept if you dont want this way just remove -1 from classList.get(i-1).getName(); ,and classList.add(i-1,student); */

/* ClassListTester.java */

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);

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

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

System.out.println(Student.getStudent(1));

Student.addStudent(2, new Student("Trevor", 12));

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

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

}

}

/* Student.java */

import java.util.ArrayList;

public class Student

{

private String name;

private int grade;

//Implement classList here:

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;

}

//Add the static methods here:

public static String printClassList()

{

String names = "";

for(Student name: classList)

{

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

}

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

}  

public static String getLastStudent() {

// index run from 0 so last student will be size -1

return classList.get(classList.size()-1).getName();

}

public static String getStudent(int i) {

// array starts from 0 so i-1 will be the student

return classList.get(i-1).getName();

}

public static void addStudent(int i, Student student) {

// array starts from 0 so, we add at i-1 position

classList.add(i-1,student);

// remove extra student

classList.remove(classList.size()-1);

}  

public static int getClassSize() {

return classList.size();

}

}

You might be interested in
The two roots of a quadratic equation ax^2 + bx + c = 0 can be obtained using the following formula:
Feliz [49]

Answer: ion k

Explanation:

4 0
3 years ago
The acronym GUI is short for
Y_Kistochka [10]
Graphical user interface.

Hope I helped :)
4 0
3 years ago
A computer science student often uses public forum sites like CodeGuru, DreamInCode and StackOverflow in order to help with lear
il63 [147K]

Answer:

C

Explanation:

You can automatically cross out A, as they do not hinder communication. B can be crossed out as well, since kids should use these websites for help. Using the websites can be beneficial and give a learning edge. D is kind of correct, but isn't the best answer.

C is the answer because the websites are public data. People get on the website for help with certain concepts, and helps identify problems to their solution. <em>(Public data found on these forums provides widespread access to identified problems and their solutions. )</em>

4 0
3 years ago
An organization's IRP prioritizes containment over eradication. An incident has been discovered where an attacker outside of the
djyliett [7]

Answer:

a. Remove the affected servers from the network.

Explanation:

An organization's incident response process (IRP) can be defined as all of the process involved in the cleanup and recovery of data when they fall victim to an attack or cybersecurity breach. The incident response process comprises of six (6) important stages and these are;

1. Preparation.

2. Detection and analysis (identification).

3. Containment.

4. Eradication.

5. Recovery.

6. Review of incident activities.

When an organization's IRP prioritizes containment over eradication and an incident is discovered, where an attacker outside the organization installed a crypto-currency mining software on the organization's web servers. Given the organization's stated priorities, the cybersecurity engineer should remove the affected servers from the network.

A containment process is focused on taking steps to eliminate or contain the attack. It basically involves acting swiftly in response to the attack, so as to prevent it from spreading across board or in order to mitigate the damage already caused.

In this context, the cybersecurity engineer should remove the affected servers from the network in accordance with the organization's IRP priority (containment).

<em>Furthermore, he could take a step further to contain the attack by installing a firewall and updating their policies in the Intrusion Prevention System (IPS) of the organization. </em>

5 0
3 years ago
Select all that apply. Backstage view will grant access to change which features?
dem82 [27]
Word Option and AutoCorrect

The office Backstage view is the one place that you can manage your data and files about them like saving, printing, creating, and setting options. It is everything that is done to a file and can be accessed when you first open your MS office and clicking on file tab. In the choices provided, both of these options selected can be found in the setting options of the backstage view.


6 0
3 years ago
Other questions:
  • Radio waves pros and cons
    10·2 answers
  • Write the header for a function addOne that accepts a single integer reference parameter and returns nothing. Name the parameter
    5·1 answer
  • EIPP:________.
    9·2 answers
  • **PLEASE HELP**
    12·1 answer
  • What technology habit you practice every day that you need to stop to be more successful?
    13·1 answer
  • Briefly describe the software quality dilemma in your own words
    13·1 answer
  • When mehtod X calls method Y , method Y called methhod Z, and method Z calles method X, this is called
    9·1 answer
  • NAND is logically complete. Use only NAND gates to constructgate-level circuits that compute the
    7·1 answer
  • What tag is used to contain information about a web page, such as the title and related pages?
    12·1 answer
  • Keli is unable to find a shape that meets her needs. Which feature in Power Point should she use to create shapes that are compl
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!