Make your own free website on Tripod.com

The Quiz Class

Write a quiz class that will ask a question and give you 4 possible answers. You will then type in an answer from the keyboard and the computer will tell you if you are right or wrong.

This program uses 6 parallel arrays of strings.

Once you get it working print it out.

Then redo program so that the questions come out in random order with no repeats.

import java.io.*;

class quiz
 {input in = new input();

 public quiz()
  {fillarrays();
  }

  private String [] q = new String[10];
  private String [] a1 = new String[10];
  private String [] a2 = new String[10];
  private String [] a3 = new String[10];
  private String [] a4 = new String[10];
  private String [] ans = new String[10];
  double right = 0;
  int ct = 10;

 public void takeTest() throws IOException
   {
     }

   public void printScore()
    {
    }


  private void fillarrays()  //should be called from constructor
   {

    }

    public static void main(String[] args) throws IOException
     {quiz q = new quiz();
      q.takeTest();
      q.printScore();
     }
  }