32,199 Topics

Member Avatar for
Member Avatar for simplyflawless

hey guys, i have to do this program and i'm having trouble with this certain part: Write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each interest rate starting from 5% to 8%, …

Member Avatar for phoenix911
0
158
Member Avatar for may781

Hey:) I am creating a project in java,but have been sick for the passed 3 weeks, so I am a bit stuck on how some of the code should look,and where it should be the details are that I am required to develope an application that will allow the user …

Member Avatar for jwenting
0
105
Member Avatar for musikluver4

[code] //Date: 3/17/2010 import java.util.Random; public class Bingo { public static void main(String[] args) { Random bingo = new Random(); for (int i = 1; i <= 50; i++) { System.out.println("Card #" + i + "\n********"); System.out.println(); for (int j = 1; j <= 24; j++ ) { int bingoNum; …

Member Avatar for BestJewSinceJC
0
5K
Member Avatar for jmguerriero

I am trying to write some code to practice using methods. My goal is to get the user to input their weight. Then in the method I want to convert the earth weight to moon weight, which is earth weight / 6. I think I got it but I can …

Member Avatar for jmguerriero
0
368
Member Avatar for bustersox

I am having problems filling an array of objects with a txt file. It seems to me that it should work, but I get all 0's printed out. Please help! I cannot write the rest of my code until I figure this out. Also I get this error message: "Exception …

Member Avatar for bustersox
0
4K
Member Avatar for thebluestar

