Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- class TrafficData
- {
- public static void main(String[] args)
- {
- int[] vehicles=new int [7];
- String s;
- for (int i =0; i <vehicles.length; i++)
- {
- s=JOptionPane.showInputDialog(null,"Enter number of vehicles");
- vehicles [i]= Integer.parseInt(s);
- }
- displaydata(vehicles);
- System.exit(0);
- }
- public static void displaydata(int vehicles[] )
- {
- int max=0;
- for (int i =0; i<7; i++)
- {
- System.out.println("The number of vehicles on day\t" + i + "="+ vehicles[i]);
- if (max<vehicles[i])
- max=vehicles[i];
- }
- System.out.println("The Highest Traffic of the week is =" + max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement