201 Posted Topics
Re: This is the code (in Java, if you don't know it don't worry, it is very similar so you won't have trouble understanding) for creating the wanted output with loops, hopefully this will help your project: [CODE=java]public static void main(String[] args) { String str = null; boolean needToBark = true; … | |
Re: It states that the class TextBox does not have a method named Display(). In the [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox(VS.71).aspx"]MSDN [/URL]they have an example for using C# text boxes: [CODE=C#]private void CreateMyMultilineTextBox() { // Create an instance of a TextBox control. TextBox textBox1 = new TextBox(); // Set the Multiline property to true. textBox1.Multiline … | |
Re: The file - is it binary or text? You want the first number to go into the int array, the next to one double array and the third to the second double array, and so on for each line? | |
Re: You are not using the printf properly - you need to tell the method where do you want the String to be printed. Try this: [CODE=java]public Square(String name) { super(name); System.out.printf("Shape: %s", this.getName()); }[/CODE] | |
Re: I guess that this is a question of design - Do you want the GUI class to be only for the GUI and the logic in another class or do you want all of the information to be together? Regarding to "what will work" - both approaches will work. | |
Re: Perhaps you will find more help in the [URL="http://www.daniweb.com/forums/forum24.html"]JSP[/URL] forum :) | |
Re: Sorry but I have to ask - have you tried [URL="http://tinyurl.com/2chsz2u"]this[/URL]? | |
Re: In order to parse the words, you can use the code string [iCODE]Pattern w = Pattern.compile("\\W+");[/iCODE]. The sentences are more problematic, since a sentence can be across lines. After parsing a sentence and all of its lines you have to check whether the last line ends a sentence, and if … | |
Re: The compiler states that he cannot found the class named Main. Can you post your code? | |
Re: The main method must be static. One way to go is to create a new Anagram object and use the dot notation to access its methods. [CODE=java]public static void main(String args[]) { Anagram anag = new Anagram(); anag.phrase1 = args[0]; //using dot notation to access the members phrase1 and phrase2 … | |
Re: What is the name of the file you have the class in? | |
Re: jwill, please do not use caps-lock. What code do you have so far? What have you tried? | |
Re: I knew that assignment looked familiar, take a look [URL="http://www.daniweb.com/forums/thread324657.html"]here[/URL] :) | |
Re: Is this an assignment that you have or a possible solution to your problem? If it is the latter it's possible that there are better solutions - would you like to post the problem? | |
Re: Try following [URL="http://download.oracle.com/javase/tutorial/deployment/jar/build.html"]these [/URL]instructions, and if you don't succeed we'll try figuring this out. | |
Re: [CODE=java]Public class Student { //TODO: Implement. }[/CODE] And [CODE=java]Public class Course { //TODO: Implement. }[/CODE] What have you tried so far? Where do you get stuck? | |
Re: The syntax for creating a new instance is [CODE=java]Class1 varName = new Class1();[/CODE] This will call the default constructor (you haven't defined any other). Now, to access the only thing you have in the class, which is the getAllSubjects() method, you use the [I]dot notation[/I] syntax [CODE=java]varName.getAllSubjects()[/CODE] | |
Re: Read each line, which is a year, and use String.split(",") in order to split for the specific months. | |
Re: Where did you get stuck? what did you answer so far? | |
Re: I have answered [I]your[/I] same question [URL="http://www.daniweb.com/forums/thread324267-3.html"]here[/URL]... | |
Re: The number of values that will be in argv is exactly argc. When starting the program argc will be equal to the number of elements in argv, meaning that argv[0] through argv[argc-1] are existing cells. | |
Re: Have you tried png? jpeg does not support transparency. | |
Re: Agree with jon.kiparsky, with two things to add: Instead of reversing the string you can zero pad it on the left to make Strings of the same length ([URL="http://download.oracle.com/javase/6/docs/api/java/lang/String.html#format(java.lang.String, java.lang.Object...)"]String.format[/URL] should do the trick). Second thing is be careful with the carry - you have to save it throughout the … | |
Re: Please elaborate - you want to save to a file? to a variable? Please specify the exercise and where exactly you get stuck... | |
Re: What did you answer so far? what exactly don't you understand? | |
Re: As far as I know, you can't pass statically created multidimensional array as an argument to a function. The way you have done it seems like a good way (if not the only one :)). Just be careful and don't do that on a dynamically allocated array, since you cannot … | |
Re: I am using Eclipse, and when using its export features I have always managed to export everything into one jar file. Also - a quick search came up with this: [url]http://one-jar.sourceforge.net/[/url], might help. | |
Re: This is the Java forum, you might want to visit the [URL="http://www.daniweb.com/forums/forum117.html"]JavaScript[/URL] forum :). | |
Re: Copied it to Eclipse and ran it - didn't get an Error message, but the output seems off: [ICODE]Test Day Set day: Sunday Next day: Monday Previous day: Sunday After 4 days: Thursday [/ICODE] Your previousDay and nextDay are not modulo 7, meaning that they can get values that are … | |
Re: What have you done so far? In what exactly do you need help? | |
Re: It's a shame the you [URL="http://www.daniweb.com/forums/thread324157.html"]repeat[/URL] your messages. | |
Re: Sure - Those are the command line arguments that are passed to the program. Just like any method in Java that can accept parameters, the main method accepts the String args[] as a parameter. When you run the program: [CODE]programName param1 param2 param3[/CODE] The program will start with the args … | |
Re: In Java a booolean is a boolean, and an int is an int. 0 is not false, and 1 is not true. You can change your code to something like: [CODE=java]if (((num1 % 2 == 1) || (num2 % 2==1)) && (num1 % 2 != num2 % 2)) { System.out.println … | |
Re: I have to admit that I am a little bit confused - if you want to check the type of the object, you can use instanceof. If you want to compare two objects of the same type you can override the equals method. I am not sure what you are … | |
Re: Not familiar with the software myself, but a quick search revealed [URL="http://www.devx.com/ibm/Door/32285"]this site[/URL] which contains plenty tutorial, and also a [URL="http://tinyurl.com/37r9hht"]pdf[/URL] from the IBM site, even though it seems to be for C++. | |
Re: In your printA() method you have the line: [CODE=java]ArrayList<Integer> grade = new ArrayList<Integer>();[/CODE] Which causes the grade ArrayList to be created again, erasing the older one. Remove this line and it should work fine :) | |
Re: I am getting "ERROR: null" when trying to run your program with a file identical to the one you have posted here - are you sure that the Scanner usage is correct? | |
| |
Re: Are you trying to find such an application or to try and create one of your own in Java? | |
Re: This is the Java forum - perhaps you would be able to get more help in the [URL="http://www.daniweb.com/forums/forum24.html"]JSP forum[/URL] :) | |
Re: Please use the [CODE] tags when posting code. First, it is a good practice to initialize the loop variable in the loop declaration an not outside of it. [CODE=java]public static void main (String[] args) { double sum = 0f; int ctr1 = 1; for (int ctr2 = 0 ; ctr<=77; … | |
Re: kramerd is right - your semicolon at the end of the for loop at line 21 makes the loop to do nothing. Since you have declared i and j as members outside of the loop instead of creating them for each loop, the value of i at the end of … | |
Re: I don't, but [URL="http://www.jidesoft.com/blog/2008/02/29/rotate-an-icon-in-java/"]this guy[/URL] does :) | |
Re: ChaseRLewis - you are on the right track, and you can tight the bound even more by summing all the integers up to sqrt(n) instead of up to k/3, as can be seen [URL="http://en.wikipedia.org/wiki/Primality_test#Naive_methods"]here[/URL] | |
Re: Do you mean that you have created one image containing the entire web page, and you would like to replace the boxes? This cannot be done as far as I know - you will have to slice your image into several images, and place them in the HTML. Then you … | |
Re: You can pass the displayText as a parameter [CODE=java]public void fillGrid(String displayText) { for(int i = 0; i < ROWS; i++) { for(int j = 0; j < COLUMNS; j++) { board[i][j] = new objPiece(displayText); } } }[/CODE] | |
Re: I'll go over with you about the max value, and then implement by yourself the min. Because we want to compare it to all the values of the array, we will initialize highest to be equal to the first cell of the array. [CODE=java]int highest = score[0];[/CODE] Now, let's iterate … | |
Re: The way to use inheritance is to think what FixedFee and ChargeableFee have in common. Obviously most of the code for the two classes is identical, beside how and when they charge there fees. Assemble all the common information into one class, and use inheritance to only write the changes … |
The End.