Home > IB Computer Science 2017 > Java code to test your rainfall quiz answers…

Java code to test your rainfall quiz answers…

October 12, 2015 Leave a comment Go to comments
package rainfall;
import java.util.Random;

public class Rainfall {

  int[] rainfall = new int[365];
  int[] months = new int[12];

  public static void main(String[] args) {
    Rainfall rf = new Rainfall();
    rf.go();
  }

  void go() {
    Random r = new Random();
    for (int i = 0; i < rainfall.length; i++) {
      rainfall[i] = r.nextInt(100);
    }
    months[0] = 31;
    months[1] = 28;
    months[2] = 31;
    months[3] = 30;
    months[4] = 31;
    months[5] = 30;
    months[6] = 31;
    months[7] = 31;
    months[8] = 30;
    months[9] = 31;
    months[10] = 30;
    months[11] = 31;
    
    question1();
    question2();
  }

  void question1(){
    // test your code here  
  }

  void question2(){
    // test your code here
  }

}
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s