Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class BlankScreen6 {
- public static void main(String[] args) {
- //declare new integer array, calls
- int[] calls;
- //allocate memory for 7 integers
- calls = new int[7];
- //initialize array values
- calls[0]=2;
- calls[1]=9;
- calls[2]=4;
- calls[3]=7;
- calls[4]=24;
- calls[5]=9;
- calls[6]=13;
- //call displayData method with calls as an argument/parameter
- displayData(calls);
- System.exit(0);
- }
- public static void displayData(int calls[]){
- int highest=0;
- for (int i=0; i<7; i++){
- if (calls[i]>highest)
- highest=i;
- }
- System.out.println("The highest amount of calls was on day " + (highest+1) );
- }
- }
Add Comment
Please, Sign In to add comment