package p;
import java.io.*;
public class fifo {
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int frames = 3, pointer = 0, fault = 0, reflen, def = 0;
int spaces[];
int reference[];
int mem_layout[][];
System.out.println("Reference String Length: ");
reflen = Integer.parseInt(br.readLine());
reference = new int[reflen];
mem_layout = new int[reflen][frames];
spaces = new int[frames];
for(int j = 0; j < frames; j++)
spaces[j] = 0;
System.out.println("Reference Numbers: ");
for(int i = 0; i < reflen; i++)
{
reference[i] = Integer.parseInt(br.readLine());
}
System.out.println();
for(int i = 0; i < reflen; i++)
{
int search = -1;
for(int j = 0; j < frames; j++)
{
if(spaces[j] == reference[i])
{
search = j;
def++;
break;
}
}
if(search == -1)
{
spaces[pointer] = reference[i];
fault++;
pointer++;
if(pointer == frames)
pointer = 0 ;
}
for(int j = 0; j < frames; j++)
mem_layout[i][j] = spaces[j];
}
for(int i = 0; i < frames; i++)
{
for(int j = 0; j < reflen; j++)
//System.out.printf("%3d ", reference);
System.out.printf("%3d ",mem_layout[j][i]); //ERROR UNDER PRINTF
System.out.println();
}
System.out.println("Fault: " + fault);
System.out.println("Default: " + def);
System.out.println("Page Fault Rate: " + fault + "/" + reflen + " = " + ((double)fault/reflen)*100 + "%" );
}
}
So we are told to continue our work at home. The code is working fine in our computer lab that is using another version of eclipse. Im using a juno and printf doesn't work anymore. Please help the submission is tomorrow i don't know why it doesn't work anymore.
Is juno outdated? I tried doing the eclipse suggestion for removing the error but it produces more error lol :(