1
Here’s the first class:
public class algoritmo {
public static void main(String[] args){
opcoes();
}
public static void opcoes(){
Scanner input = new Scanner(System.in);
int num;
System.out.println("Selecione o Algoritmo de Substituicao Desejado");
System.out.println("1 - FIFO");
System.out.println("2 - LRU");
System.out.println("3 - Segunda Chance");
System.out.println("4 - Otimo");
num = input.nextInt();
switch(num){
case 1:
FIFO();
break;
case 2:
LRU();
break;
case 3:
SegundaChance();
break;
case 4:
Otimo();
break;
}
This is a method that is in the other file.
public class LRU {
private int qtdePaginas;
private int qtdeframes;
int []paginas;
int [][]matriz;
int []falhas;
int []distancia;
public LRU(){
System.out.println("LRU");
}
public void setPaginas(int []paginas){
this.paginas = paginas;
}
public void setQtdePaginas(int qtdePaginas){
this.qtdePaginas = qtdePaginas;
}
public void setQtdeframes(int atdeframes){
this.qtdeframes = qtdeframes;
}
public void iniciarFalhas(){
for(int i=0; i<qtdePaginas; i++){
falhas[i] = 0;
}
}
Algorithms replace algorithm; Why did Voce write isto_??? not understand T.T
– Ryu1031
@Ryu1031 I am declaring a variable and within the
switch
a value is assigned to it. This variable represents the algorithm chosen by the user.– Victor Stafusa
but here is giving error in putting this :(
– Ryu1031
@Ryu1031 What error?
– Victor Stafusa