Package data

Examples of data.QuestionList


     * @param args the command line arguments
     * @throws java.io.IOException
     * @throws java.lang.ClassNotFoundException
     */
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        QuestionList questionList = new QuestionList();
        Context context = null;
        int attempt = 0;
        int rightAnswers = 0;
        String result;

        ServerSocket server = new ServerSocket(24891);
        System.out.println("Server Started");
        Socket socket = server.accept();
        System.out.println("New client on port" + socket.getPort());
        ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream());
        ObjectInputStream input = new ObjectInputStream(socket.getInputStream());
       
        while (true) {

            if (questionList.next() != null) {
                context = readQuestion(questionList.next());
            }
            output.writeObject(context);
            output.flush();
            context = (Context) input.readObject();

            attempt++;
            if (questionList.isRight(context.getVariant())) {
                result = "Congratulations! It is the right answer";
                rightAnswers++;
            } else {
                result = "It is the wrong answer";
            }
View Full Code Here

TOP

Related Classes of data.QuestionList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.