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
Recording relative positions should reduce total programming time true or false
Svet_ta [14]

This is true. Recording relative positions in most cases will reduce total programming time and make it over all more efficient.

4 0
3 years ago
The main reason to set a field size in access is to:
Nadya [2.5K]
The main reason to set a field size in access is to limit the lengths of value in the table.
Field size determines the limits or determines the maximum of text that can be input in the text or number field. Also, it may reduce data entry errors in changing the field size in access.
4 0
3 years ago
A commonly-used estimate for the number of bytes needed to store one
Basile [38]

Answer:

0.127 miles ; 5.458 *10^8 miles

Explanation:

Number of bytes needed to store a page = 2000

Number of pages (Harry Potter's book) = 800

Total memory required to store entire book = (2000 * 800) = 1600000 = 16 * 10^5 bytes

Hence,

1 byte of memory will store : (height of each book / memory size of each book)

= 3 ÷ 16 * 10^5

= 1.875 * 10^-6

For 32 bit memory space :

(1.875 * 10^-6 * 2^32) = 8053.06368 inches

1 inch = 1.578 * 10^-5 mile

8053.06368 inches = 8053.06368 * (1.578 * 10^-5) = 0.1270773448704 miles

= 0.127 miles

For 64 bit memory size :

(1.875 * 10^-6 * (2^64)) = 3.45876 * 10^13 inches

(3.45876 * 10^13) * (1.578 * 10^-5)

= 5.458 *10^8 miles

3 0
2 years ago
Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to
Alik [6]

Answer:

#include<stdio.h>

#include<stdlib.h>

int main(void){

int seedval;

scanf ("%d", &seedval);

srand(seedval);

printf("%d\n", rand()%10);

printf("%d\n", rand()%10);

 return 0;

}

Explanation:

The given code is poorly formatted. So, I picked what is usable from the code to write the following lines of code:

#include<stdio.h>

#include<stdlib.h>

int main(void){

This line declares seedval as integer

int seedval;

This line gets user input for seedval

scanf ("%d", &seedval);

This line calls the srand function to generate random numbers

srand(seedval);

This prints a random number between 0 and 9

printf("%d\n", rand()%10);

This also prints a random number between 0 and 9

printf("%d\n", rand()%10);

 return 0;

}

8 0
2 years ago
You can repeat a command in word by pressing the ____ function key.
valentinak56 [21]
You would repeat a command in word by pressing the F4 function key
4 0
3 years ago
Read 2 more answers
Other questions:
  • After you enter the details for the first selected recipient in the New Address List dialog box, click _______ to add another re
    11·2 answers
  • An administrator running a port scan wants to ensure that no processes are listening on port 23. What state should the port be i
    7·1 answer
  • Extend to also calculate and output the number of 1 gallon cans needed to paint the wal. Hint: Use a math function to round up t
    12·1 answer
  • Suppose that the domestic production of computer games creates enjoyment for those who play the games. Domestic production of co
    14·1 answer
  • A computer virus is a program that can copy itself and infect a computer without the permission of the owner. How do you think a
    9·1 answer
  • It needs to be as simple as possible. Each question is slightly different.1. An arithmetic progression is a sequence of numbers
    7·1 answer
  • Assume you are a manager in the security department of a high-tech corporation. You are mentoring Mary, an entry-level network t
    7·1 answer
  • There u go i did thereeeeeeeeeeeeeeeeeeeeeee
    13·2 answers
  • Write the function definition for a function called list_total that accepts a list of integers
    11·1 answer
  • when a stock or bond certificate is delivered, it must be in good transferable form. if the certificate is badly mutilated, it m
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!