- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 6
- Posts with Upvotes
- 6
- Upvoting Members
- 6
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
38 Posted Topics
Re: @james, Your "NoSuchAlgorithmException" gives the following error for me: *No exception of type Object can be thrown; an exception type must be a subclass of Throwable* | |
Re: In these modern times we get an option to pick our own seat, surely? ;-) | |
Re: KML (Keyhole Markup Language) files are for geographic data. It isn't part of the standard Java as far as I know, so you are going to need a 3rd party Java API. There are some KML libraries around that certain groups have produced. | |
Re: To throw the spanner in the works a bit ... perhaps this isn't the best way to find the largest number. Usually you assign the first number largest, and then compare it to subsequent inputs. If the next number is larger than the current one, then that becomes largest and … | |
Re: The first code is not a subset of the second, so will behave differently. The second class doesn't prompt for a file name. There is also a problem with (some of) the results it returns. | |
Re: Assuming all the connection details are correct, I would load a database browser like SQL Workbench and see if you can access the tables independently of the Java code. | |
Re: I've been through just about all of the available Java instruction books, and I can honestly say that the online Oracle tutorials are a nightmare for a beginner. Virtually ANY book is better to start with. One can't avoid the Java API though. Learning how to read and implement this … | |
Re: I may be mistaken, but two classes appear to be missing from the code CreateVideoList(); UpdateVideos(); | |
Re: Delivery and pickup should be mutually exclusive. At the moment you can select both at the same time. | |
Re: What does the input file look like? Let's see the data. | |
Re: All true. Look for a java book that emphasises problem solving. | |
Re: Avoid the official java tutorial. It can be confusing at best. Stick to a good, comprehensive book and get very familiar with the Oracle Java API.(http://docs.oracle.com/javase/7/docs/api/) | |
Re: From Java 6 javadoc: "StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead." http://download.java.net/jdk7/archive/b123/docs/api/java/util/StringTokenizer.html | |
Re: Post the work you have done so far. What you could do is read the file, line by line into a String. Then use **split** to remove the commas and put it into an array. String line = "Apples,bananas,oranges"; String[] dataArray = line.split(","); The above uses a simple array, but … | |
Re: You have a large while loop `while (simClock <= 500) {` ... then a print statement near the end ` System.out.printf("%d\n",simClock);` `}` Given the calculation and randoms, simClock is staying less than 500, so the while condition remains true and it repeats the print statement. | |
Re: Well just glancing at it, this is what it appears to be doing. It leaves Blueberry; then swaps Lite and Strawberry. It compares Vanilla to Lite and swaps it, then swaps places with Hash and so on. In other words; the V in Vanilla goes to the bottom of the … | |
Re: How about specifying the size of the array at the time of data entry? | |
Re: What version of JDK/Eclipse are you running? | |
Re: You have declared an array of a certain size, but your program is trying to access part of it outside the limit. | |
Re: The check digit is used to confirm the number is correctly read/written or just valid. Think of a credit card number. You could also use the substring() method. Assuming you wanted just a hyphen in the middle. Split the number into two. String firstTwo= number.substring(0, 2);//digits 0 and 1 String … | |
Re: Depends on the approach you are taking. Maybe give us a quick algorithm, then we can suggest improvements or a different option. | |
Re: `System.out.print(myString);` You are trying to print an array. Split will create the array in one go, but you need to do some work to print it. You need to use a loop. | |
Re: Dan, one tip I find helpful for beginners is to label the end brackets. For example: public class AnyClass { public static void main(String[] args) { ... }//main }//class | |
Re: Initialize variables to zero. Not sure why days are intially = 60 ?? May I suggest converting everything to seconds. Then try something like this (using % to get the remainder): hours = totalSecs / 3600; minutes = (totalSecs % 3600) / 60; seconds = totalSecs % 60; or something … | |
Re: In class TestProgram, the main method instantiates myCircle AFTER it is called. (just a guess ;-) ) | |
Re: Just a few things: * You're trying to make it look neater by making the formatting a string variable. I would say this is not going to help. Unless this is part of some other plan, maybe just leave the formatting alone e.g. printf("%d",x); * Some of the variables are … | |
Re: So c is a counter? (why not call it that) Is it supposed to be keeping a tally on a specific array element? BTW. n is not used. | |
Re: You're asking for too much information in one go in line 8. Think of the user entering it all. So many **if** ... statements. Prime candidate for a **case** statement. (Have you covered those yet?) Bear in mind when you use if xxx if yyy if zzz .. that your … | |
Re: Are these pairs of hex numbers, like 10 B7 etc..? | |
Re: import java.util.*; This needs to go in Employee class as well. | |
Re: Yes. Take the Main method out of Oneclass and put it in Twoclass and it should work as intended. Also don't forget to use standard naming conventions for class names. | |
Re: For this exercise, just use the default path (filename in the space between the quotes). Then for Eclipse, look in your workspace. On windows 7, the default is {C:\Users\Star\workspace\ThisProject} I would just play with the file I/O for now and just see if you can read the data. Maybe just … | |
Re: In your test program, try instantiating the statistics class like so: Statistics stats = new Statistics(); Then you can refer to the methods using 'stats.xxx' | |
Re: I find your code confusing. Perhaps your naming conventions are too cryptic. You also only provide part of the code, not the whole class. I'm also uncertain what it is meant to do. Can you clarify please? | |
Re: There are a few things wrong with the program. (Apart from the variables not being initiated) (1) line 34: period = Scanner.nextInt(); The scanner expects an integer value. It isn't clear whether you want input to be a String or an integer. If you need the user to enter "daily", … |
The End.