4,084 Posted Topics
Re: "I am getting a bunch of errors" ... see, it would be better if you told us what errors, when they occur (runtime, compile time, ... ) | |
Re: malli: talking about overkill . did you read James' reply? the same functionaity in a simple: `s1.contains(" ");` and there's no use in saying "that wasn't there yet when I posted", since that reply is three years old. | |
Re: some recommendations: throw away about all of the comments in that code. just look at this part of your code: public class OfficeSupplies { //Beginning of OfficeSupplies class //Declare instance variables private int itemNumber; //Item number private String productName; //Name of product private int unitsInStock; // Number of units in … | |
Re: malli: something that just came to me now (didn't notice it in your previous source codes). besides the fact that your code is faultive as can be (according to your code: é is a digit, which it really isn't.) if you want to boost up the efficiency of that code … | |
Re: make an array of chars, filled with all the possible capitals, iterate over this array and check if the string contains the char ... the .contains method could do that for you | |
Re: ehm ... create a new file, copy the contents, then, delete the original one. I don't get what it is you are asking. how to create the copy, or how to list all the files in a folder, or, ... | |
Re: the infinite results is because of this: while(randNum != 5) { counter2++; System.out.println("Total bottles needed to find a winner:" + counter2); } you tell the application: as long as radNum is not 5, add 1 to counter2, and print this line. that is when it goes back to the check … | |
Re: if you want to add spaces on every line, why add the if statement? if (line.contains("{")) { spaces += " "; line = spaces + line; } in the first line, you are telling your application only to run the two lines within the block, if the line contains "{". … | |
Re: > Modify the Inventory Program by creating a subclass of the product class that uses one additional unique feature of the product you chose (for the DVDs subclass, you could use movie title, for example). so; create a subclass of product with one additional variable > In the subclass, create … | |
Re: a few things I would change: don't instantiate Scanner in the instance (constructor) itself. you'll create a new instance of Scanner for each and every instance of Student, which is a waste of resources. just create a constructor that takes two parameters (String name, double gpa), and set the values … | |
Re: actually, this is not that difficult. what you need to do first, is to check whether you need to write it in one single loop, or are allowed to use nested loops, and whether or not the array will always be int[x][x] for int[x][y] the implementation would be different. if … | |
Re: what is a "sql table" ? I assume you mean a database table? well, hibernate or jpa can help you out, no doubt. | |
Re: an array in Java is an Object. not an Integer, but still an Object. so, you pass two instances of Object to doStuff, and the only method you have capable of dealing with this is: static void doStuff(Object... o){ s += "2"; } | |
Re: razamughal67: you seem to be mistaken. what you are asking, is JavaScript, not Java. even though the names seem alike, they are not even remotely related. One is a scripting language, the other is a platform independent programming language. anyway, it is fairly easy to manipulate the css scheme for … | |
Re: by correcting your code, no doubt. you didn't post your actual goal, just some code that doesn't do what it's supposed to do. you've also posted an "ideal" output, but you neglect to mention how that output is (logically) built, and why that is the output you need to get. … | |
Re: well ... get both values and use the equals method. then it's just a case of forwarding to the right page. I don't see the difficulty you seem to be having? | |
Re: idea about what ? if that is your process flow, either you are working on a dummy project, or you don't truly understand a process flow, or you have an idiot making your analysis for you. you could start of with a wsdl and xsd's describing your service and the … | |
Re: find all occurrences of </p><p> and replace it by <br/>, then, check if there are occurences of either <p> or <br/> with a space as next char: `while(spaceNextChar()) removeChar();` | |
Re: because you use instance variables in your calculations. if not provided, they have a default value of 0, which isn't changed in your further handling of the fields, so, your calculations lead to 0. basically: what you end up with is this: public double calculateGallonQuantity() { roomArea = roomWidth * … | |
Re: ... this code makes no sense. you have no abstract methods whatsover, and you don't implement them in child classes. in the code above, I have no idea why you even have a child class. actually, on a second glance: it's even worse. your main problem has nothing to do … | |
Re: so: actually, the problem is that you haven't written the code yet? what is the concrete question you want to ask. if it is how to. step 1: clear the screen. step 2: get the right coordinates you clicked at step 3: create a circle with the correct radius and … | |
Re: are you talking about createStatement ? this is a method from the Connection interface, returning a Statement. just check [here](http://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#createStatement()) . EDIT: the Statement interface doesn't have a createStatement method, by the way. if you check the api, you'll see this: > See Also: > Connection.createStatement(), ResultSet which is basicly … | |
Re: JamesCherrill: price an instance variable ? it's declared within the main method, just like all the other variables. where do you see it as an instance variable ? | |
Re: if you want to print the array, why using a for loop? my guess, you want to print the values of the elements (not the actual array itself). just go through a loop (either a classical one, or an enhanced for loop), and pass the element of the current iteration … | |
Re: these links are worth looking at: [DateFormat api](http://docs.oracle.com/javase/7/docs/api/java/text/DateFormat.html) [SimpleDateFormat api](http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html) [SimpleDateFormat examples 1](http://www.javablogging.com/java-simpledateformat-examples/) [SimpleDateFormat examples 2](http://stackoverflow.com/questions/5580965/java-date-formatter) | |
Re: look at line 182 in your code (it's pretty hard to see above which line it is). it seems like you are calling a method on an instance variable you haven't instantiated yet. and that field would be "grossIncomeJTextField". the reason for this is: in your createUserInterface method, you are … | |
Re: DkgMarine: that makes no sense. first of all, String is a part of basic Java. if that can't be found, your JDK wasn't installed decently, or you didn't set the path of your IDE correctly. next to that, as James pointed out: there are some serious violations against Java's rules: … | |
Re: `String output="Sum of the Addition of "+num1+" "+num2+" "+num3+" "+num4+" Sum` is missing a "; at the end. it should be: `String output="Sum of the Addition of "+num1+" "+num2+" "+num3+" "+num4+" Sum";` or: you didn't close your String literal, as your error message said. | |
Re: maybe he should ask the seller himself. at least that person 'll be aware of the actual difference (be it in $ or in %) between the selling price and the purchase price. | |
Re: remember for a next time "have some errors" is pretty vague. always try to be as specific as possible. | |
Re: InetAddress receiverHost = InetAddress.getByName(args[0]); int receiverPort = Integer.parseInt(args[1]); String message = args[2]; you need to pass as arguments: * the InetAddress * the receiverPort * the message in that order. since we don't know your configuration it'll be pretty hard to be more specific. | |
Re: DonnSchwartz: ever took a Java course and handed in the solutions to the assignments writte in C ? why not Cobol? at this point, the OP doesn't need another language, as JWenting stated, she needs to think about the classes/methods she needs, and start writing them. as for her last … | |
Re: ok, so now you've posted the assignment, what is the actual problem you are having? | |
Re: in your constructor, you have the parameters set like this: `public DVD(String title, double stock, double price, double item)` but you call it like this: dvd = new DVD(1, "Just Go With It", 8, 2.04); dvd = new DVD (2, "Gnomeo and Juliet", 2, 1.34); ... the title should be … | |
Re: so, you've told us what you need to do. now, what exactly is your question about it? get an array of chars from the String, then check each element, and verify that the next element of the char is valid. if not, throw an Exception. | |
Re: don't just copy paste your assignment here. work on it, part by part, and at least try. you're not even bothering to mention which parts you are having trouble with, you just copied your original baseline code and assignment. go step by step, and when you run into something you … | |
Re: that isn't even the entire main method. it's impossible for us to make anything out of this, let alone know what you are looking for. but, anyway, you have a ')' too much in your `double newBalance = savingsAmount * Math.pow((1+annualInterestRate/12),(numberofMonths*12)-1)/annualInterestRate);` no doubt your compiler already told you this. | |
Re: hericles: you missed the first problem: there is no opening bracket after the class definition. public class Receipt public static void main (String[] args) { should be: public class Receipt{ public static void main (String[] args) { and, even though hericles is right about the ')' that shouldn't be there, … | |
Re: what seems like a good way to go? you'll always best use several ways combined. have a lot of keywords, keep your page active, keep it up to date, ... also: when written using a framework like GWT, you might need a little 'hack' to get google to take your … | |
Re: that error states that you are trying to run/load a class called Program.bin, and that class isn't found. did you alter something, change something in the path, or the libraries of your project? | |
Re: brianMagento: chances are, if the OP hasn't figured it out yet, he's not looking (anymore) | |
Re: This is almost an impossible question to answer, but I'll try to shed some light upon what it should contain, and why it is pretty hard to answer it. The first step is not, building a portfolio, it is gaining the knowledge you'll use while building up a portfolio. Just … | |
Re: privacy is a nice thing, but complete privacy is a thing of the past. maybe better as well: complete privacy implies that nobody knows you, and that seems a pretty dull life. as for all the security camera's they have out there, and all kinds of recording material ... they … | |
Re: do you have any idea how old this thread is? | |
Re: Slavi: the way I understand it, he types: `4*5=20` so, here he has: first: 4 operator: * second: 5 result: 20 <result> = <second>th multiple of <first> Puk: how is this different from printing: <result> = <first>th multiple of <second> ? if this is not what you are doing could … | |
Re: re-read your original post (which contains the assignmet, and thus the steps to take) and write the code. | |
Re: public double getsideLength() { //x is undefined. Null Pointer Exception return x; } what do you mean, NullPointerException? this won't compile, how do you expect a RuntimeException on this ? | |
Re: are we talking virtual, or an actual "car" that you'll be driving around in your living room or something like that? if it's the second, don't go for Java. go for a language that 'll be able to completely interact with the hardware to go with it | |
Re: are we talking about a webapplication, that you are running in that browser, or are we talking about a browser written in Java for which you can alter the source code? if not, I very much doubt it. |
The End.