1,963 Posted Topics
Re: Is it because you haven't declared a constructor with 3 doubles as arguments? Or somehow your class can't "see" the constructor because you haven't import the BoneNode class? | |
Re: Contact you and say what? You are the one who is supposed to post your code and ask questions in order to get help. How are we supposed to give answers when we don't know what you want. And it is better to post you question here where everybody can … | |
Re: FileWriter write = new FileWriter("CropSystemDatabase.txt", true ); | |
Re: Probably because there isn't such constructor. [URL="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Byte.html"]API for Byte object[/URL] [URL="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Short.html"]API for Short object[/URL] The values in the parenthesis are not treated as byte and short but as int. I haven't try this and I don't know if it will work so don't blame me, but try: Byte b = … | |
Re: I would suggest creating a class with attributes the ones you have described in your post: [CODE] Trip date (Date) Start destination (String) Ending destination (String) Mileage (double) Cost (double) [/CODE] Then create in another class methods for writing and reading files the above information taken from the classes. (The … | |
Re: Nothing is necessary. You can write anything you want in any way you want. In the end it is experience that will tell you when it is better to use servlet to handle the request from the jsp file or just just handle it in the same page by setting … | |
Re: [QUOTE=sirishag.ch;566597]Hi ABhi, Try Like this... [code=java]String hrname="("; for(int k=0;k<my_arr.length;k++) { hrname+="'"+my_arr[k]+"',"; } hrname+=")"; for(int i=0;i<my_arr.length;i++) { query = "select * from my_table where HR=(select max(HR) from my_table where FirstName not in "+hrname+")"; }[/code][/QUOTE] Sorry to break this to you but what you wrote is totally wrong and you are going … | |
Re: [CODE] public void add(CompositeShape aShape) { Rectangle temp = aShape.getBounds(); int width = (int)temp.getWidth(); int height = (int)temp.getHeight(); JButton aButton = new JButton(new ShapeIcon(aShape, width, height)); } [/CODE] The button only exists in the add method. You declare it then that's it, you are not doing anything with it. No … | |
Re: char should have length 1. Always 1. This is correct char c=' '; or char c='2'; Not this: char c=''; or this char c='12'; So I believe that the compiler could convert the '\21' to its equivalent character but not '\29' because there isn't any. Is like writing: char c='\n'. … | |
Re: You don't ask for help, you just posted your assignment that includes a lot of different fields from java. (gui designing, button handling, reading/writing files). What is your background, what are your weaknesses, what you don't understand? No one is going to do it all for you. Start writing code … | |
Re: First of all what kind of errors do you get and where? And from what I see: In calcAverage() you simply display the average, so in the main I think that you should first call the avgScore = total / 5.0; and then the calcAverage(); And second, the determineGrade() returns … | |
Re: break statement inside the loop doesn't make it an infinite loop. (that's my opinion of course) Others might have better suggestions | |
Re: I don't know these classes but from the code and the error I understand that when you are trying to do this: [CODE]ASN1Sequence asn1Sequence = (ASN1Sequence)DEROctetString;[/CODE] The DEROctetString instance, is NOT an ASN1Sequence object, so it cannot be turned into one, using casting. It is like saying something like this: … | |
Re: Then use: sdf.format(date); The SimpleDateFormat.format(Date) will take any Date object, no matter how it was created and retutn a String based on the pattern you have set at the SimpleDateFormat object. Meaning that this: [CODE] SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-mm-dd hh:mm:ss" ); Date date = new Date(); System.out.println("Date: " … | |
Re: Yes, your command shall be done my emperor. We have no problem doing you homework, since you asked so nicely. | |
Re: When you pop, place the value in a string and compare it with the String "add": for example (not exaclty java code because i don;t remember by heart the right syntax) [CODE] String s=stack.pop(); if (s.equals("add")) { int i=Integer.parseInt( stack.pop() ); int j=Integer.parseInt( stack.pop() ); int res=i+j; stack.push( String.valueOf(res) ); … | |
Re: #1: You don't need for loops. You have 4 different for-loops and inside each one you have the same code, without using the index i. If you look at one of them you will see that: the first time it takes for example the model and sets it to the … | |
Re: And if you are to post this in an sql forum try to make it a little bit more readable, because I didn't understand much about what you are trying to do | |
Re: No one here is going to do your homework. And when your teacher tells you to write a software, he will probably give you some notes in class. If you attend the classes, pay attention to what you teacher says and study the notes you keep, you will not have … | |
Re: I copy-pasted your code and run it and it worked fine. The result I got was: 238.14 + 515 - 126.3616 result = 626.7784146484375 What was your problem? | |
Re: That's because there isn't such a method. If you check the API Math.min takes only 2 arguments. | |
Re: It should be like this: "insert into emp(total) values("+total+")" if the total column is type NUMBER in the DB or like this: "insert into emp(total) values('"+total+"')" Use System.out, before you are executing queries in order to see what is executed, so you can use it in an sql editor and … | |
Re: What are the problem specifications. How are you supposed to produce the image and post your code using tags. | |
Re: I think, masijade, that he wants to call this method:whateverMethod(Object obj) with any kind of object and for the method to do what is necessary every time dynamically. Meaning that I don't think that he intends to check what type of class he is passing in order to do casting. … | |
Re: Two ways: First: Use javascript: Instead of type="submit", use: <input type="button" value="Button" onclick="someMethod()"/> Inside the someMethod you can check the length of the inputs in order to see how many were given ans act accordingly: submit the form or print an error message with the alert() function. Second (Not as … | |
Re: Have a table in the database where you store which options each user is allowed to perform. Then when that user logs in you can query that table to see which actions the user can perform. | |
Re: In the form tag you must put the url in the 'action' attribute and in the 'method' attribute you put post or get: [CODE] <form action="someurl" method="post"> ... </form> [/CODE] When you submit the form you send the information that are inside it to the given url And I would … | |
Re: From what I understood you have declared the array to contain objects, but you insert Strings. Why don't you create a class with two attributes: name and description and insert that in the array. So when you get the object from the array you will have access to each of … | |
Re: What you see is in milliseconds. When you get the difference, multiply by 1000 and you will have how many seconds have passed | |
Re: At what line do you get that Exception? And it means that you are trying to access an array with a counter that is bigger than the length. Check all your arrays and try to debug by putting system.out.println(); before you access an array by printing the counter you are … | |
Re: There is a better way to socialize: 3 words for you World Of Warcraft:icon_smile: | |
Re: I found Java 2 Cadenhead & Lemay very useful. I have given it to others and said the best things about this book. | |
Re: You will not be obligated to write something like: [CODE] try { } catch(IOException io) { } [/CODE] in your code. Meaning that if a method throws an IOException you will not have to catch it but if it is thrown there will be no place for the exception to … | |
| |
Re: You can write whatever you want if this is the way you want to convert "asu" to a String. As it was said in the first reply what do you want to convert "asu" to? | |
Re: Where do you get your error at the following? And why do you have size as an argument since you are calculating it in the method. It won't matter what value it will have when you call the method since it will take a new value; the size of the … | |
Re: Create first the gui for login, using javax.swing. Then when you click the button you will have to read the file where the users are stored (if you know how to write into the file since you said that you are done with the registration part, you would be able … | |
Re: That is because the variables you are using to store the values in tri() cannot be used outside that method; they are local variables and can be used only inside that method. One suggestion is to make your methods non static, and declare the variables that you will store the … | |
Re: Use the code tags without the ' in the tag: ['Code=JAVA] //code ['/Code] Don't put the ' in the above tags | |
Re: The getters return null because the values first,lastName are null. If you see the constructor they never get values. The constructor: [CODE] public Name( String name) { name = FirstName + LastName; } [/CODE] is wrong. The argument's value must be inserted somwhere: [CODE] public Name( String n) { name … | |
Re: There is a suggestion: [CODE] File file=new File(rout); FileWriter text=new FileWriter(file); BufferedWriter out=new BufferedWriter(text); out.newLine(); out.write("a String"); [/CODE] | |
Re: Have you declared a package? Try running a simpler "Hello World" program, because the error you are getting doesn't have to do with the sql part. Are you getting the error when you compile or when you run? | |
Re: Don't wait too much, you will be disappointed. Meaning that you should post the compile errors you get for each class and then we will try to help you. Because you are not using code tags and it is hard to read your code | |
Re: You don't need to know by heart the exact definition of OOP in order to be able to write code. Just know how to use objects correctly. | |
Re: The break; takes you out of the switch{}. Even if it did take you out of the method, which it doesn't, the method is declared int: public static [B]int [/B] getValue(char c) {} The above method has ONE char argument, and it must return an [B]int[/B] value. If you you … | |
Re: What have you written so far, what is your problem and how good are you concerning HTML, jsp pages and DB queries | |
Re: The class is called GUIEx and you have a method called LabelFrame() in which you call super(). Meaning that super(), should called only inside the constructor and LabelFrame is not a constructor since the class's name is GUIEx | |
Re: Have you added the changes to your code? If you have what errors do you get know and what is your problem? Perhaps you should post you newly updated code and tell us in what you are having difficulties |
The End.