32,204 Topics

Member Avatar for
Member Avatar for merse

I've made an empty mynote.txt in the same directory, and open the following code with Internet Explorer, and allow to write on hard disk (when IE asked) but nothing in the text file: mynote.txt after the run. what is the problem? [CODE]<html> <body> <script type="text/javascript"> function WriteFile() { var fh …

Member Avatar for peter_budo
-1
90
Member Avatar for shane1987

Array of Random Numbers Write a program called Random50 that fills an array with fifty random values between 1 and 999. However, before a random value is entered into the array the program must check that the number generated is not already in the array. If it is already present …

Member Avatar for lee.j.baxter
-1
5K
Member Avatar for appooti

[code]import java.io.*; import java.io.File; import java.net.*; import java.net.UnknownHostException; import java.net.InetAddress; public class Rfc{ protected String ip; protected int host; public BufferedReader reader; protected PrintWriter writer; public static void main(String[] args){ try{InetAddress address = InetAddress.getLocalHost(); String ip = address.getHostAddress(); System.out.println(ip); }catch(Exception e){ System.out.println("error2"+e); } Rfc rfc =new Rfc(ip,80); rfc.setUpConnection(); String s …

Member Avatar for apines
0
119
Member Avatar for LianaN

Hi! I want to create a stopwatch that will counter seconds starting from 0. This code worked in case of a real time counter (using Calendar). However, now the counter is fixed on 0. Does anybody know what could cause an error? Thanks! [CODE] timer = new javax.swing.Timer(1000, new ActionListener() …

Member Avatar for apines
0
102
Member Avatar for adamleefe

Hey, so far i have created some code that reads a text file and outputs the information if i run it in eclipse and i now want to have an option when it runs to either show the information in plainscript or html, how would i do this does anyone …

0
58
Member Avatar for Dean_Grobler

Hi there, In my little code snipet below I am trying to convert an arraylist to an array of type contact. Obviously it's expecting an arraylist of type contact to convert it to an array of type contact. But it's picking up the arraylist as type object for some reason. …

Member Avatar for Dean_Grobler
0
137
Member Avatar for yap_1991

hi all i have 2 files one of which is a gui, the other a java file. I need to take my gui input and put it through the java file. How do i do that? I've tried calling the classes but the input just doesnt seem to be going …

Member Avatar for yap_1991
-1
155
Member Avatar for krip_101

I am getting an array out of index error 26 pls I really need help. [code]import java.util.*; import java.util.Random; import java.lang.*; public class testing1 { public static void main(String[] args) { String pass = new String("ENTER THE HAMLET HAM TO BE OR NOT TO BE THAT IS THE QUESTION WHETHER …

Member Avatar for JamesCherrill
0
96
Member Avatar for Bonesawed

Hi All. Im in the process of writing a basic payroll program in Java. It is for some school work and I am really struggling with it. I have been working with it over the last 3 weeks and have not accomplished much. Below is what I have done so …

Member Avatar for apines
0
227
Member Avatar for Eric Cute

Hi guyz. I know this is a simple one but Im a bit confused in doing this. Basically, I want to get the Screen Resoultion of the client machine using my JSP. I have this code in my Bean. [CODE] Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); return screenSize.getWidth(); [/CODE] Problem is it …

Member Avatar for Eric Cute
0
299
Member Avatar for john410

question states for me to have the prog read #'s inputed from the user in the range of 0 to 50 inclusive, count how many times each # was inputed, then print all #'s imputed and how may times they were. this is what I have so far.... [code]import java.util.Scanner; …

Member Avatar for jon.kiparsky
0
109
Member Avatar for J.Killa

I'm doing a BankAccount class and in the constructor I need to validate if the string in which the account number is written, is all numeric. Any ideas on how I can accomplish this? Also, it must be of 4 digits...is there some method of the String class that can …

Member Avatar for J.Killa
0
248
Member Avatar for kezkez

Hello, I am trying to return the union of two ArraySet Strings as a third; however, the compiler is complaining: found : jss2.SetADT<java.lang.String> required: jss2.ArraySet<java.lang.String> union = one.union(two); I was thinking I could pass an ArraySet<String> as the parameter but unfortunetly I am stuck here. Any suggestions on how to …

Member Avatar for kezkez
0
102
Member Avatar for muncher10

I have to have the tire pressure of the two back wheels the same and the two back wheels the same but it doesnt seem to be working. [CODE]public class Pressure { private int fr; private int fl; private int br; private int bl; public Pressure() { } public void …

Member Avatar for BestJewSinceJC
0
81
Member Avatar for Yutxz

Hello! I'm working off of a problem in my "How To Think Like A Computer Scientist" textbook. The exercise in the book is having me work with a deck of cards. I receive two errors in my current code. The first is that every method after Class Card {...} says …

Member Avatar for kramerd
0
120
Member Avatar for Rally VW

The code I'm writing reads in something like this from a file: 95 34 89 100 25 100 84 62 78 98 Mary Elizabeth Smith And outputs this to the same filename with a different extension: 88.25 Mary Elizabeth Smith I wrote a test program to test the calculation methods …

Member Avatar for Eric Cute
0
197
Member Avatar for Yutxz

I'm developing a program based on the Tower of Hanoi. It accepts the number of discs and returns the amount of turns it takes for those discs to complete the conundrum. All of my inputs work fine, until the input (d) is greater than 31. Is the result too large …

Member Avatar for jon.kiparsky
0
125
Member Avatar for mrkm1188

Hi, I'm trying to multiply two linked lists and return the result as a linked list. Any ideas?

Member Avatar for jon.kiparsky
0
46
Member Avatar for LianaN

Hi! I would like to add a timer to JTextField. However, my timer does not run. Could you, please, tell me what is wrong in my code. Thanks! [CODE] timerTask = new MyTimerTask(); timer.schedule(timerTask, new Date(0), 5000); // 5 seconds delay ... private class MyTimerTask extends TimerTask { @Override public …

Member Avatar for LianaN
0
81
Member Avatar for nikk18

I'm supposed to implement a queue using a singly linked circular linked list (it also has to be generic). It keeps saying there are incompatible types at lines 44 and 45. I've honestly been trying to work this out for hours, but I don't understand what i'm doing wrong. Any …

Member Avatar for jon.kiparsky
0
194
Member Avatar for lee.j.baxter

I'm creating a system that has a parameterized class "TypeModule<T>". Now, I have another class that has the following member; [CODE]private LinkedHashMap<Class, ArrayList<TypeModule>> m_modules = ...[/CODE] Here's my dilemma. I need something more like the following; [CODE]private LinkedHashMap<Class<?>, ArrayList<TypeModule<?>>> m_modules = ...[/CODE] The only thing is, I need the '?'s …

Member Avatar for apines
0
121
Member Avatar for Superstar288

Hi everyone im a bit confused with my work and i hope you can help me. i need to get some values from a text file and enter it into a 2D array ive done this part ok with the following code however in my file i have some other …

Member Avatar for Superstar288
0
153
Member Avatar for titan5

I am generating random numbers and want to write them into a file. But its writing them in binary and I am not able to open them using a text editor. How do I write them in Ascii? Also what is the fastest method to write them into a file? …

Member Avatar for titan5
0
139
Member Avatar for neo_31591

hey guys/...am stuck at one point....help me please! ! ! its a quiz progg... one ques...4 options... i have one button---NEXT QUES--- It should display the next ques--it should also take the user selected option, compare it with the correct option and show if the Answer is right or wrong …

Member Avatar for neo_31591
0
90
Member Avatar for StaticX

Hello, I have created a simple frame, and in it there are 3 panels.I have a button in the bottom panel, and when pressed should display the text "You pressed the button", in the mainPanel.However this is not working.Can anyone shed some light as to what I am doing wrong …

Member Avatar for kramerd
0
122
Member Avatar for Oregand

Hey guys, im just learning how to use methods but I really cant seem to understand them. We have a question where we have to write a program for the following game. There is a little known dice game which is played with a pair of dice and has the …

Member Avatar for Oregand
0
3K
Member Avatar for Oregand

Hi guys, Im pretty new to programming so bear with me if you think this is baby stuff:P Ive just been introduced to methods last weeks and after a week of study Im no better at understanding them. The problem is I just seem to grasp how to you them …

Member Avatar for Oregand
0
132
Member Avatar for Dhruv Gairola

Hi there friendly people of daniweb. My problem is that when i double click an executable jar file, nothing happens. Even when i use command prompt and type java -jar "filenae" it doesnt work. Any ideas why?

Member Avatar for Dhruv Gairola
0
115
Member Avatar for khaled_jawaher

i have written the code in client,server,interfaces.i have created stubs and skaleton. i have run rmiregistry very well.i have run server.i have an error in client side,when i run client.it is moving to the catch not looking up to the correct address of server. the code of client is: [CODE]import …

Member Avatar for ~s.o.s~
0
157
Member Avatar for hiddenman91

[code=Java]import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class DeleteProductServlet extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { DBManager db=new DBManager(); Connection …

Member Avatar for hiddenman91
0
100

The End.