1,963 Posted Topics
Re: First you need to define what kind of structure to use in order to represent your tree. An array for example. Then you write code that inserts and reads the data, at and from the right place | |
Re: It is : [ICODE]main(String [] args)[/ICODE] Also I think that you have the formula for surface_area wrong | |
Re: [QUOTE=sumanbabu;818855]any small program using stringlist[/QUOTE] [CODE] System.out.println("This is a stringlist"); [/CODE] [URL="http://www.daniweb.com/forums/announcement9-2.html"]Read this[/URL] | |
Re: [QUOTE=JamesCherrill;818045]I just gave him the quickest way to get the output he was looking for - which seems to be what he wanted, judging by his reply.[/QUOTE] I will have to agree with [I]verruckt24[/I]. When you said to change the double to int (or long, I don't remember) your [U]explanation[/U] … | |
Re: What is the point of double threading? Wasn't one thread enough for you? | |
Re: Apparently you are tying to use methods that don't exist. You don't just call methods just because you like it. You need yo declare them first | |
Re: [QUOTE=chandanapiit;816131]hi any one online[/QUOTE] Hi, anybody home [I]chandanapiit[/I]? | |
Re: You initialize the array, but you don't put values in it. So by default the values that it has are zero because the int variables are initialized to zero. This might not seem serious but if the array was String it would null. So next time, you don't just create … | |
Re: Well assuming that this is not homework, I think that it is a good idea. I know that most of us, including stephen84s, can do this in 30 seconds, but others might learn from it and newbies may test their skill. Of course the OP could also add the link … | |
Re: You wrote the code. Does it compile? If it does, is it so difficult to run it? | |
Re: What kind of error, and didn't you notice the methods: subString, indexOf, or charAt. at the String API? ![]() | |
Re: [QUOTE=budz;813882]who said i wud bs last assignment just want it out the way enit[/QUOTE] What you said makes no sense. Please use proper English | |
Re: Also you don't need this in your class: [CODE] private Circle circles; [/CODE] In your class you define the ArrayList of circles, so you don't need that circle object. Everything will be put in that list and you will have methods that add and read or print from that list … | |
Re: The method compareGuess should be inside a for-loop not a for-loop inside the method. The way you have you iterate, but the value "userRandom" doesn't change, so the same if is executed all the time. You need to have the method inside the loop and ask the user each time … | |
Re: The line read is in the [ICODE]strLine[/ICODE] variable. Since you have already defined your array, you can simply put that value inside the array. Of course within each while-loop run you will need to increase the index of the array so you will put the next line to the next … | |
Re: [QUOTE=nishantdaniweb;811321]Sorry hinasaeedali, I can't help you. Some time you are asking you are facing problem while making shopingCart and now you are asking how to get parameter. You didn't clearly mention your problem. As i understood you want to know how to get request parameter when you click on submit … | |
Re: This link is at the top of the JSP forum. Instead of insert it does a select, but it show how to pass data from the jsp to the servlet, run the query and then return back to the jsp. So all you have to do is change the query … | |
Re: You were told to use get, set methods in your class and you used only a set method that changes all the variables of your class. In class: policeOfficer for example you have only a set method which is not what was suggested. Plus the attributes are declared private meaning … | |
Re: First of all in java is very simple. Classes to use: Date, SimpleDateFormat, Thread. And no we will not write the code. As instructed to other forum you posted ([URL="http://www.daniweb.com/forums/thread176644.html"]http://www.daniweb.com/forums/thread176644.html[/URL]), first try it yourself and we will see what we can do. Also if you want this done on a … | |
Re: Not to mention that you failed to explain what is your problem. You just posted some piece of code without saying anything. Also you were the one that hijacked a 11 month old thread, whithout explaining anything and confusing everybody | |
Re: [QUOTE=aodpreacher;804472]i know that you cant use Arrays.sort since it will only compare the one City array object[/QUOTE] What do you mean by that? Aren't you going to save all the City objects into one array? [CODE] City [] cities = new City[10]; Arrays.sort(cities); [/CODE] Maybe I am missing something. Can … | |
Re: [QUOTE=youngstorm;796265]if the number was found in the array, I want to return that number[/QUOTE] Yes but what are you using to search the array? If you are using the number and want to see if it is there then you already have the number. If your method takes as argument … | |
Re: Well the error is very simple. You should have figured it out form the compile message. Understanding compile messages is very important if you want to learn programming. [CODE] import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; [/CODE] You import those classes. You must also import the StringTokenizer [CODE] import java.util.StringTokenizer [/CODE] … | |
Re: [CODE] CE emp1 = new CE("Martin", "Sheen", "420", 0.2, 100000); public CE(String fName, String lName, String secu, float commRate, float grossSales) [/CODE] When you write: [U]0.2[/U] java interprets it as a double. But your constructor accepts a float. So you need to "tell" java to treat [U]0.2[/U] as a float … | |
Re: 3 suggestions: Try printing the query and then run it at your database to see if it actually updates. Maybe the WHERE clause is false Maybe I am wrong, but try first to close the statement and the connection [U]and[/U] redirect And finally: THIS IS THE MOST IMPORTANT: Delete everything … | |
Re: I think that because you do something like this: [CODE] String musicCd[] = { "Fergie", "Celine Dion","Kelly Clarkson", "Chris Daughtry"}; public void musicCd() { } [/CODE] Maybe because you are using the same name. I am not sure but you might want to test it | |
Re: And to complete [I]rapture[/I]'s suggestion, try writing and TESTING small pieces of. Break down he assignment into small pieces of code and test them individually. You have written lots of stuff and you didn't explain what is the problem. I have noticed that you read and write from files. >Create … | |
Re: The "mainMenu" should be the id of the table. Since you are using this: [ICODE]document.getElementById("mainMenu") [/ICODE] It is quite obvious when you say "getElement[B]ById[/B]" that the argument should be the id of the element you are trying to take. | |
Re: Try this, although I am not sure since I have never used the "include" tag like this: [icode]<%@ include file="<%= somepage%>" %>[/icode] | |
Re: [QUOTE=masijade;801982]Of course, but we need more info (as my first reply, sarcastically, implied). Post all error/compiler messages, post your code, and post what the program produces and what it is suppossed to produce.[/QUOTE] As [I]masijade[/I] said, you failed to tell us what errors do you get. You are not going … | |
Re: You can use the method: [ICODE]Integer.parseInt[/ICODE] [CODE] String s = "12"; try { int i = Integer.parseInt(s); //do calculations here } catch (NumberFormatException nfe) { } [/CODE] If s is not an integer then the method will throw an exception. So call the method I told you and if it … | |
Re: If you search the internet (Yahoo) for: [QUOTE] java API BufferedReader [/QUOTE] you will find the API of BufferedReader with all possible constructors. Also what do you mean read from a variable. If you want a variable to be the input of the constructor, that variable will have to be … | |
Re: First of all you don't say which tabs you couldn't do. Yes you did the Pool tab on your own, but which tabs you did and work and which don't work? So I would suggest to post the code of the tab that you are having problem with. ONE tab … | |
Re: First of all the name of the select is: "selectPrimaryKey", so you will need something like this: [CODE] String nval=request.getParameter("selectPrimaryKey"); [/CODE] Also the select needs 1 minor change: [CODE] ............ <select name="selectPrimaryKey"> <option>SelectValue</option> <% for (int i = 0; i < Nheadlist.size(); i++) { %> <Option value="<%= Nheadlist.get(i)%>" > <%= … | |
| |
Re: Try changing this line: [CODE] rs1=stmt.executeQuery("insert into userinformation(username,password,dateofreg) values(username,password,dateofreg)"); [/CODE] To this: [CODE] rs1=stmt.executeQuery("insert into userinformation(username,password,dateofreg) values ('"+username+"','"+password+"','"+dateofreg+"')"); [/CODE] Also the exception tells you at which lines you got the error. It would be better if you point out to us which lines are that, because we cannot just count … | |
Re: You have 2 while loops one inside the other that do exactly the same thing in the opposite. There are much better codes than that: [CODE] boolean done = false; while (!done) { // and now k2k's code enter input if (answer.equals("yes")) { do whatever calculations you want to do … | |
Re: From a quick look at your code you have this: [CODE] case 2: mart.print(); // Call break to avoid falling through to the default case. break; [/CODE] It is suppose to print the shopping cart. Are you having problems with that? | |
Re: [QUOTE=Y2K_MASTER;793557]I want the program to take 2 user inputted numbers and then carry out the calculations I have added at the bottom. eng.M4AH, When I switch the order like you have stated, the BlueJ doesn't run the program. I think you're on to something though[/QUOTE] [I]eng.M4AH[/I] is [B]correct[/B], but yes … | |
Re: Check the API for the String class. It has a replace method. Also if you search this forum you will find examples on how to read and writes files. So read the file line by line. For each line use the replace method and save the result (the modified line) … | |
Re: Because when you do this: [CODE] String [][] array2D = new String[5][]; [/CODE] You don't create a 2-D array, but an [B]1-D[/B] array that takes as 'elements' arrays. So you can do this: [CODE] array2D[0] = new String[2]; array2D[1] = new String[10]; .... [/CODE] and access like: [CODE] array2D[0][0]; array2D[0][1]; … | |
Re: Check the API for [URL="http://java.sun.com/javase/6/docs/api/java/util/ArrayList.html"]ArrayList[/URL]. It is the most commonly used [CODE] ArrayList list = new ArrayList(); list.add("asd"); list.add("fgh"); list.add("erty"); for (int i=0;i<list.size();i++) { String s = (String)list.get(i); System.out.println(s); } [/CODE] Or if you use generics (after java 1.5) [CODE] ArrayList<String> list = new ArrayList<String>(); //here you define what kind … | |
Re: [CODE] BufferedWriter writer = new BufferedWriter(new FileWriter("fileName")); writer.write("write here"); writer.newLine(); [/CODE] Check the API for the BufferedWriter in case I have some errors in the syntax | |
Re: [QUOTE=stephen84s;779544]Not until you show us what effort or analysis you made in tracing that error. And as I said before do not just vomit back what your system throws back at you, show us some analysis, some effort from your side. **Also my instinct suggests this is not your code … | |
Re: [QUOTE=kaptan SINGH;714468]i'm want to source code related to the project online airline ticket reservation in jsp 7 help to devlop in project[/QUOTE] I guess your skills are limited only to writing and not to reading, because if you had read the previous posts you wouldn't have made such question thread-jacker … | |
Re: [QUOTE=seemant gupta;793882]please marked it solved if it has solved your problem[/QUOTE] First of all this is not a contest of who will get the most solved threads. I say this because: The "solution" given is not the best that could be provided and it is very difficult to understand what … | |
Re: Where do want it to be displayed because I don't think that it can be done. I would suggest you look at the API for PrintStream Because the System.out is type of PrintStream. This will behave exactly like the System.out.println [CODE] PrintStream print = new PrintStream(System.out); print.println("aaaaa"); [/CODE] | |
Re: You need to count how many elements are inserted and when you reach 10 exit. If I understood correctly you will need this: [CODE] int count = 0; do { System.out.print("Enter 1 for F to C, 2 for C to F, and 3 to quit"); choice = input.nextInt(); if (choice … | |
Re: What errors do you get and at which lines. Post the errors you get. Also if it runs what results do you get what you were expecting? Also the tab character is this: \t System.out.println("aaa\tbbbbb") and for new line: \n System.out.println("aaa\nbbbbb") Try running the above just for testing |
The End.