ShoppingListItem.java [CODE=java] package problem2class; public class ShoppingListItem { private String name; private int numOfItems; private double price; public ShoppingListItem(String name, int quantity, double pricePerUnit) { this.name = name; numOfItems = quantity; price = pricePerUnit; } public String getName() { return name; } public void setName(String name) { this.name = name; …

Member Avatar for thebluestar
0
220
Member Avatar for musikluver4

[code] //Date: 3/16/2010 import javax.swing.*; class PizzaChoice { public static void main(String[] args) throws Exception { char[] whatSize = { 'S', 'M', 'L', 'X'}; char size; double[] sizePrice = {6.99, 8.99, 12.50, 15.00}; int s; System.out.println("What size do you want?"); size = Character.toUpperCase((char)System.in.read()); for (s = 0; s < whatSize.length; …

Member Avatar for musikluver4
0
953
Member Avatar for sheps

Hi, I'm super new to Java, and am desperately in need of some help. I'm making a little java desktop application where I basically have a grid of 4 JButtons ( 2 x 2 grid), and I need the background colour of individual JButtons to change, and after one second, …

Member Avatar for Ezzaral
0
2K
Member Avatar for LReynolds

So here's the rundown. I have a base class, I want to put a clickHandler in it because all of my subclasses will need it, but they will all execute different code when it is triggered. My question is, how can i have a clickHandler in my base class and …

Member Avatar for Ezzaral
0
154
Member Avatar for BERRYH

Write a program that draws a clock face with a time that the user enters in two text fields (one for the hours, one for the minutes). import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Point2D; import java.awt.geom.Ellipse2D; import …

Member Avatar for BERRYH
0
83
Member Avatar for rena0514

I get this when i click on the done button in my program: [CODE]Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at BillPanel.getTotalPrice(BillPanel.java:49) at BillPanel$ButtonListener.actionPerformed(BillPanel.java:62) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) …

Member Avatar for rena0514
0
190
Member Avatar for stain3d

Hello! I'm doing a thing to where the java program will let the user input a length, and width of a triangle. In return it will show the length, width, and the area. I think I have everything correct here, however, the public voids I inserted does not work... Any …

Member Avatar for cale.macdonald
-1
125
Member Avatar for KillerZ123

I am new to sockets and trying to make a simple two person chat program and I have everything working except for the receiving and printing of the messages to the jtextarea. I am not sure why it isn't working here is my code: Driver: [CODE]import java.awt.*; import javax.swing.*; public …

0
37
Member Avatar for Sunny89

Write a Java program that will generate random four letter words. The words must consist of only lower case letters. The program will prompt the user to enter the number of words to generate. The program should request that the user enter a number between 1 and 500 and ensure …

Member Avatar for peter_budo
0
802
Member Avatar for Sunny89

Write a function called Random that accepts two parameters of type double. The Random function will generate random numbers between a range defined by the parameters, The first parameter defines the lower limit and the second parameter defines the upper limit

Member Avatar for javaAddict
0
71
Member Avatar for akonful

Trying to figure out why code wont work. Its gets 2 errors for String newS1 = s1.sort; String newS2 = s2.sort; I dont know how know whats wrong [CODE]public class anagram { public static void main(String args[]) { java.util.Scanner input = new java.util.Scanner(System.in); System.out.print("Enter the first string: "); String first …

Member Avatar for javaAddict
0
147
Member Avatar for ronyyy

Please solve this java program Design a class EmployeeSalary to reflect the salary of an employee in an organization.All employee will be facilitated with common increment rate of their rank.Each employee's gross salary will be comprised of the basic ,house allowance ,medical allowance and transport allowance.The house ,medical,and transport allowances …

Member Avatar for masijade
-1
98
Member Avatar for thebluestar

Account.java [CODE=java] package btclass; import java.util.Scanner; public class Account { private float amount;//actual amount private static float balance;//balance amout Scanner keyboard = new Scanner(System.in); public void deposit() { System.out.println("Enter the amount you want to deposit: "); float depos = keyboard.nextFloat(); if (depos < 0) { System.out.println("Amount you entered is < …

Member Avatar for javaAddict
0
155
Member Avatar for BEBELINDO

Hi .. Provably I'm setting this up the wrong way in Netbeans.. I open a new projetc and use the default main...then open a new empty java file and type my code , when I run this it runs fine but it doesn't ask for input ! [code]import java.io.*; public …

Member Avatar for javaAddict
0
184
Member Avatar for mgern26

Hi i am having an issue using Math.pow its telling me that math.pow wants (double,double) and im giving it (double[] , double) is there away to use an exponent on an array package project2; public class project2 { public static void main(String[]args){ double x [] = { -2.0,-1.0,0,1.0,1.5,2.5,3.0,4.0,8.0,12.0,16.0,20.0,24.0}; double f=0 …

Member Avatar for javaAddict
0
60
Member Avatar for cool2

hi i m doing a project on ftp server..i need some basic codes to start with the program..i ve got few codes but it has some package,enumeration all such stuff which is complex..so i need a simple progrm...plz help me in getting it......

Member Avatar for jwenting
0
75
Member Avatar for deepugtm

I'm doing my bachelor of engineering in computer. I do not know whether to post this thread here or not. Sorry for my poor English. I have the knowledge of C/C++. Now i have started learning Java. Some of my friends says that C# is better than Java., is it …

Member Avatar for jwenting
0
96
Member Avatar for jxmst32

I am currently writing a program which will perform binary to decimal, decimal to binary, hexadecimal to decimal, decimal to hexadecimal conversions, 1's compliment, 2's compliment, and show the list of boolean algebra rules. I have created the JFrame and the JButtons to create the GUI however, I cannot figure …

Member Avatar for BestJewSinceJC
0
376
Member Avatar for litchi

Hi :) I was hoping someone could point me in the right direction to create a grid of clickable objects/images/shapes. My problem is this, I have to create a grid of 100+ characters that, when you click on one, appends a JTextArea with a specific, different, character. The only idea …

Member Avatar for litchi
0
958
Member Avatar for WinnieM

Hi everyone, Im new to site and new to Java - have an assignment in Hangman - to date I have created the Hangman class and coded the tester so its working with 1 word! I have also coded the hangman component which is currently static and displayed on opening …

Member Avatar for BestJewSinceJC
0
93
Member Avatar for KirkPatrick

I have a question on how to get the index of a selected object. I'll briefly explain my project to help get a better understand of what I'm doing. I have created a simple object (named InfoObject) which is made up of 2 jTextfields and 1 jComboBox. I have added …

Member Avatar for Ezzaral
0
477
Member Avatar for lrolsto1

Stupid question, I'm sure: For an assignment I need to create a program that uses methods and constructors in several other classes... the classes were in a file that I unpacked and put in the same directory as the one I'm writing is in. What do I need to do …

Member Avatar for Ezzaral
0
93
Member Avatar for Katana24

Considering no one seems to be-able to answer my other thread I'll try simplifying this one. I have created GUI frame which contains a menubar at the top. I have several methods as well as a method which paints 5 circles onto the frame. When I call that method, by …

Member Avatar for BestJewSinceJC
0
78
Member Avatar for Dizzzy

Here is my code to write the arraylist to .dat file, And im not sure if its working but it writes to the file and i can see all the random characters so it is writing something but i keep getting io errors when i try to use the method. …

Member Avatar for BestJewSinceJC
0
154
Member Avatar for vampshay

import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; // user defined type where we put name class riot2{ private String name; public riot2(String _name){ name = _name; } public String toString(){ return name; } } public class finalriot2 extends JFrame{ Container c = getContentPane(); private Stack sstack; // …

Member Avatar for stultuske
0
74

The End.