201 Posted Topics
Re: minimi, I think you are getting confused between calling a method, and constructing a new object using a constructor. A constructor is a special member function of a class that is used to create objects of that class. It is special since it has the same name as the class … | |
Re: If you are not forced to use charAt() (assignment restrictions, etc') I recommend a different approach - using [URL="http://download.oracle.com/javase/6/docs/api/java/lang/String.html"]String[/URL]'s [URL="http://download.oracle.com/javase/6/docs/api/java/lang/String.html#split(java.lang.String)"]split(String regex)[/URL] method with the regex "/", you can divide your String into a String array with the day, month and year in its cells. This will be much more convinient … | |
Re: There was a similar question [URL="http://www.daniweb.com/forums/post1381852.html#post1381852"]here[/URL]. Try to review the example, and if you still encounter any trouble I'll go over it with you. | |
Re: This is funny - you actually expect someone to build an ftp client for you and send you the jar file. [URL="http://tinyurl.com/y8o2qrq"]Here you go[/URL]. A simple search and a [I]little bit[/I] of effort: [url]http://www.jibble.org/simpleftp/[/url] | |
Re: You can define several accounts in outlook, and then choose from where to send. Take a look [URL="http://www.articlesbase.com/e-learning-articles/introduction-to-outlook-2007-managing-multiple-email-accounts-808237.html"]here[/URL]. Is this what you were talking about? | |
Re: The code you have posted here seems fine. Can you post the code that prompts the user for input? | |
Re: Your code is reading the line, replaces the string, but doesn't write the new string back into the file. Half way there :) | |
Re: [QUOTE=biggie_011;1378503]Hi Guys, I'm trying to have the user enter an integer than an outline of a pyramid would be printed on the console. I just can't get the last line to print out with "*" all across. So say a user enters 5 I need the output to be: [CODE] … | |
Re: The main method's syntax is as follows: The main method's syntax is as follows: public static void main(String args[]) { // ... } The `args[]` variable is simply an array of String, and can be passed to other methods like every other variable. When typing in the command line parameters … ![]() | |
Re: [QUOTE=hanvyj;1381695]make an "add" method that creates a new array of the origional length plus one and copy all the values over - with the extra one :/[/QUOTE] That depends whether you can insert elements to any cell you see fit just like a regular array. What you are describing is … | |
Re: The solution you have provided for the first question is not recursive. You can have a recursion that will stop when max.next() is null, and otherwise will return the max value between the current node and the next node. [CODE=java]int findMax(Node node) { if(node.next() == null) { return node.getKey(); } … | |
Re: If you guys are planning to study together to the exams, it's in your interest to share the notes with them - maybe they will understand things that you didn't, and by sharing with them it will help you as well. I am speaking as someone who took notes for … | |
Re: This is the Java forum, not JavaScript - you probably want [URL="http://www.daniweb.com/forums/forum117.html"]this forum[/URL] :) | |
Re: the syntax for the following methods is not coorect: [CODE=java]public return getMonthlyInterestRate(annualInterestrate) public return withdraw(balance, withdrawlAmount) public return deposit(balance, depositAmount) [/CODE] The Correct syntax is [CODE=java]public double getMonthlyInterestRate(double annualInterestrate) public double withdraw(double balance, double withdrawlAmount) public double deposit(double balance, double depositAmount)[/CODE] The syntax of Java methods is [CODE=java]<scope> <return type> … | |
Re: Try to first copy one ArrayList to a new one. [LIST=1] [*]Create a new ArrayList. [*]Iterate over all the cells of the original ArrayList [*]Add each cell from the original ArrayList to the new one. [/LIST] After you have copied the entire original ArrayList to a new one, try to … | |
Re: Take a look at my response to your [URL="http://www.daniweb.com/forums/post1379071.html#post1379071"]previous post[/URL] regarding loops. The structure of the for loop is: [CODE=java]for (initialization; termination; increment) { //do something }[/CODE] Nobody said the that the initialization and increment parts need to be only by 1 each iteration. One can, for example increment as … | |
Re: Quick reading about inheritance [URL="http://download.oracle.com/javase/tutorial/java/concepts/inheritance.html"]here[/URL]. Now, let's review #4: [CODE=java]var4.method1();[/CODE] When class method1 in class Four is defined: [CODE=java] public void method1() { System.out.println("Four1"); super.method1(); }[/CODE] Meaning that first a line will be printed "Four1" and then the super.method1() will be invoked. You are right, you cannot see method1() inside … | |
Re: The expression (array[i]>otherVariable) is boolean - meaning it will return true if indeed array[i] is bigger than otherVariable and false otherwise. If you are trying to insert into myVariable the largest of the two variables, you might want to take a look at the [URL="http://download.oracle.com/javase/6/docs/api/java/lang/Math.html"]Math [/URL]class, spcifically the [URL="http://download.oracle.com/javase/6/docs/api/java/lang/Math.html#max(int, int)"]max(int … | |
Re: I'm not sure that I understand your problem. If you represent the grades as String then if the length is more than 1, you have a sign afterwards, otherwise you don't. You can represent the grades using enum as well. | |
Re: [QUOTE=spades0001;1379037]I made a flowchart that will print counting numbers 1-10 automatically, and I'm supposed to print their sum and average at the end. Now, I have to convert the flowchart into three Java programs: For, While, DoWhile. I'm having a bit of a problem on the flowchart and the programs. … | |
Re: Where is the class Reservation? Post it please. | |
Re: This code is partial, please elaborate what is the problem... | |
Re: If you can build an algorithm for this problem, it means that the problem is computable, therefore it can be done using a Turing machine (Church–Turing thesis). When you look at a string what do you do to determine if it's in the language? Perhaps something of the sort of: … | |
Re: Take a look at this page: [url]http://www.java.com/en/download/help/error_installshield.xml[/url] | |
Re: First of all, please wrap your code with [CODE=java] [/CODE] tags for more convenient reading. I have placed your main method inside the DataSet tester for now. This is the code again for clearer reading for everyone: [CODE=java]import java.util.Scanner; public class DataSet { private int sum = 0; private int … | |
Re: Why not splitting the String using String.split(",") method? | |
Re: (a) i=i*2 means that the loop will iterate for log2(n) times, therefore your complexity for the first problem is O(log2(n)). All other operations such as System.out can be counted as O(1). (b) Correct. (c) Think how many times the recursion is called. It is like a loop iteration, all the … | |
Re: If you solved the problem (by yourself, good for you) then please mark it as solved :) | |
Re: Quadratic algorithm means that for input of size n the complexity will be O(n^2). In other words the operation of the algorithm, starting for some n, will be <= C*n^2 for some number C>0. In our case 500 = 5 * 10^2. Now replace 10 with 1000 and you will … | |
Re: You need a method which accepts a String as the parameter [CODE=java] public static String translate(String word) { // TODO: Implement according to guidelines. } [/CODE] Now, lets think about the first case. You need to check and see [B][COLOR="Red"]if[/COLOR][/B] the first character of the word is a vowel (or … | |
Re: Let me get this straight - you have an array list consisting of N cards and you want to see that each one of the cards is different? | |
Re: Can you show the code that you have already written? | |
Re: Does the sub folder exist? What happens when you try to create a new sub folder? | |
Re: Mux circuits always come with input value that are powers of two, but you can define that some input entrances are blocked, meaning that no value will come of them. | |
Re: [QUOTE=ottilie;1145389]Okay, I have this problem to do and I have no idea how to do it. Refer to the method result: [CODE]public int result (int n) { if (n == 1) return 2; else return 2 * result(n-1); }[/CODE] If n > 0, how many times will result be called … | |
Re: You need to visit the [URL="http://download.oracle.com/javase/6/docs/api/"]Java 6 API[/URL], more specifically the [URL="http://download.oracle.com/javase/6/docs/api/java/lang/String.html"]String[/URL] class in the API, and inside that you have all the methods that the String class have, among them is the [URL="http://download.oracle.com/javase/6/docs/api/java/lang/String.html#substring(int, int)"]substring(int beginIndex, int endIndex)[/URL] method. For any questions about Java classes and methods you can always … | |
Re: [QUOTE=Haile12;1378574]Does anyone know how to hack passwords, like Facebook or email through Java?[/QUOTE] If you need to ask, you probably don't have the knowledge to implement the answer. | |
Re: [QUOTE=vbx_wx;1378102][code] package cls; public class main34 { public static void main(String[] args) { for(int i = 2; i <= 100; i++) { for(int j = 2; j <= i; j++) { if(i % j == 0) { break; } else { System.out.println(i + " "); } } } } } … | |
Re: >> - shift right. i.e. 20 >> 2 = 5 << - shift left. i.e. 5<<2 = 20 >>> - unsigned shift right. You can read it all in [URL="http://en.wikipedia.org/wiki/Bitwise_operation#Shifts_in_C.2C_C.2B.2B.2C_C.23_and_Java"]Wikipedia[/URL] | |
Re: [url]http://download.oracle.com/javase/6/docs/api/java/lang/Thread.html[/url] [B]static void sleep([COLOR="Red"]long[/COLOR] millis)[/B]: causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers. | |
Re: In concurrent programming (using threads) you might have a resource that you cannot have it being accessed simultaneously. For example, imagine that you have a linked list, and you want to remove a node from it. Imagine that in the middle of the removal, when not all the pointers are … | |
Re: You are not incrementing the values properly in the next() method: [CODE=java] public int next() { int result = recent + previous ; previous = recent; recent = result; return result;// todo: Update previous and recent, and return result. }[/CODE] Your tester is basically a recursion that doesn't do anything … | |
Re: You are iterating only once on the entire array, so I can't how your algorithm will work... I didn't check my code, but I think that should do the trick. It goes around all the subsequences possible and returns the start, end and max value of the subsequence with the … | |
Re: I agree with SasseMan, the problem is pure analytic. In addition, if you have to stop for 30min for gas and food, that depends where on the road you have to do it. If the gas station is reached before the t calculated in the previous section, then you have … | |
Re: It might sound really stupid, but something like this happened to me once and I simply renamed the folder, and it helped (Windows, go figure). Can't you just copy all the relevant material besides the problematic folder? | |
Hi all, I need some advice in implementing a new ADT that has length of n and the following operations: 1) Init() : Initializes all n elements to 0. Can assume that this is the first one called and called only once. 2) Write(i,x): write value x to position i. … |
The End.