Code Monkey home page Code Monkey logo

quizapp's Introduction

Quiz App

img.png

A Quiz made in Java with GUI.It contains history questions with 4 possible answers.It`s like that ,because I love history. You have 15 questions, and after you make your answers ,you get the number of the right ones. You don't have to look in the Internet ,if the right answers of the question are accurate. Just believe me,I know they are :) :) .After you finish the quiz you don't see your wrong answers.

Quiz class

The Quiz(Main) class which just makes a new QuizFrame object.

QuizFrame

Here we make the starting frame,which just contains a starting picture and a "Start Quiz" button which makes new QuizPanel,that contains the Quiz.If you click the "Start" button when the quiz is already started,the quiz is just restarted ,with the previous result completely forgotten.

img_1.png

QuizPanel

The QuizPanel class contains the quiz with question made as a JLabel and 4 possible answers made like a Buttons.There is also a counter for the answered questions out of 15 possible.

Start Window

img_2.png

When you start the quiz actually you get a MessageDialog that contains a really important message to the one playing the quiz.

img_3.png

The question you get is, of course, randomised for better replayability. In the "getRandomNumber" function you get random number from 1 to 35(currently the number of possible questions).When a question is used ,it its index is saved in an array, so it cannot be repeated more than once.That`s what the function "SafeQuestion" does,It looks if the index of the question exists in the array.If it does, we get an index of a new question , until it is not used.

img_4.png

In "GetQuestion" function I use a switch to get the labels of the question and possible answers. And the question is added to the array of used questions and the index of the question is saved.

img_5.png

When you click a button that you think contains the right answer ,there is a switch that includes the indexes of the questions that have this button as a right answer. If the index is there you get a point for a right answer

img_6.png

Then ,if the question is not last(the 15th) you get a new question. The quiz is made in such a way,that the buttons have equal amount of right answers.

After you answer to 15 questions you get a message that tells you how many are right.You don't know where your mistakes are, and that is made on purpose.This is made to see your knowledge,not to learn,although I could make a friendlier version in the future.

img_7.png

After you click "OK" on the message ,the frame with the quiz is closed and you cant start the quiz again, how many times you want.

quizapp's People

Contributors

cavani99 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.