NetBeans Quiz Game

Oct 27, 2014

I are having some trouble with our quiz that we made in NetBeans. The problem we have is that when we press play the question opens in a new window ( if we klick this button imgur: the simple image sharer this happens imgur: the simple image sharer but we want it to look like this imgur: the simple image sharer when we press the button). the code we are using for the button is imgur: the simple image sharer.

View Replies


ADVERTISEMENT

Open Answer Quiz Game Using Java

Nov 1, 2014

I want to design an open-answer quiz game using Java. Basically, the plan is to design a quiz where the name of a medicine is displayed as "the question" and the player will need to input the unique code (as "the answer") of the medicine in an open box (all the codes are two characters). The list has about 204 named medicine (with potentially more to be included at a later stage). The questions will not appear in the same order for each session restarted; they will appear randomly.

The player will have 60 seconds, and for each correct answer, will score 1 point and add 2 seconds to the timer. The player will also have 6 "lives", and for each incorrect answer, the player will lose a life, with no effect on the time.

The idea of the game is that the player memorise as many of these medicine codes as possible.

View Replies View Related

How To Make A Game Using Images (like Logo Quiz)

Jan 11, 2015

i am making a game in java eclipse which has a 3 category for kiddie, teenage and young adult, that also has subcategory which Q&A and images, my problem was i cant make an images quiz (like a logo quiz) that is randomize what i only made was to display an only one image if i clicked button and its only one image, how can i make showing one image then another one image if i clicked some button like NEXT...

This are the codes i used!

package com.example.exampleimage;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.onclickListener;

[Code] .....

View Replies View Related

Design Open Answer Quiz Game

Oct 31, 2014

I want to design an open-answer quiz game using Java. Basically, the plan is to design a quiz where the name of a medicine is displayed as "the question" and the player will need to input the unique code (as "the answer") of the medicine in an open box (all the codes are two characters). The list has about 204 named medicine (with potentially more to be included at a later stage). The questions will not appear in the same order for each session restarted; they will appear randomly.

The player will have 60 seconds, and for each correct answer, will score 1 point and add 2 seconds to the timer. The player will also have 6 "lives", and for each incorrect answer, the player will lose a life, with no effect on the time.The idea of the game is to support the player memorise as many of these medicine codes as possible. How this can be achieved from total grassroots.

View Replies View Related

Quiz Game Program - Random Number Generator

Nov 18, 2014

I've run into some problems with my Quiz-game program. What I basicly want it to do is generate a random number that is tied to the other windows I have for the program (I want a new random question to be generated once I have guessed on the first one). I've read about a few different ways to approach this but everything I get is a pure number generator.

I imported

import java.util.Random;

into my program but I don't know where to go from there.

View Replies View Related

How To Do Subtraction Quiz Program Using Input Dialog Quiz

Oct 14, 2014

How can I do a subtraction quiz program using input dialog quiz?

View Replies View Related

Using A Timer In Java Quiz

Apr 17, 2014

I am currently making a quiz for a project. I am almost finished, but I need to use a timer.

Here is what I want to happen:

The user to has 15 seconds to answer each question. If they answer, they are given the option to move to the next question, or leave the quiz. If they answer incorrectly, the quiz closes. If they do not answer within the 15 seconds, the program treats this as an incorrect answer, and the quiz closes.

Here is a section of the quiz code which includes the start of the code to the end of the code for the first question:

Java Code:

package quiz;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.util.Scanner;
import javax.swing.AbstractButton;

[Code] ....

View Replies View Related

Program To Get Quiz Scores

Oct 25, 2014

So for this project I'm going to take in some quiz scores, then eventually get the total number, the range, the mean, and others... Here's the instructions for the two methods I need to create but am completely stuck on:

2. public boolean inputData(Scanner in)
2.1.takes in a Scanner object passed in from main()
2.2. asks the user for a number in the range of 0 through 100.
2.3.It must read a number into an integer variable unless a non-number value is entered, in which case the method will return false. You may use try/catch or an if statement for this.
2.4.If the datum/score seems acceptable, the addGrade method must be called.
2.5.If addGrade returns false, then inputData should throw an IllegalArgumentException or return false
Otherwise, inputData should return true. See section 11.4 for exceptions.

3. public boolean addGrade
3.1.takes in an integer grade. If grade is not in the range of 0 through 100 the method should return false.
Otherwise, it should appropriately change the values of numberOfQuizzes, highValue, lowValue,
3.2.totalQuizScore , sumOfSquares (used in variance calculation), and add one to the count of the proper variable for A's, B's, C's, D's or F's. The method should then call calculate and return true

Now I have done very little with booleans in class at all, so this is all very confusing for me. I've tried to do a lot of research on my own and so far I came up with the following for the two methods above:

public boolean inputData()
{
int score = 0;
System.out.println("Please enter values, Q to quit:");
Scanner in = new Scanner(System.in);
while (in.hasNextInt())

[Code] ....

Honestly I'm not really sure what I'm doing wrong at all, and I have done a lot of research but can't really find anything too similar to what the instructions want so I'm not sure what's right/wrong.

View Replies View Related

Event Handlers With Flag Quiz App

Jun 6, 2014

regionsBuilder.setMultiChoiceItems(
displayNames, regionsEnabled,
new DialogInterface.OnMultiChoiceClickListener()
{
@Override

[code]...

Questions:

1. Describe what the code displays. A error message would be shown when the use has selected an insufficient number of options.

2. Describe when an event handler (included in the code) gets executed? The event handler gets executed every time a user selects an option(???)

3. Explain a feature of what is displayed

4. Explain the meaning of all of the parameters in the central, complicated call of the code.

5. Describe how the code handles two possible situations.When the user has selected a sufficient number of options (no less than or equal to 0), then no error message would be shown. On the other hand, an error message will be shown when the user has not selected a sufficient number of options (0). (???)

View Replies View Related

JSP :: Online Quiz - Sending Resultset From Servlet

Mar 12, 2014

I am building an online quiz. I created a database , bean , controller and jsp. I connected database, wrote query , put resultset in arraylist of object and passed it to jsp. My program runs but arraylist size increases everytime and same question get displayed repeatedly . i cant find the error. Everytime i run the program arraylist size increases. I think it is adding same rows again ang again. here is my code for controller and jsp.

servlet code:

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();

[Code] .....

View Replies View Related

Adding Images / Colors Into A Java Quiz

Mar 26, 2014

I am making a quiz in Java. I need to be able to add images and colours into my quiz, to make the GUI look more appealing. At the moment, the JOptionPane that I am using looks very plain and boring. I want to be able to have my quiz running the same as it is at the moment, but I want to be able to import the images, add colours, and add Here is a copy of my quiz code:

Java Code:

package quiz;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.util.Scanner;
import javax.swing.AbstractButton;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

[code]....

how I have added the images into the src folder:

View Replies View Related

Creating A Quiz In Java With 3 Multiple Choice Questions

Oct 20, 2014

I have to write a short quiz that consists of 3 multiple choice questions. When the question is answered wrong I have to get it to loop back and ask the same question until the question is answered right.

I think I have the majority of my variables assigned and I have the scanner set up.

System.out.println("Question 1- Which TV sitcom recently had it's 20th anniversary?");
System.out.println("1. Two and a half men " + question1 + ".Friends 3.The Fresh Prince of Belair h.Get a hint");
answer2 = stdIn.nextInt();
if (answer2 != question1) {
System.out.println("Your answer was incorrect, please try again or pick h for a hint");
} else {
}

View Replies View Related

Quiz Program - Removing Enter Key Space After User Input

Oct 20, 2014

I am writing a short quiz program, and when the user inputs their answer they hit the enter key (the are int). But the last question on my quiz is asking the user to they want to repeat the quiz, but when I run the program, it won't allow me to input any information. I can briefly remember my lecturer saying something about entering in a code after each int the user inputs but I can't remember what it was.

Here is a snippet of my code:

//Question 3
do{
System.out.println("Question 3- What Hollywood actor did Mila Kunis have a baby with recently?");
System.out.println( question3 + ".Ashton Kutcher 2.Bradly Cooper 3.Leonardo Dicaperio h.Get a hint");
answer3 = stdIn.nextInt();
if(answer3 != question3)

[Code] ....

View Replies View Related

Servlets :: Quiz - Match Request URL To Correct URL Pattern In Deployment Descriptor

May 28, 2014

How to map a request URL to a url pattern in deployment descriptor. I got all the answers right, but I am not sure if the thought process is correct.

<servlet>
<servlet-name>One</servlet-name>
<servlet-class>foo.DeployTestOne</servlet-class>
</servlet>
<servlet-mapping>

[Code] .....

1) [URL] ....
Container choice: DeployTestOne (matched the *.do extension pattern)

Exact match check: Is there a URL pattern in DD which is exactly = /MapTest/blue.do ? NO.
Directory match check: Is there any URL pattern in DD for directory /MapTest ? NO.
Extension match: Is there a pattern in DD for files with extension .do ? Yes !
Select DeployTestOne !

Question - When doing an Exact match check, does the container look for blue.do in DD or does it look for /MapTest/blue.do ?

2) [URL] ....
Container choice: DeployTestThree (matched the /fooStuff/* directory pattern)

Exact match check: Is there a URL pattern in DD which is exactly = /MapTest/fooStuff/bar/blue.do ? NO.
Directory match check: Is there any URL pattern in DD for directory /MapTest/fooStuff/bar ? Yes !
Go for the url pattern for longest pat, that is, /fooStuff/*

Question - When doing the directory match check, does the Container look for /MapTest/fooStuff/bar/ or just /fooStuff/bar ?

View Replies View Related

Opoly Game - Goal Of The Game Is To Reach Or Exceed Reward Value 1000

Mar 12, 2015

Opoly works this way: The board is a circular track of variable length (the user determines the length when the game app runs). There is only one player, who begins the game at position 0.

Thus, if the board length is 20, then the board locations start at position 0 and end at position 19. The player starts with a reward of 100, and the goal of the game is to reach or exceed reward value 1000. When this reward value is reached or exceeded, the game is over. When the game ends, your program should report the number of turns the player has taken, and the final reward amount attained.

In Opoly the game piece advances via a spinner - a device that takes on one of the values 1, 2, 3, 4, 5 at random, with each of the five spin values equally likely.

Although the board is circular, you should draw the state of the board as a single "line", using an 'o' to represent the current player position, and * represent all other positions. Thus if the board size is 10, then this board drawing:

**o******

means that the player is at location 2 on the board.

Here are the other Opoly game rules:

If your board piece lands on a board cell that is evenly divisible by 7, your reward doubles.

If you land on the final board cell, you must go back 3 spaces. Thus if the board size is 20, the last position is position 19, and if you land there, you should go back to position 16. (If the position of the last cell is evenly divisible by 7, no extra points are added, but if the new piece location, 3 places back, IS evenly divisible by 7, then extra points ARE added).

If you make it all the way around the board, you get 100 points. Note that if you land exactly on location 0, you first receive 100 extra points (for making it all the around), and then your score is doubled, since 0 is evenly divisible by 7,

Every tenth move (that is, every tenth spin of the spinner, move numbers 10,20,30,... etc.), reduces the reward by 50 points. This penalty is applied up front, as soon as the 10th or 20th or 30th move is made, even if other actions at that instant also apply. Notice that with this rule it's possible for the reward amount to become negative.

Here is the driver class for the game:

import java.util.*;
public class OpolyDriver{
public static void main(String[] args){
System.out.println("Enter an int > 3 - the size of the board");
Scanner s = new Scanner(System.in);
int boardSize = s.nextInt();

[Code] ....

heres the methods:

REQUIRED CODE STRUCTURE: Your Opoly class must include the following methods (in addition to the Opoly constructor) and must implement the method calls as specified:

playGame - The top-level method that controls the game. No return value, no parameters. Must call drawBoard, displayReport, spinAndMove, isGameOver.

spinAndMove - spins the spinner and then advances the piece according to the rules of the game. No return value, no parameters. Must call spin and move.

spin - generates an integer value from 1 to 5 at random- all equally likely. Returns an integer, no parameters.

move - advances the piece according to the rules of the game. No return value, takes an integer parameter that is a value from 1 to 5.

isGameOver - checks if game termination condition has been met. Returns true if game is over, false otherwise. No parameters.

drawBoard - draws the board using *'s and an o to mark the current board position. Following each board display you should also report the current reward. No return value, no parameters.

displayReport - reports the end of the game, and gives the number of rounds of play, and the final reward. No return value, no parameters.

View Replies View Related

Tic Tac Toe Game - Random Number Generator And Two Dimensional Arrays For Game Board

May 9, 2015

Im trying to make a tic tac toe game that you play against the computer using a random number generator and two dimensional arrays for the game board. Im not trying to make a GUI, the assignment is to have the board in the console, which I have done. I have run into a few problems with trying to get the computer player to correctly generate 2 integers and have those two integers be a place on the game board. Here is my code so far.

import java.util.Random;
import java.util.Scanner;
 public class TicTacToe {
 private static Scanner keyboard = new Scanner(System.in);
private static char[][] board = new char[3][3];
public static int row, col;
 
[Code] ....

View Replies View Related

Guessing Game - How To Reset Random Number When User Reset Game

Oct 2, 2014

I tried this program, its guessing game. Where program decide 1 number and user will guess number. I am getting 1 problem. When user want to play game again.the random number remain same. So where i can put reset random in code..? And 1 more question if I want to write driver code for this. What should i transfer to driver code.

import java.util.Random;
import java.util.Scanner;
public class GuessGame {
public static void main(String args[])
{
String choice="y";

[Code] ......

View Replies View Related

2D Array In NetBeans GUI

Aug 9, 2014

I am trying to create a program in NetBeans GUI builder and I am having trouble creating the 2D array. Here is what I have come up with so far:

private void enterButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
double time = 0;
try{
time = Double.parseDouble(timeText.getText());

[Code] ....

Right now it is printing what i need but I need to separate columns, not rows.

View Replies View Related

End Is Not Working In Netbeans

Jun 2, 2014

Currently the while near the end is not working in netbeans. It is saying illegal start of type. This whole section was working before when it was within the public static void method. I moved it to a separate class to try and clear up a, static variable problem. My question is can i fix it to keep it structured this way. Or do I have to put it back into the main method and try to work out the static variable problem a different way.

public class InventoryProgram {
double[] dvdprice; // defines variables
int[] dvdnum;
int[] dvdstock;
String[] dvdnames;
int count;
double total;

[code]....

View Replies View Related

Other Classes Not Recognised By NetBeans GUI

Jan 21, 2014

I'm working on a University project creating a simple game using Netbeans but I'm totally stuck. I've created a number of classes to perform various methods, such as throwing back formatted text but I can't get them to work from within a Swing GUI created in Netbeans.

The Main method simply creates an instance of another class called Game which then itself creates instances of a number of other classes (textEngine, timer) and also a Swing GUI Class. The GUI appears on screen ok and I've been able to get methods working inside the GUI such as changing pictures and text when clicking a button. But I CANT get the GUI class to recognise the instances of the other classes or access their methods. I've created an instance of the TextEngine class called tEng. So I type this code in the GUI class:

textField.setText(tEng.getPhrase(2));

getPhrase() returns a String based on the number passed in the argument. But Netbeans reports an error that tEng is not recognised as a symbol despit it being a member of the same package. Creating the instance of the class within the GUI class likewise fails:

TextEngine tEng = new TextEngine();

Again the class is not recognised.

View Replies View Related

Difficult To Create JAR In NetBeans

May 5, 2014

I'm trying to create a JAR in NetBeans, but I get messages.:

C: Users Administrator Desktop Project nbproject build-impl.xml: 993: The Following error occurred while executing this line:

C: Users Administrator Desktop Project nbproject build-impl.xml: 837: copylibs does not support the "excludeFromCopy" attribute

NetBeans does not generate the. JAR because disses errors.

My specs

Version of OS = Windows 7 64 Bit
Java version = 1.7.0_55
Netbeans version = 7.0.1

View Replies View Related

Stopwatch Program In Netbeans

Oct 18, 2014

This is a stopwatch program. Somehow, the run method in the displayUpdater does not get called. Overall, the program should have a start button and when the user clicks start, the button changes into a timer. My timer doesn't count here because the run method is not called.

import java.awt.event.ActionEvent;
import javax.swing.SwingUtilities;
public class StopWatchNew extends javax.swing.JFrame {
/**
* Creates new form StopWatchNew
*/
public StopWatchNew() {
initComponents();

[Code] ....

View Replies View Related

How To Write All Classes In Just One Tab In NetBeans

Oct 22, 2014

find a way to make all my clases in one single tab and not like this: URL....

because at the end of the exam, we have to paste the whole code (as one) in a specified web page, which instantly shows us the result. We need the whole code to be in just one page (like back in C++).

View Replies View Related

How To Link Netbeans To Netlogo

Mar 9, 2015

I want to connect netbeans to netlogo. I have a class: NetLogoConnection I want to call the class when I click on OK btn in my GUI. The codes are as following:

XML Code: import org.nlogo.app.App;
public class NetLogoConnection {
public static void main(String[] argv) {
App.main(argv);
try {
java.awt.EventQueue.invokeAndWait(
new Runnable() {
public void run() {

[code]....

View Replies View Related

Add XLSX Files To Netbeans

Sep 5, 2014

I'm running Netbeans 8.0 and attempting to use Apache POI to read various .xlsx files.

Currently, I'm getting a java.io.FileNotFoundException.

I'm using a Mac. What is the correct way to list the file path for my files in Netbeans? Also, is it possible to add the files to my actual project and access them inside the project?

View Replies View Related

Netbeans - Calculation In GUI Interface

May 12, 2014

I'm trying to create a GUI interface in Netbeans that calculates a phone bill.

I created a GUI interface that input:
- Account Name.
- Account Number.
- Number of Minutes the phone was used. (with a textarea so the user input the minutes)
- 2 JRadioButtoms so the user can chose the regular or premium service.
- Amount Due (+10% taxes) (also with a textarea)
- Clear/Enter/Result/Done Buttoms

And I need to output:
- Account Name.
- Account Number.
- Number of Minutes.
- Taxes
- Total Amount Due.

I have a couple of math formulas I have to add them to output the above however I'm new to java so I don't know which code to use.

The math formulas are:
-Regular charges = 20 + ( No. Minutes - 50 ) * 0.20
-Premium charges = 50 + ( No. Minutes - 75 ) * 0.50
-Taxes = ( Regular charges + Premium charges ) * 0.10
-Amount Due = Regular charges + Premium charges + Taxes

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved