32,199 Topics
| |
Please help me!1 this is what I have so far I am stuck in the plus and both times in the Polynomial class [CODE]public class PolynomialTerm { private int exponent = 0; private int coefficient = 0; public PolynomialTerm(int exp, int coeff) { int[] term = new int [2]; if … | |
Create an interface class named Dice with one method (public void roll()). Create a class to implement the dice class and call it PairOfDice. The class has two instance variables named dice1 and dice2. Create a method that would determine the value of the dice. how can i create this … | |
I want to double the score if the cards have the same suit or value and if two cards have the same both suit and value, the score get tripled. And the 2 of clubs is a 20 points. i already wrote the basics of the program which it adds … | |
It's true. [URL="http://www.oracle.com"]Oracle[/URL] is now, with its acquisition of Sun Microsystems, the world's largest purveyor of open source software. Does that surprise you? It did me too, until I started digging and realized that Oracle has a history of supporting free and open source software. Their support didn't start with … | |
This is a program im writing for class. Here is the exception im getting: Exception in thread "main" java.lang.NullPointerException at LinkedList_final.insert(LinkedList_final.java:72) at LinkedList_final.main(LinkedList_final.java:247) Basically, my program reads a text file and parse a string. And then, add the string to Linked list. Thank you for your time and any help … | |
package hw3; import java.math.*; public class Main { public static void main(String[] args) { int i, j=0; double t=0; //input int m=4; int n=5; hw3.Point[] p = new Point[m]; hw3.Point[] q = new Point[n]; p[0] = new Point(0,0); p[1] = new Point(0,1); p[2] = new Point(0,3); p[3] = new Point(0,5); … | |
Ok guys, firstly i'm sorry for the long code. Don't worry, it is only a small problem related to a small part of the code in the main class. I've highlighted the .area I have a problem here. The first piece of code is my main class. I call a … | |
Hey guys, I'm creating a Maze class along with a client class where it allows the user to input a direction (U/L/R/D), and then the validity of the move will be returned as well as the new position of the maze. So far, I've got this, but when I try … | |
please help... here's the code [CODE]import java.awt.FlowLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JPasswordField; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JOptionPane; import javax.swing.JButton; import javax.swing.Icon; import javax.swing.ImageIcon; public class Button extends JFrame{ private JButton reg; private JButton custom; public Button(){ super("BUTTON"); setLayout(new FlowLayout()); reg = new JButton("reg BUTTON"); add(reg); Icon … | |
| I have 2 classes inside bluej, member class and trip class so when I make a member object with student ID, name and course, how can I make an ArrayList or HashSet on trip class which needs to store those students. If you have used bluej you know what I … |
Just to check with u guys I got a GUI Menu with few selections e.g. "Monkey" , "Elephant", "ViewList", "Exit" . When i click on "Monkey" a JOptionPane Sub-Menu will pop up and i could add or sell . but when i want to go back to the Gui Menu … | |
In the code below I am opening a .txt file to count the characters in it. I am assuming that the user does enter a .txt file, but how can I go in checking that the file is truly a .txt. I was thinking of using a java function to … | |
can somebody tell me the line: [B][U]public static[/U][/B] void main(String[] args) {} especially the highlighted ones in detail. why do we need to use static? public? | |
Hello everyone, Can anybody tell me how can i pass parameters to a paint method ? I know we can paint on a panel but can anyone provide a good example? Something like this? I know its wrong but please correct me. [CODE] int x=10; int y=120; JPanel p = … | |
I have to write a program that finds the smallest index of an array and am having a bit of trouble. Can anyone find anything wrong with this? [CODE]import java.util.Scanner; public class SmallestIndex { static final int LINESIZE = 10; static final int MAXSIZE = 50; static final int MINVALUE … | |
Hi,I am trying to develop an app for android about how to make my app log in a website and retrieve messages,information, friends list..etc If you know how to do it on android or java I will appreciate it..:) Thank you in advance..:) | |
Hi I am creating a program that needs to take 10 grades and give you the average, lowest, and highest grades. It needs to use arrays. Have I used arrays or used they correctly so far? Where do I need to put the grades in at? I have written part … | |
Hey I posted earlier a few days ago about a program I am having trouble with. Well I have worked on it but still need a little bit of help. I have to write a program that will store 10 grades into an array. The program will need to output … | |
how abouts do you go passing values from one jframe to another whilst they are both running i have tried defining getters but no luck. if one can post a solution i greatly would appreciate it. | |
the code works but i do not understand the use of editable option whic provides the codes [code]import java.awt.*; import java.awt.event.*; import java.util.*; import java.net.*; import java.io.*; import javax.swing.*; import javax.swing.event.*; public class WebBrowser { public static void main(String [] args) { JFrame frame = new EditorPaneFrame(); frame.show(); } } … | |
When I want to load images, locally, I use use: [CODE=Java]ImageIcon qmarkIcon = new ImageIcon("images/mark.gif");[/CODE] When I run the program through eclipse, everything works fine--all the images load like normal, but when I package the executable .jar and run it in a folder without images/*.gif's, none of the images load..... … | |
Hi, I have a method in my application called "Save as" which Saves the image of my application on computer my into a file. I used the JFileChooser to let the users choose their desired location for saving the file. The problem is unless user explicitly types in the file … | |
hi, here is my program that can read through a txt file line by line to find one word named "friends". if any line contains of this word then get the line and check my precised friend's name is mentioned there or not ? its working when my precised named … | |
[CODE]import java.applet.*; import java.awt.*; import javax.swing.*; public class draw extends Applet { public void delay() { try { Thread.sleep(1); // do nothing for 1000 miliseconds (1 second) } catch(InterruptedException e) { e.printStackTrace(); } } public void paint(Graphics g) { //Timer delay = new Timer() for(int i = 0; i < … | |
hey everyone, i have to write a method that computes future investment value at a given interest rate for a specified number of years. Write a test program that prompts the user to enter the investment amount, and the interest rate, and prints a table that displays future value for … | |
Hi can someone who knows html please help me out? I have my webpage, [url]http://users.igl.net/ash/index.html[/url] It has a javascript on it. I am trying to embed my homepage on my league site. so I write the code as follows <embed height="200" name="homepage" hidden="never" width="200" src="http://users.igl.net/ash/index.html" allowscriptaccess="true" /></embed> My homepage loads … | |
Yes I have this in an array... // Average Grade for(int i = 0; i<10; i++); { System.out.print("Average Grade" + scoreArray[i]/10); } I am wanting to divide by 10 (where the 10 is) I know that it want let me but how would you divide a list of numbers that … | |
Hey guys, my second java problem in 24 hours :) I'm trying to call a method from another class. So basically what i'm trying to do is put the date from the main class through the method "tomorrow" so it adds 1 to the int day and returns the date … | |
My code: [CODE] package big; import java.math.BigInteger; public class Main { public static void main(String[] args) { System.out.println (factorial (5)); } public static int factorial (int n) { int f = 1; for (int i = 1; i <= n; i++) { f = f * i; } return f; … | |
[code]import java.util.Calendar; import java.util.Scanner; public class Main { public static void main(String[] args) { int userBirthDay = 0; int userBirthMonth =0; int userBirthYear=0; Scanner input = new Scanner(System.in); System.out.println("Enter The day of your birth"); userBirthDay = input.nextInt(); System.out.println("Enter The month of your birth"); userBirthMonth = input.nextInt(); System.out.println("Enter The year of … |
The End.