Course Solutions Uncategorized (Solved) : Modify Following Shelf Class Becomes Generic Class String Class Replaced Class Public Clas Q28059161 . . . .

(Solved) : Modify Following Shelf Class Becomes Generic Class String Class Replaced Class Public Clas Q28059161 . . . .

 

Modify the following Shelf class so it becomesa Generic class where String class can be replaced with anyclass.

Public class Shelf{

private String[] items;

private int capacity, itemsNumber = 0;

private String mainItem;

public Shelf(int capacity){

items = (String[]) new String [capacity];

}

public void add (String item){

if (!item.equals(mainItem))

items[itemsNumber++] = item;

}

public String getFirst() {return items[0];}

public int getCapcity() {return capacity;}

}

Expert Answer


An answer will be send to you shortly. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Solved) : Assembled Function Mips Addi Sp Sp 4 Sw Li 1i L1 Li 0xe04800b8 Ex23bdfffc Addi 29 29 Exfff Q30177818 . . . .(Solved) : Assembled Function Mips Addi Sp Sp 4 Sw Li 1i L1 Li 0xe04800b8 Ex23bdfffc Addi 29 29 Exfff Q30177818 . . . .

<br/><img src="https://media.cheggcdn.com/media%2F0a7%2F0a794b22-b8bf-458d-8d57-2f43cc34a70b%2Fimage" alt="Here is an assembled function in MIPS addi $sp, $sp, 4 Sw Li 1i L1 Li 0xe04800b8 ex23bdfffc addi $29, $29,exffff... 75: 0x084000bc exafb10000 sw $17,8x8000e000($29) 76: 0xe04000ce