Building Multiple Math Games?

Nov 23, 2014

building a game. the game is all about the multiple times table with levels. easy medium and difficulty. I dont even know where to begin and what is the codes to use or even the platform. what websites can be access etc and what is the big deal with code tags.

View Replies


ADVERTISEMENT

Building DOM Object From Multiple Threads

May 21, 2014

My multi threaded application processes and loads records into an ECM repository. For reconcliation purposes , I am trying to build an XML format report with the results of the processing per record, while processing is underway per thread. The method below is called from every thread wvery time its ready to append an element to the DOM with the status.

public void writeReportLine(Element rptLine) {
// Write output to report file
synchronized (XMLReportHandler.class) {
reportOutput.getDocumentElement().appendChild(rptLine);
}
}

After all processing completes, the below method is called only once by every thread to write to the File on the file system:

public void writeToReportFile() {
synchronized (XMLReportHandler.class) {
try{
//write the content into xml file
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(reportOutput);
 
[Code] ....

The problem is that when under load, the threads just seem to hang while the transformer.transform(source, result) call keeps getting executed until there is an interrupt of some sort. I was able to examine a section of what was appended and it was status for records that had finished processing very early in the process based on my application logs. Once an interrupt is recieved , it looks like the threads recover.

View Replies View Related

Math Integration Across Multiple Arrays

Feb 14, 2014

I am trying to complete an assignment and I am stuck on a key point. I must print the total inventory value across each of these arrays, as it prints for each "list". To do this, I understand that I need some form of correlation between my variables "total" and "Price" between each array. My quandary lies in the way that I have designed this code to begin with. I am not sure where to add the math section of code that is needed, nor am I fluent enough with Java to know how to call all of the arrays as it prints. Listed below is my code, when you compile it the total inventory value is 0 for each "list".

package inventory;
public class Inventory {
public static void
main (String[] args) {
List[]list = new List[5];

[code]...

View Replies View Related

Frames Per Second In Games

Nov 13, 2014

I have a question about Frames per second in games. In a simple game i should be able to pull off 60(exactly), right? So if i have this code for a game loop:

while(shouldRun){
Thread.sleep(1000/60);
 //loop code here
}

will that run at 60 fps?

The loop code takes a tiny bit of time, then it waits for (a second/60), so overall the code will be running overall since the code takes some time?

Is this the case , and if so is there a solution?

View Replies View Related

Tracking Number Of Games Within Guessing Game

Aug 22, 2014

/*
/ GuessGame.java
*/

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

[code]....

tracking the number of games played, and also when running the code, I have to press "1" twice for it to actually load up the game again.

View Replies View Related

Snake Eyes / Craps Dice Games

Jul 24, 2014

I am having a problem with my java program. My goal is to request the user to enter how many times they want to roll a pair of dices. Each dice have numbers 1-6. When rolling the dices, I randomly pick a number from each dice and total the number. My goal is to calculate the number of times snake-eyes was rolled which is a total of 2 and total number of times a total of 7 was rolled. Here is my code. I am calling the rollDice method to perform the random pick and calculations. The error I am getting is at the bottom of the code.

package dice;
import java.util.Scanner;
import java.util.Random;
public class Dice
{
public static void main(String[] args)
{
int numRolls; // number of rolls

[code]...

How many times would you like to roll the two dice? 1000 Exception in thread "main" java.lang.NullPointerException at dice.Dice.main(Dice.java:40)
Java Result: 1 BUILD SUCCESSFUL (total time: 4 seconds)

View Replies View Related

Pogo Games - Java Is Not Detected On Computer

Jun 6, 2013

I am unable to open Pogo Poker with out receiving an error message saying "Oops, Java is not detected on your computer" (or something similar). I have reinstalled it several times and get the same results.

View Replies View Related

FC Barcelona Database - Updating Number Of Games Played By The Player

May 25, 2014

So I am working on a database pertaining FCBarcelona. I have three classes FCBarcelona.java Player.java and Roster.java

I am working on a method that updates the number of games played by the player ... Its not working it gives a runtime error ...

Roster.java
public Player changeNumGamesPlayed(Player nPlayer)
{
int index = play.indexOf(nPlayer);
if(index == -1)
return null;

[Code] .....

View Replies View Related

Jump Games - Put Images Into JTable For Organization And Character Selection Purposes

Jul 14, 2014

HTML Code:

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.border.Border;
import javax.imageio.ImageIO;
public class Main extends JApplet implements Runnable, ActionListener {

[Code] .....

I am making a game and there are two problems that I have and can't seem to solve. I never made on applet before, and I'm not good with the swing components, but I am decent programming in Java.

Problem #1: the start button is in the JPanel, I don't want that, I want it to be above the JPanel.
Problem #2: I want to put images in to a JTable for organization and character selection purposes, but I keep on getting a string. Do I have to use an ImageIcon to get it to work, or does it matter?

In case you were wonder what kind of game I'm making, I'm making one of those jump games where you jump on platforms and try to go as high as you can without missing a platform. There is going to be character selection for the jumper, and the jumpers are going to be food, like a potato, a banana, a strawberry, etc.

View Replies View Related

Building A Pyramid From Blocks?

Apr 15, 2014

I am trying to make a pyramid from blocks . I know that for example to make a bigger block from small blocks you write something like :

for(int i = 10 ;i <=1 ; i--){
for (int j= 10 ;j <= 1 ; j--) {
< statement to create block where you use both i and j to define the location of each block>
}
}

but i cant seem go grasp how to make a pyramid , so far my best effort is :

int i =10 ;
while (i >=1 ) {
for( ; i>=1 ; i-- ){
< statement to create block > }
}

At the moment visually i don't get a pyramid but it might be because of other issues and not because of the while and then a for inside it approach .

My approach is correct and if now what would be the correct one to create a pyramid from smaller blocks ?

View Replies View Related

Building A Registration System

Jan 18, 2015

I'm assigned along with two others to make this program for a project.

We need to store data to the program by adding them such as user_id among the 5 criterias that are needed. Lets say I want a new user, I need the program to give me that option and then I would type in the user id and the program would store that data information

As far as I'm aware, boolean, screentokenizer and scanner is involved in the making of this program.

View Replies View Related

Graphics - Drawing A Building

May 28, 2014

I have to write a program for class that basically uses Paint Component to draw a bunch of rectangles to look like a building then have them change color randomly. I am stuck I can't figure out how to make it draw the rectangles in rows and columns to look like the building i can make it display multiple squares randomly however but thats not the assignment.. here is my code

package labBuilding;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
@SuppressWarnings("serial")
public class Building extends JPanel {

[code]....

View Replies View Related

Return Statements While Building A JPanel

Mar 30, 2014

I'm having this where i'm trying to return a JPanel with tempPictures but only if they aren't already filled with "actual" pictures. However this causes problems because your never shore that the if statement will execute. I tried adding an else statement but i cant return null i must return a JPanel;

private JPanel buildTopShelf() {
if(myMediaHandler.mediaList.size() < 6) {
JPanel mediaPanel = new JPanel();
mediaPanel.setOpaque(false);
mediaPanel.setLayout(new GridLayout(1,6,22,0));
mediaPanel.setBounds(90, 14, 1020, 210);
 
[Code] ....

View Replies View Related

Building A Small Text Based RPG

Dec 18, 2014

i'm totally new to Java.I'm making a small text based RPG and this is what i've come up for now.

Java Code:

import java.util.Scanner;
class Main {
public static void main(String args[]){
Scanner input = new Scanner(System.in);
Player playerObject = new Player();

[code]....

My thing is that i want the user to enter 'Caucasian' or another race in the console below and i want it to be saved in a variable or something else in the Player Class that i can later use it in texts or something else. My question is how can i do it?

I tried like 'int Mongoloid = 1; int Caucasian = 2;'

And the same with the others, and after that i tried to use them with the Switch Statement but it did not work.

View Replies View Related

Building Tree Using Inorder And Postorder Array

Jul 13, 2014

I'm trying to build a binary tree using two arrays I'm given, one is inorder and the other is postorder and I have to construct the tree based on that. I understand the strategy I need to use- the last element of the postorder array tells me the root node, and wherever the value of that node occurs in the inorder array is where the tree is split. I can then apply this idea recursively to build the tree. For whatever reason though, I keep getting stack overflows.

Here's what I have so far:

public static class TreeNode {
char val;
TreeNode left;
TreeNode right;
TreeNode(char newVal) {
val = newVal;

[Code] .....

View Replies View Related

Building Calendar With Automated Employee Vacation Planner?

Apr 4, 2014

Every year, she has to plan when her employee's can go on vacation for the summer holidays - MANUALLY. It takes weeks to solve the puzzle, because she has several kinds of employee's hired, with different skills. And at all days there must be X amount of employees with skill1 at work, plus Y amount of employees with skill2 etc, and they also need special "off-days" in comparison to when they last worked and so on. It's quite the math puzzle.

I've worked a little with C#, and built a prototype of a Support System (Ticket based), so I got the basics down of programming, and I know Java and C# are quite alike, so I don't think making the switch will bother me that much.

The program should be easy to use for her, so it needs a visual calender that can be interacted with, and it should also be easy to see which employee is at work at that date and so on.

Will it be hard for me to build this kind of Calender, that allows the interaction I want?

Any open-sourced projects, or libraries that will make my task easier?

I plan on using NetBeans IDE for this project.

View Replies View Related

Building A Document Based On A Series Of Check Box Selections?

Jan 17, 2014

I'm trying to build a program that would present the user (well...me) with a rather large list of various check boxes (and combo boxes, etc...but for sake of the question I'll limit it to check boxes) and the selections would not only need to be stored in some way so they could be reloaded, but also they would need to have the "data" used to build sentences.

For example, part of the form would have a checkbox list like:

Emotional Issues -
Emotion 1, Emotion 2...Emotion 40

Then, at the end of the form I would be able to save client, load client, or generate report. When doing the generate it would output something like:

"Client's first name reported having emotional disturbance in areas of 'Emotion 1', 'Emotion 4', and 'Emotion 12'."

There, of course, would be probably several hundred check boxes, combo boxes, etc. throughout this program building a rather complex "report" when it's all said and done. So where I am stumped in on the methodology or approach that would be best for getting, storing, retrieving, and outputting this information.

View Replies View Related

Applet Java GUI Building To Display Words To User

Nov 17, 2014

Implement an applet that display historical facts. The applet will include facts from october 28 to december 4th to test the applet.

What is the best thing to add text in my GUI - JLabel, JTextArea? I am trying to display different words on my csFacts. Once a user click button yesterday and button tomorrow?

public class Facts extends JFrame implements ActionListener{
private JButton button1,button2;
private JPanel panel;
private JLabel label;
TextField ri = new TextField(50);
private void createGUI(){
setDefaultCloseOperation(EXIT_ON_CLOSE);

[Code] .....

View Replies View Related

JSF :: Building Web Frontend For Command-Line-Based Software

Jun 17, 2014

The goal of this software is to provide a web interface which must be able to manage the Quagga routing daemon. For those who don't know Quagga, the only interface it provides the user is its built-in cli. My project must convert web events to commands and vice-versa. how I'm going to maintain quagga's configuration state synchronized with JSF's managed beans. The example below shows the commands one must run on quagga's cli in order to add a BGP neighbor:

neighbor 10.0.0.1 remote-as 65535
neighbor 10.0.0.1 description "Just a Test"
neighbor 10.0.0.1 next-hop-self
neighbor 10.0.0.1 soft-reconfiguration inbound
write memory

In order to represent this piece of information in my project, I was thinking about mapping this to a class:

public class BGPNeighbor {
private String ip_address;
private Integer asn;
private Boolean next_hop_self;
private Boolean inbound_soft_reconfiguration;
}

With this I would parse the information from Quagga's configuration and map this to classes in my software. I think it's a lot easier to do with database-based software, the problem with this project is that it's not completely database oriented. The information must be fetched from the network, parsed, converted to classes and then they would be available to JSF as managed beans. Any alteration to this classes must be converted to quagga cli commands which must be executed through the network again (telnet).

View Replies View Related

Factory And Singleton Design Patterns - Building A Simple Form

Nov 20, 2014

My assignment was to create a simple form that demonstrates the use of the factory and singleton design patterns. "Use the Factory pattern to ensure that each form input consists of a text label and a textfield. Use the Singleton pattern for the submit button."

Here's what I have:

Form.java file

interface Form {
public void getFormField ();
}
Name.java file (I have a similar files just like this for Address.java, City.java, State.java, Zip.java and Phone.java)
import java.util.Scanner;
class Name implements Form

[Code] ....

It compiles at the moment but I get a null pointer exception in the main method of the FormFactoryDemo file.

View Replies View Related

Calculating Sin(x) Without Using Math

Sep 14, 2014

I'm trying to calculate sin(x) without using Math.sin(x). The formula for sin(x) is: x - x^3/3! + x^5/5! ... I can't seem to get the coding for the alternating +/- right. Here's my program:

import java.util.Scanner;
import java.lang.Math;
class Sin
{
public static void main(String[] args)
{
Scanner kb = new Scanner(System.in);
int n, c, fact = 1, count = 1;
double x, sum = 0, sum_sin = 0, result;

[Code] ....

View Replies View Related

Split A Math Expression?

Feb 27, 2015

I have a math expression in a String, that I want to split into 4 pieces as in the following example:

String math = "23+4=27"
int num1 = (23 STORES HERE)
int num2 = (4 STORES HERE)
String operator = (+ STORES HERE)
int answer = (27 STORES HERE)

Note that the operator can be either + - * /

View Replies View Related

Using MATH Class For Assignment?

Sep 18, 2014

Here is the assignment:

Prompt the user to input two sides (a and b) of a right triangle. Calculate, using the

formulas below, the hypotenuse and the other two angles of the triangle. Calculate the

perimeter and the area.

Here are the formulas:

a^2 + b^2 = h^2

sinθ = a/h

A + B + C = 180 degrees

how to start this program out, i know which math classes i need to use.

View Replies View Related

String To Math Operation

Sep 14, 2014

Given a string of numbers and operator. Compute as follows:

Consider, "000293000002030403+0400293059694" is the input.

a. Separate the two operands and one operator:
"000293000002030403" "+" "0400293059694"

b. On each string operand, take each digit. ADD them all.
(2+9+3+2+3+4+3) + (4+2+9+3+5+9+6+9+4)
The two string operands should now become two integers.

c. Lastly, perform the operation using the string operator specified on the original string.
26 + 51 = 77

I don't know why I get the sum of 52 when I use a for loop.

Here are my codes:

public class string2math {
public static void main(String[] args) {
String input = "000293000002030403+0400293059694";
String [] operand = input.split("+");
String firstOpera = operand[0];

[Code] ...

View Replies View Related

Use Math Methods Without Import In IDE

Feb 22, 2014

package statics;
public class Test_main {
public static void main(String[] args) {
Math.log(50.00);
}
}

I am able to use a Math method without importing the java.lang.Math. Which makes me think

1) What is the use of the import statement in java?
2) Is my IDE taking care of the import automatically?

I am using Eclipse IDE and JDK 1.7.

View Replies View Related

Outputs Not Displaying Correct Math

Oct 14, 2014

I'm having extreme troubles with my outputs not displaying the correct math. I have everything organized how I want it, it's just not giving me the correct answers.

The code is supposed prompt the user to enter an investment amount and an interest rate and display the future investment amount for years 1-30. The formula for this is:

futureInvestmentAmount = investmentAmount * (1 + monthlyInterestRate)^(numberOfYears*12)

Here is my code:

import java.util.Scanner;
public class InvestmentValue {
public static void main(String[] args) {
  // prompt user to enter data
Scanner scan = new Scanner(System.in);
System.out.println("The amount invested: ");

[Code] ....

And I have to use a method to do this as it is what we are learning in class right now. A sample output as of now is:

The amount invested:
1000
Annual interest rate:
9
Years Future Value
11.0E15
21.0E27

[Code] .....

And obviously a future investment amount cannot equal infinity.

View Replies View Related







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