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
oee [108]
2 years ago
7

The IntList class contains code for an integer list class. Study it; notice that the only things you can do are: create a list o

f a fixed size and add an element to a list. If the list is already full, a message will be printed. List Test is a driver class that creates an IntList, puts some values in it, and prints it. Compile and run it to see how it works.
Computers and Technology
1 answer:
torisob [31]2 years ago
8 0

Explanation:

public class Int_List

{

protected int[] list;

protected int numEle = 0;

 

public Int_List( int size )

{

list = new int[size];

public void add( int value )

{

if ( numEle == list.length )

{

System.out.println( "List is full" );

}

else

{

list[numEle] = value;

numEle++;

}

}

public String toString()

{

String returnStr = "";

for ( int x = 0; x < numEle; x++ )

{

returnStr += x + ": " + list[x] + "\n";

}

return returnStr;

}

}

public class Run_List_Test

{

public static void main( String[] args )

{

 

Int_List myList = new Int_List( 7 );

myList.add( 102 );

myList.add( 51 );

myList.add( 202 );

myList.add( 27 );

System.out.println( myList );

}

}

Note: Use appropriate keyword when you override "tostring" method

You might be interested in
How do you measure the capacity of speed and memory of computer system<br>Explain.​
jeka94
Im sorry i just need points
3 0
3 years ago
There is a simple method for constructing a magic square for any odd value of n:
DaniilM [7]

Answer:

See Explaination

Explanation:

class MagicSquare():

def __init__(self,side):

self.side=side

self.two_dimension=[]

for row in range(1,side+1):

row_line=[]

for col in range(1,side+1):

row_line.append(0)

self.two_dimension.append(row_line)

def display(self):

row=0

col=int((self.side-1)/2)

for i in range(1,self.side**2+1):

self.two_dimension[row][col]=i

row-=1

col+=1

if row==-1:

row=self.side-1

if col==self.side:

col=0

if self.two_dimension[row][col]==0:

continue

else:

row+=1

if row==self.side:

row==0

for line in self.two_dimension:

for num in line:

print("{0:>3}".format(num),end=" ")

print()

def main():

for i in range(1,14,2):

square=MagicSquare(i)

square.display()

print("----------------------------------------------------")

if __name__ == '__main__':

main()

3 0
3 years ago
You plan to use the Fill Down feature on a formula and you need to keep a cell reference the same. Which of the following format
yKpoI14uk [10]
A $E19 I now it because I am in college
6 0
3 years ago
Read 2 more answers
What is the difference between a function with parameters, and a function<br> without parameters? *
Romashka [77]

Answer:

A function with out parameters cannot take any arguments or perform operations on variables passed in. A function with parameters can.

8 0
2 years ago
. If you executean infinite recursive function on a computer it will executeforever.
S_A_V [24]

Answer:

b. False

Explanation:

If you execute an infinite recursive function on a computer it will NOT execute forever.

4 0
2 years ago
Other questions:
  • HELP NOW PLZZ/ Question: Complete the sentence with the correct response.
    11·1 answer
  • This toolbar has icons representing the application's basic operations such as Save and Copy. Drawing Formatting Standard Task
    11·2 answers
  • Differentiate between Software as a service, platform as a service and infrastructure as a service.
    14·1 answer
  • _____________ refers to know-what and know-why of technology.
    12·1 answer
  • The parallax perspective says that objects that are close up appear to move __________ than far away objects.
    10·1 answer
  • You recently upgraded your computer and added an extra 512 MB of RAM. Consequently, you want to increase your swap space by addi
    10·1 answer
  • Post as a reply your example of "data, which is processed into information" case - examples should not necessarily be related to
    13·1 answer
  • Discuss, in detail, the usefulness of graphics and images in program development. Explain the importance of the interface of a c
    7·1 answer
  • In attempts to improve their contribution to the environment a company decides to adapt green computing. Which of these techniqu
    13·1 answer
  • Software that converts program written in other language into machine language​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!