SINGLE USER CONTIGOUS SCHEME:

INPUT THE SIZE OF MEMORY
DISPLAY THE SIZE OF THE OS BY COMPUTING 20% OF THE MEMORY
INPUT THE NUMBER OF JOBS
EXAMPLE: IF THE NUMBER OF JOB IS ENTERED THE SCREEN WILL GIVE YOU AN OUTPUT LIKE THIS
JOB 1;
JOB 2;
JOB 3;
JOB 4;

SET THE FOLLOWING VALUE OF THE MEMORY REQUIREMENT OF EACH JOBS: 15,30,40,2
ASSUMING THE MEMORY SIZE IS 64MB
DISPLAY THE WASTED MEMORY FOR EACH JOBS AND THE AVERAGE WASTED MEMORY FOR ALL THE JOBS
DISPLAY THE PERCENTAGE OF ALL THE JOBS:

64-15=49 15 MEMORY USAGE
64-30=30 30 MEMORY USAGE
64-40=24 40 MEMORY USAGE
64-2=62 2 MEMORY USAGE

I didnt how to do it please helpme

Nobody eve told you that posting in CAPITAL letters is considered shouting and in your case kind of impolite ?
And where did you pickup the rule that OS takes 20% of memory ?

sorry for my post i already finish my work can u check it if there's something wrong with it?....

package javaapplication5;
import java.io.IOException;
import java.util.Scanner;

public class Main
{
static Scanner console = new Scanner (System.in);

    public static void main(String[] args) throws IOException {
           int j = 0,mem,os=0;
           
        System.out.print("Enter Memory Size: ");
        mem = console.nextInt();
        os=(int) (mem * .20);
        System.out.print("The Size of OS is "+os);
        


        if (j < 1 || j > 10)
	        {
	            System.out.println("Enter number of jobs : ");
	            j=console.nextInt();
	        }


          if (j >= 1 || j <= 10)
	            {
	                int ctr;
                        int ws = 0;
                        int sum = 0;
                        int sum1=0;
                        int sum2=0;
                        int sum3=0;
	                int[] job = new int[j];
                        int[] was= new int[j];



	                    for (ctr=0; ctr<j; ctr++)
	                    {
	                         System.out.print("\nEnter Job "+ (ctr+1) +": ");
	                         job[ctr] = console.nextInt();
                                  }
                          for (ctr=0; ctr<j; ctr++)
                          {
        ws=mem-job[ctr];
        System.out.print("\nJob "+(ctr+1)+" Memory Wasted : "+ws+"\n");
        was[ctr]=ws;

                        }
 

                         for (ctr=0; ctr<j; ctr++)
                          {
        System.out.print("\nJob "+(ctr+1)+" Memory Usage : "+job[ctr]+"\n");

                        }
         for (ctr=0; ctr < job.length; ctr++){
        sum +=job[ctr];
                        }
        int total = sum;
           System.out.print("\nTOTAL JOB: "+total+"\n");


            for (ctr=0; ctr < job.length; ctr++){
        sum1 +=was[ctr];
                        }
        int total3 = sum1;
           System.out.print("\nTOTAL WASTED MEMORY: "+total3+"\n");


            for (ctr=0; ctr < job.length; ctr++)
            {
        sum2 += job[ctr]*100/total;
                        
           System.out.print("\nTOTAL JOB PERCENTAGE OF EACH JOB: "+sum2+"\n");


                        }

         for (ctr=0; ctr < job.length; ctr++)
            {
        sum3 += job[ctr]/4;
                        }
           System.out.print("\nTOTAL JOB PERCENTAGE OF ALL JOB: "+sum3+"\n");


                        }
    }
  
}

Edited 6 Years Ago by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

This article has been dead for over six months. Start a new discussion instead.