Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Harddisk;
- import java.lang.String;
- import java.io.*;
- public static void main(String[] args)
- {
- final int MAX_HD = 5;
- Harddisk hhd[] =new Harddisk [MAX_HD];
- int a=0,c;
- float d=0;
- hhd[0]=new Harddisk("Hp", 50, 320, 50);
- hhd[1]=new Harddisk("Dell", 30, 450, 70);
- hhd[2]=new Harddisk("Gigabyte", 70, 400, 60);
- hhd[3]=new Harddisk("Toshiba", 80, 380, 45);
- hhd[4]=new Harddisk("Kingston", 25, 450, 80);
- // for(int b=0;b<MAX_HD;b++)
- // {
- // hhd[b]= new Harddisk();
- // hhd[b].leggiDati();
- // }
- //max
- for(int b=0; b<MAX_HD;b++)
- if(hhd[a].punteggio()>hhd[b].punteggio())
- a=b;
- System.out.println("\nL'Hard Disk con il punteggio maggiore è il numero "+a+" e le sue specifiche sono le seguenti:\n");
- hhd[a].stampaDati();
- //min
- for(int b=0; b<MAX_HD;b++)
- if(hhd[a].punteggio()<hhd[b].punteggio())
- a=b;
- System.out.println("Mentre quello peggiore è il numero "+a+" e le sue specifiche sono le seguenti:");
- hhd[a].stampaDati();
- //media
- for(c=0;b<MAX_HD;c++)
- d+=hhd[c].punteggio;
- System.out.println("\n\nLa media dei punteggi degli hard disks è "+(d/c));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement