-
Replied To a Post in DNA CHAIN
It does work - there's another bug in your code somewhere. Just to prove it here's an example that works (I'm not suggesting you copy this, your teacher will realise … -
Replied To a Post in DNA CHAIN
If you have done that translation then all you need to do the search is is longDNA.indexOf(shortDNATranslated) https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#indexOf-java.lang.String- -
Replied To a Post in DNA CHAIN
I find that code very hard to read, but looking at the matching around line 78 it looks like you are testing if the chars from the two DNA strings … -
Marked Solved Status for Generating a triangular random
I'm looking for an algorithm, pseudocode or any langauge, to generate random numbers with the following characteristics: integer values in the range 0-n lower values much more likely to happen … -
Replied To a Post in Generating a triangular random
I like where this is going. To explain a bit more of the background (without violating an NDA) this is a mutli-player game situation in which a large number many … -
Replied To a Post in Generating a triangular random
Excellent! Thank you very much! Yes, I realise the probability formula I posted wasn't quite right, but I was just trying to illustrate a point, so I coudn't be bothered … -
Replied To a Post in while multiple condition help
I would say, for while loops if the loop depends on a number of things being true (eg more data waiting, no errors found, server available), then AND is needed -
Replied To a Post in Generating a triangular random
OK, strictly speaking I should call it a FIMLTBFO queue - First In, Most Likely To Be First Out queue -
Edited Generating a triangular random
I'm looking for an algorithm, pseudocode or any langauge, to generate random numbers with the following characteristics: integer values in the range 0-n lower values much more likely to happen … -
Created Generating a triangular random
I'm looking for an algorithm, pseudocode or any langauge, to generate random numbers with the following characteristics: integer values in the range 0-n lower values much more likely to happen … -
Replied To a Post in Help With Java Method Calling 2
Yes, that's the same arror as before. I explained it 3 posts ago. -
Replied To a Post in Help With Java Method Calling 2
The whole point of making and using a new instance is to avoid static. The "Java" way to do it is to get rid of all the `static` keywords (except … -
Replied To a Post in Help With Java Method Calling 2
You already asked that in your previous thread, and I already answered it. -
Replied To a Post in Help Calling Java Methods from different classes
I see from your new thread that you made all your members static. Just be aware that although this fixes this particular problem, it's completely the wrong way to do … -
Replied To a Post in Help With Java Method Calling 2
OK, I didn't read all the rest of the code after I saw the problem. Anyway... > "getProductList" should... Use the CollectionStorageFileUtility's "load" method to load the Product class collection... … -
Replied To a Post in Help With Java Method Calling 2
It looks like the line causingthe error is line 71 above products=(List<Product>) CollectionFileStorageUtility.load(Product.class); I don't have any info on CollectionFileStorageUtility, but it seems to return a `Collection`. In this particular … -
Replied To a Post in Searching algorithm to search through strings
OK. now that's done I want to show you one more thing. Your code mixes program logic with GUI and makes both of them confusing. I just did a cut/paste … -
Replied To a Post in Searching algorithm to search through strings
Well done! Are we finished here now? J -
Replied To a Post in Searching algorithm to search through strings
> is that because it gets cleared out just after the message is entered? Yes, I expect so. That's a good example of why you should keep logic and GUI … -
Replied To a Post in Help Calling Java Methods from different classes
It's the inventory application class that needs an instance of InventoryManager to work with. I don't understand your second question. -
Replied To a Post in Searching algorithm to search through strings
How you have it now looks OK to me. The compiler is just doing its job! If you declare a method as returning something then the copmpiler checks that you … -
Replied To a Post in Searching algorithm to search through strings
That's a null pointer exception, so that presumably starts when you return null from `getSentenceContaining`. getMatchedSentence tries to loop through all the Strings in that returned value, which is obviously … -
Replied To a Post in Searching algorithm to search through strings
Yes, that's right. (Equally you could have created an inner class to do the same thing.) When the user edits, it's the insert and removes that will mainly be called. … -
Replied To a Post in Help Calling Java Methods from different classes
You first need to create an instance of InventoryManager - once you have an actual instance then you can do all the following operations using that instance. eg InventoryManager myManager … -
Edited help in solving mathematical problem in c program
<Complete copy of assignment deleted by moderator> Do ensure you own the intellectual property rights to everything that you post Do not post copyright-infringing material -
Replied To a Post in help in solving mathematical problem in c program
OK, so you have copied your teachers complete assignment and posted it on a public web site (did you have the copyright owner's permission?). You didn't even bother to explain … -
Replied To a Post in How to add button in row in jTable
Have a look at Oracle's detailed tutorial on JTables http://docs.oracle.com/javase/tutorial/uiswing/components/table.html in the section on Custom Renderers you will learn how to replace cells in the table with the controls of … -
Replied To a Post in Searching algorithm to search through strings
No mouse or key listeners. Just a `DocumentListener`. As in `inputField.getDocument().addDocumentListener(..` Yes, you start with an empty field. The user types "H", the document listener's insertUpdate method is called, you … -
Replied To a Post in Searching algorithm to search through strings
The document listener will be called whenever the user changes the contents of the entry field, reagrdless of how he did it. Personally I am 100% in favour of "live … -
Replied To a Post in Searching algorithm to search through strings
Oops, sorry about the for loop. I created that code by editing yours and forgot to fix the for clause. The GUI stuff is going in the right direction. I … -
Replied To a Post in Searching algorithm to search through strings
Yes, except after the `return null` you don't need to use an else clause, so lines 5 and 9 can be deleted and lines 6-8 indented less, leaving the code … -
Replied To a Post in does set store elements in specific order ?
OK yes. The "specific order" can be defined by a comparison function (Java `SortedSet`, C++ `Set`) or by remembering the order/position of elements as they are added (Java `List`), which … -
Replied To a Post in I need to find out why my income tax output is outputting zero
I'm sorry, but lines 26-32 are complete nonsense. Just delete them and start again by doing the following: 1. Keep a copy of the requirements in front of you at … -
Replied To a Post in Searching algorithm to search through strings
That looks OK. If you're interested I have a few very small suggestions: 1. As always - naming. eg `searchWord` really means `getSentencesContaining(String s)`. eg `instanceFound` sounds like a boolean … -
Replied To a Post in Random Numbers
You also have a problem on line 25. As soon as this is executed it will return from the current method - which is the `main` method, so your program … -
Replied To a Post in does set store elements in specific order ?
As you say, in Java Set is an interface for Collections with no duplicates but no information about ordering, so that's completely different from C++ sets which are weakly ordered. … -
Replied To a Post in java.lang.NullPointerException: Attempt to invoke virtual method 'java.uti
You didn't say which of the many JSONConverter implementations you are using, and the line numbers in your posted code don't correspond to the exception message, but at a guess … -
Replied To a Post in Reading file and store it into 2D array and parse it
Read this thread - it contains a complete discussion. If you are still stuck start a new thread of your own, and post what you have done so far. Nobody … -
Replied To a Post in I am trying to run batch script in Jenkins client machine, but not succeede
1. Use ProcessBuilder, which is the more recent replacement for Runtime exec 2. Parse the args yourself and pass then separately to ProcessBuilder, because its default parsing of command and … -
Replied To a Post in calculate the grades for a student using if..else statements.
No. People here will help you if you want to learn. Nobody will do it for you. If you are willing to show effort start a new thread and show … -
Replied To a Post in logical operators applied to a double
You can create a class (see previous post) and have a searchable List of those standard sizes, something like class ThreadSize { final double diameter, pitch; final String designation; public … -
Replied To a Post in logical operators applied to a double
Looking at that code it seems to be crying out for some Object Oriented love, Why not create a Thread class with pitch, diameter as attributes and methods like `getDesignation()`(with … -
Gave Reputation to Mar. Na. in How calculate CBO coupling between objects in java
package javaapplication12; import java.io.*; import java.util.*; import com.sun.org.apache.bcel.internal.classfile.ClassParser; import com.sun.org.apache.bcel.internal.classfile.JavaClass; import com.sun.org.apache.bcel.internal.classfile.*; import com.sun.org.apache.bcel.internal.generic.*; import com.sun.org.apache.bcel.internal.Repository; import com.sun.org.apache.bcel.internal.Constants; import com.sun.org.apache.bcel.internal.util.*; import com.sun.org.apache.xalan.internal.xsltc.compiler.Parser; import com.sun.xml.internal.ws.org.objectweb.asm.MethodVisitor; import java.lang.reflect.Modifier; public class CyclomaticComplexity { … -
Replied To a Post in logical operators applied to a double
Ditto. If all the values are held to 2 decimal places then consider using int variables in units of 1/100. (ie replace float 1.55 with int 155). Then, and only … -
Replied To a Post in Searching algorithm to search through strings
Yes. Create new List<String>, add all the matching sentences to it, and return it. -
Replied To a Post in Searching algorithm to search through strings
Well yes, you can update the GUI directly from inside the search method. However it's best practice to separate GUI from logic, and to keep methods as simple and local … -
Replied To a Post in Searching algorithm to search through strings
OK, excellent! I suggest you try a couple more tests before moving on - just to be sure - change the keyword to (1) a value that is not prersent … -
Replied To a Post in Searching algorithm to search through strings
You can call the search method from anywhere anytime after allSentences has been initialised. To avoid that NPE you could start your print method by testing for `allSentences == null` … -
Replied To a Post in Searching algorithm to search through strings
Like the doc says - isReadable gives you the right answer at the instant you call it, but there's no guarantee the file will still be there and readable when … -
Replied To a Post in Searching algorithm to search through strings
I would not try to move on until I was ure the data is what it should be. I don't know how to interpret that output since I can't see …
The End.