32,199 Topics

Member Avatar for
Member Avatar for mferarri

In main method which should I use? CarOwner owner = new CarOwner("Danni", "123456789"); or CarOwner owner = new CarOwner(); owner.setName("Danni"); owner.setPhoneNumber("123456789"); I know how to make both work, I can edit the class file to suit whichever way it is written in the main method. But what do people do …

Member Avatar for mferarri
0
323
Member Avatar for farazpt007

program for moving a car or object using button(start and stop) in applet and thread function

Member Avatar for JamesCherrill
-2
44
Member Avatar for jmartzr1

Hey everyone, I am having trouble on this one practice problem. It is a question that requires another question I already completed to solve this one. The qusetion is "Implement a method allPerfect() that takes an integer parameter end. The method prints every perfect number from 1 to end. Use …

Member Avatar for JamesCherrill
0
539
Member Avatar for solomon_13000

I wanted to verify is this a good example of a flyweight design pattern: package com.flyweight; public interface Chemical { String getName(); String getSymbol(); Double getAtomicWeight(); } package com.flyweight; import java.util.HashMap; import java.util.Map; public class ChemicalFactory { private static Map chemicals = new HashMap(); private static ChemicalFactory factory = new …

Member Avatar for ~s.o.s~
0
186
Member Avatar for karan.geh

public class Jacobi{ // jacobi(a,n) public static void main(String[] args) { int n = 234567,a = 97770; if(n<=0 || (n %2) == 0) return (0); int temp, j=1; if(a<0) { a = -a; if((n % 4) == 3) j = -j; } do while (a!=0) { do while(( a % …

Member Avatar for stultuske
0
124
Member Avatar for jrosh

I am tryn a currency converter using hash table. What is the technique to use to enble covert both ways. Ex: Dollers to Euro and Euro to Dollers . I can understand how to do it one way using currency as the hashKey and rate as Hashvalue. (I hope that …

Member Avatar for JamesCherrill
0
161
Member Avatar for london-G

Hello, Could you please assist me i want to deploy this application as an executable file with the MYSQL database embedded. I have clean and build the application, the jar file is there but nothing happens. The database is stored on local host. Thank you

Member Avatar for jwenting
0
211
Member Avatar for game06

i recent been using my variables names like this boolean is_dead = false; turn out its not right. right conventions is boolean isDead = false; for some reason i dont like the 2nd one. may be bc i been using 1st one for so long. i was wondering is there …

Member Avatar for jwenting
0
210
Member Avatar for bobit

Hey, I need some assistance with an assignment that deals with Jframes. The assignment says "For questions 27 to 31, consider the following class: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class A extends JFrame ( private Container c; private JButton b; private JTextField tf; ) Now for the questions: …

Member Avatar for stultuske
0
88
Member Avatar for nithyananthanaiker

Hello guys. I am getting this error when I run this file. Can any of you clarify what is wrong in the code? public class csector_node { public double [] relations; public csector_node() { relations = new double [8]; for (int i = 0;i < 8;i++) { relations[i] = new …

Member Avatar for scudzilla
0
198
Member Avatar for somjit{}

i wrote a code to implement some basics of priority queue , but apparantly its not giving desired output. the code is implemented using binary heap as its data structure. i tried tinkering here and there , nut no luck... i want to display a given number of max or …

0
138
Member Avatar for aldm

Hi to all, I'm making one application for video control in firm...what's the best way to make application which have to access to webcam? There should be option for watching videos from more cams in real time...I read something on google and I found that Swing framework has some options …

Member Avatar for gian88r
0
1K
Member Avatar for game06

les say i have a map: //my map is biiger but this is just a ex. int map[][] = {{1, 1, 1 1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}; int camera_pos_x = 0; int camera_pos_y = 0; int camera_speed = …

Member Avatar for game06
0
251
Member Avatar for Fuzzies

Hi! I recently started teaching Java to myself yesterday via TheNewBoston on youtube. I began working on a few programs from the programmingbydoing website but I'm stuck on this problem:http://programmingbydoing.com/a/gender-game.html It's a problem focusing on nested if statements. Here's my code!: import java.util.Scanner ; public class MainClass { public static …

Member Avatar for bguild
0
555
Member Avatar for l.worboyz

As part of my Uni course i have been given code to edit to create a MineFinder (mine sweeper) game. I have 3 seperate classes to create this game. But for now, my problem lies with this "MineFinderModel class... the tasks i am struggling to complete is as follows: > …

Member Avatar for JamesCherrill
0
152
Member Avatar for london-G

Hello, I have build my application and now that I am trying to run the jar file by double clicking on it nothing happens. I tried to access it from my terminal(mac OS) using this line: java -jar "C:\Users\Me\NetBeansProjects\BS1\dist\BS1.jar" But get the following error: Unable to access jarfile Can anyone …

Member Avatar for london-G
0
361
Member Avatar for venus87

hi friends im in need of the basic code for reading a video file as matrices in a frame by frame manner in java. can anyone please help me ?

Member Avatar for JamesCherrill
0
145
Member Avatar for game06

so i got finally done with make my player move right and left, and 1st level. now i want to make my player shoot bullets. i kind of now logic behind it but i need some help. and please let me know if you have a better method of bullet …

Member Avatar for JamesCherrill
0
998
Member Avatar for engrjd91

Hello i m the student of B.E ( Computer Systems ) .. i have to submit my Final year project proposal within 1 month.. my teachers had concerned me to work on android.. but being an engineer student they want a hardware based project from my side.. i have to …

Member Avatar for <M/>
0
115
Member Avatar for SHINICHI

I need a little help on writing the following program: Use the Account class to simulate an ATM machine.Create ten accounts in an array with id 0, 1,. . . 9, and initial balance $100. The system prompts the user to enter an id. If the id is entered incorrectly, …

Member Avatar for untio
0
904
Member Avatar for vishalonne

I am using Netbeans 7.1 I have 2 jFrame JFrame1 and JFrame2 I just not able to close or hide the JFrame1 when I switch to JFrame2 This is the JFrame1 Code - private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try{ int flag=0; String sql="Select * from login;"; smt1=con.createStatement(); rs=smt1.executeQuery(sql); String log=jTextField1.getText(); …

Member Avatar for rush_parekh
1
10K
Member Avatar for game06

i trying to my background move left if user hit right key. and background right if user hit left key. that way it will look like my player is moving. the problem is that when ever i hold right key, the background waits 1 sec than moves to left. i …

Member Avatar for game06
0
316
Member Avatar for lauraroxi

Hello. I have a project for queues simulation to do and I have to follow the MVC pattern. My classes until now are: Client, Queue which represent the Model, Controller, GUI which is the View, and the Main class. If I have those 2 classes representing the Model, how should …

Member Avatar for lauraroxi
0
125
Member Avatar for Sacrificer_911

How would you implement "clickable" game elements, like they are buttons. But of course, they can move still.

Member Avatar for JamesCherrill
0
131
Member Avatar for shopnobhumi

Hi, i want to convert a .jsp file to .java file. I read various forums and they said to use tomcat to convert .jsp to .java.I have ran tomcat but it is not doing anything(i cannot write anything). Through command prompt i ran it and it just opens a new …

Member Avatar for stultuske
0
4K
Member Avatar for elhkei

write a program that will create a phonebook,wherein you can add **entries in the phonebook,delete** entries,View all entries and Search **entries.In viewing all entries, the user should have a choice,whether to view the entries in **alphabetical order or in increasing ** order of the telephone number.In searching for entries, the …

Member Avatar for elhkei
-1
172
Member Avatar for game06

error: The method paint(Graphics, main) in the type player is not applicable for the arguments (Graphics, main.Display) on line: player_class.paint(g) main.java public class main extends JApplet { Timer timer; Display display_class; Player player_class; /*** init method ***/ public void init() { setSize(800, 400); display_class = new Display(); setContentPane(display_class); }/*** end …

Member Avatar for game06
0
256
Member Avatar for hashim5003

Can any one help me writing code which can only creat three digit random number not two digit or one digit number? Following code creates 3 digti but also creats two and one digit number.. public class random { public static void main (String [] args) { double n = …

Member Avatar for hashim5003
0
7K
Member Avatar for paku_dnj

my password program can hide keyboard input . its invisible when i type password. But my qus is how can show password input as asterisk (*) can any one help me please? :p my code is here: public void login() { Scanner input = new Scanner(System.in);//create Scanner object System.out.println("\n"); Console …

Member Avatar for ~s.o.s~
1
10K
Member Avatar for jspence29

What I am trying to do is make a program that reads a txt file and converts the number into a double array. import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class rocket { public static void main(String[] args) throws IOException, FileNotFoundException { System.out.println(readLines("/Users/Jeremy/Documents/workspace/altitude.txt")); } public static Double[] readLines(String …

Member Avatar for jspence29
0
389

The End.