32,199 Topics

Member Avatar for
Member Avatar for lj81

Hi all, I'm am very close to finishing my 2 player pool game with only a couple of rules left to add. I am currently trying to assign a ball colour (red or yellow) to the player who pots the first ball. I am at a loss at the minute …

Member Avatar for lj81
0
262
Member Avatar for babi.meloo

I need to design an application that determines and prints the number of odd, even, and zero digits in an integer value read from the keyboard. This is what I have so far. public static void main (String[] args) { int odd=0, even=0, zero=0; Scanner scan = new Scanner(System.in); int …

Member Avatar for NormR1
0
3K
Member Avatar for KarimFawaz

Hey guys, im new to programming, just took my first course in university. I'm currently trying to program a calculator that does multiplication, but its giving me this error: C:\Users\Karim\Documents\Karim.java:9: error: package Java.util does not exist import Java.util.Scanner; And ofcourse followed by a few other related errors. Anyone know how …

Member Avatar for stultuske
0
461
Member Avatar for babi.meloo

//**************************************************************************************************** // Project15.java Author: Lewis/Loftus/Cocking // // Write an application that plays the rock-paper-scissors game against the computer. When played // between two people, each person picks one of the three options at the same time and the winner is // determined. The program should randomly choose one of the …

Member Avatar for Taywin
0
4K
Member Avatar for KarimFawaz

Hey guys, im new to programming, just took my first course in university. I'm currently trying to program a calculator that does multiplication, but its giving me this error: C:UsersKarimDocumentsKarim.java:14: error: missing method body, or declare abstract public static void main(String[] args); Anyone know how to fix it? :( import …

Member Avatar for JamesCherrill
0
184
Member Avatar for Blax

Hello, I am currently working on a school project and ran into a little bit of trouble. Every time I compile the program I get 2 errors they are: cirlce.java:23: incompatible types found : java.io.IOException required: char letter = get.ioException(); ^ cirlce.java:37: possible loss of precision found : double required: …

Member Avatar for stultuske
0
285
Member Avatar for oneoderja

Modifty the Cash Register Class to create a file containing a sales receipt. The program should ask the user for the quantity of the items being purchased and then generate a file with contents to similar to the following: SALES RECEIPT UNIT PRICE: 10.00 QUANTITY: 5 SUBTOTAL: 50 SALES TAX: …

Member Avatar for stultuske
0
292
Member Avatar for sharlynjm

Hi all, i want a simple java code to convert currency to indian rupees...how to proceed?

Member Avatar for stultuske
0
120
Member Avatar for Marty1963

I wasn't able to get any response from my last post, so I'm rewording my question with hope that my question is easier to understand. I need to get a visitors location and display a custom header graphic based on the *Region* returned. For example: I live in Edmonton, in …

Member Avatar for chrislim2888
0
151
Member Avatar for WDrago

All, I am using Netbeans 7.2 to build a form. I added a Swing JTextArea to my form and all is well. I'd like to add a titled border to my JtextArea (or the JScrollPane in which it lives) but can't figure out how. I tried Right Click > Properties …

Member Avatar for WDrago
0
341
Member Avatar for oneoderja

I want to modify the Cash Resigter Code below to create a file containing a sales receipt. The program should ask the user for the quantity of items being purchased, and then generate a file with contents below: SALE RECEIPT Unit Price : $10.00 Quantity: 5 Subtotal: $50.00 Sales Tax: …

Member Avatar for stultuske
0
3K
Member Avatar for Gen.Asura

Hey, I posted earlier about arbitrary expressions and I did find solution to that. The question is how do I create random expressions? So far I've created codes to generate random operators and random numbers, how will I generate random expressions? E.g. a1,a2,a3 are variables for random numbers I've assigned …

Member Avatar for JamesCherrill
0
170
Member Avatar for Beastegargoyle

Hello, I am currently writing a card game in Java. My question is when I write the follwoing code below: `Inline Code Example Here` 38 // select a random number between 0 and 51 39 int second = randomNumbers.nextInt( NUMBER_OF_CARDS ); Will the program properly generate 52 cards? Should I …

Member Avatar for NormR1
0
318
Member Avatar for kupogu

write a Java program that allows the users to enter in any number of non-negative integers, whitespace delimited. The user terminates the list of numbers with a negative integer. The program then should print the average of non-negative numbers entered.

Member Avatar for JamesCherrill
-1
53
Member Avatar for KronoAngel

I am not to sure what the error is in my code but the order variable does not seem to initialise properly and hence my gui displays the wrong output, for example when cheese,tomato and chicken are selected it only displays Chicken with Tomato Tomato $12.75. Any help will be …

Member Avatar for stultuske
0
312
Member Avatar for ibthevivin

I'm totally lost. I have a programming partner and this is what he sent me. I can't get the program to compile. I don't know where to start. Any suggested place to start? package Assignment2; public class TooBigException extends Exception { private static final long serialVersionUID = 1L; public TooBigException(String …

Member Avatar for NormR1
0
265
Member Avatar for Chuckleluck

This might be a general math question, so excuse me if it doesn't belong here. I have an airplane that flies around the screen. Pressing the W key will make it counterclockwise, and pressing the S key will make it rotate clockwise. When I press space, it shoots bullets. However, …

Member Avatar for Chuckleluck
0
152
Member Avatar for nsharif

I would like to know what tool/class should I use to create a map that used for games? such example: user use key to move an object...and if moves then the more map will shown ... I admit, I did not do much research on this.. but I wanted to …

Member Avatar for nsharif
0
106
Member Avatar for mikewyatt

Problems clearing and adding items to Jlist box. I have a set of 12 items stored in each record of a database. These record items are named as follows: LANGUAGE1 LANGUAGE2 . . LANGUAGE12 I have no problems in accessing the database. rs.getString("LANGUAGE1") and so on.... I need to clear …

Member Avatar for mikewyatt
0
208
Member Avatar for Red_Rain

Hey Guys, Im new to learning java and I am writing a few programs for practice. I cant figure out whats wrong with my code. When i try to compile i get an "error . class expected" Any advice is appreciated, thank you. import javax.swing.JOptionPane; public class TuitionCost { public …

Member Avatar for dimasalang
0
147
Member Avatar for shawn.crego

I need help with my java code for the game hangman... we are using eclipse to write the game and using three main files to start...hangman.java hangmanlexicon.java and hangmancanvas.java. the first part of the assignment, is to create a ConsoleProgram for the game and this is what i have so …

Member Avatar for NormR1
0
245
Member Avatar for techxaidz

So i have this assignment, > Create a quiz game that displays, in turn five questions about any topic of your choice. All five questions should have the same three possible multiple-choice answers. For example, you might ask trivia question about Australia states for which the correct response is Victoria, …

Member Avatar for stultuske
0
332
Member Avatar for Ashenvale

Hi, I'm trying to insert a search function into my program. I used 2 classes class PatientInfo{ private void BAddActionPerformed(java.awt.event.ActionEvent evt) { PatientAddress pInfo = new PatientAddress(); lName = txtLastName.getText(); pInfo.getLName(lName); txtLastName.setEditable(false); } private void BSearchActionPerformed(java.awt.event.ActionEvent evt) { PatientAddress pInfo = new PatientAddress(); lName = txtSearchName.getText(); pInfo.searchInfo(lName); txtLastName.setText(pInfo.lastName); } } …

Member Avatar for NormR1
0
96
Member Avatar for phil.sutton

I am new to Java, and I have been trying to get an assignment coded and keep gettin java.lang.NullPointerException in Main Class.java:39. Ok, no prob. Unfortunately I can't quite get this fixed. Any suggestions? I'm using Eclipse Juno. Also, any suggestions on any books, sites, etc that review java in …

Member Avatar for NormR1
0
316
Member Avatar for sharonC

I am trying to develop a method that can find common elements in a simple array with a linear run time O(n + m). This is an old school problem, i.e., no hashsets, hashtables, arraylists. Here is what I have so far. import java.util.*; import java.util.Arrays; public class CommonElements3 { …

Member Avatar for NormR1
0
251
Member Avatar for joshuamichael0808

Hello everyone, I'm new here, and reletively terrible at coding, so I was hoping I could get some assistance with a program I've been working on. My assignment is to create a Frame that allows the user to choose where to paint a circle using a horizontal and vertical scroll …

Member Avatar for JamesCherrill
0
181
Member Avatar for nsharif

expandable JPanel while adding items Hi, I have a JFrame and I added JPanel inside it However, I designed in a way, I can add JButton to that panel it is used as a bookshelf for example btn 1 btn2 btn3 so each time i add, it goes three columns …

Member Avatar for nsharif
0
231
Member Avatar for Krazykado

I am fairly new to Java programming and I am having problems with creating a program with these requirements: 1. Create a program to simulate the roll of 2 – six sided dice. 2. Test to see if the dice are equal. 3a. If they are equal print “You win! …

Member Avatar for matencio
0
792
Member Avatar for cafegeo

Hello all, I am a beginner at Java and taking a class which is moving at a fast pace. So I have this Animal class and Fox class that must access the AnimalColor class through an API. Originally the AnimalColor object in the Animal class was public(accessible by all) but …

Member Avatar for NormR1
0
284
Member Avatar for rahul.ch

import java.util.*; public class GenericDemo4 { public static void main(String r[]) { Set s1 = new HashSet(); s1.add(0); s1.add("1"); dostuff(s1); } static void dostuff(Set<Number> s) { do2(s); Iterator i = s.iterator(); while(i.hasNext()) System.out.println(i.next() + " "); Object [] oa = s.toArray(); for(int x = 0; x<oa.length; x++) System.out.println(oa[x] + " …

Member Avatar for rahul.ch
0
299

The End.