7,116 Posted Topics
Re: > I'm having trouble coming up with a way to print the max and this line "The longest hailstone sequence starting 7 with a number up to has length____." for the output. You don't explain exactly where you are stuck, but all you need is something like for i = … | |
Re: subSet method is way off - contains code that is not just unneccesary but actually prevents it working - it's really simple given what you already have done, but you have made it too complicated. s2 is a subset of s1 if for each element in s2 the element is … | |
Re: Look at line 45. You have an extra `;` that completely changes the meaning of that line of code, and therefore the meaning of what follows. | |
Re: Dani. Please. For the sake of all of us who love and contribute to DaniWeb, please stop fiddling about with techy black holes and put 100% of your time into saving DaniWeb. DW is the one and only flagship demo for Dazah. Without a thriving living growing example Dazah will … | |
Re: There's nothing in Swing, but if you have moved up to javaFX then that has a date picker. Otherwise there are open source solutions such as http://www.codejava.net/java-se/swing/how-to-use-jdatepicker-to-display-calendar-component | |
Re: The surfing is still a nested loop potentially with On^2 (depending on how many zeros there are). Similarly Adam and Danis solution is also potentially On^2 You can make one pass ascending and set each element to its distance from the previous zero, then a second pass descending overwriting any … | |
Re: Doing it by comparing characters implies a loop or recursion that maintains a current index for each string - it's going to be quite fiddly to get right. As a completely different approach... if you write a method to remove all the duplicated consecutive chars from string2 then the result … | |
Re: Some basics: Everything you use in Java must have been declared. You try to use a variable `employee` but you have not defined it anywhere. Spelling, including upper/lower case must be exactly correct... `print1n` is not the same as `println` Punctuation in Java has to exactly correct all the time, … | |
Re: The condition is that the string with all its letters reversed is the same. Alternatively, for each position `i` in the string `letter at i = letter at (length -i)` | |
Re: No need for an array, just read each line from the file, calculate the price x num tickets, add that to a total that you initialise before starting to read the file, | |
Re: Jacob You posted this before. You were referred to some good advice. You chose to ignore it and re-post. I'm closing this thread. Go back to your first thread and show some effort if you want help. JC | |
Re: > I need codes for issue and edit in library management systems No you don't. You need to learn php so you can code it yourself. It's what we call "education". Show what you have done so far, and someone will help you from there. | |
Re: It is covered in Oracle's Java Tutorials https://docs.oracle.com/javase/tutorial/uiswing/components/button.html | |
Re: Sorry, my lack of Spnish makes that hard to understand, but I can see that you are using arrays when the spec asks for List. Anyway - what exactly is your question? | |
Re: Hi D2 - hadn't noticed that it was you! :) JC Sketching out a GUI is a good way to understand the requirements etc, but it's NOT the place to start actual development. This is an OO exercise, so start with the objects. Look for the important nouns in the … | |
Re: I ws going to post you a "Let me Google that for you" link, but in deference to your seniority I won't :) Anway... > The Zakat is a form of giving to those who are less fortunate. It is obligatory upon all Muslims to give 2.5 % of wealth … | |
Re: 1. `y = x - (1+1)` is NOT the same as `y = x - 1 + 1` You should learn about operator precedence and L-R execution before criticising 2. Where exactly do you suppose OP should check for division by zero? That code does not have a single example … | |
Re: Maybe you need to work on your Google technique. I Googled `ACH - NACHA payment C# ` for 38,600 relevant hits. On the very first page I found a [GitHub project: C# library for the NACHA ACH input file structure](https://github.com/mrfright/NACHO) plus 4 more hits with actual solutions. | |
Re: Hi Scheppy Picking an unknow number of entries from an array of unknown length - you will have problems coding this with ordinary loops because you won't know how many loops to code. It has "recursion" written all over it. Eg array contains 1,3,4,3,5,8,2,1, target is 5 take the 1, … | |
Re: Yes... and... ? Either contribute something, or ask a proper question. | |
Re: I also cashed in once to see how it worked. But dividing the reward by the number of posts I made it's clear that the financial motivation was vanishingly close to zero. I say "let it die a peaceful death" | |
Re: Every rule has its exceptions, and this is one. It's very common that you end up with a bag full of assorted utility methods that are low-level things used in various different parts of your system. A literal interpretation of SOLID says you should put each one in a different … | |
Re: Did you notice the pinned Programming thread "Read this before posting a question"? It's there for a reason https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question | |
Re: It looks like the "manipulations" involve re-ordering the words, so the first stage would be to split the input into an array of words. ps: Have you identified the relationship between `n` and the exact manipulation yet? | |
Re: If you have numbers to display in a JLabel there are two steps: 1. create a String that contains the info you want to display by combining descriptive text with the actual numbers 2. Use the JLabel's setText method to display the String in the JLabel eg: String textToDisplay = … | |
Re: I see you failed to test this code, because it doesn't get anywhere near the stated functionality. If you don't understand why try these test strings: "This data has one sentence starting with a CAPITAL letter." "this has none, says James." "An ellipsis looks like this: ... . "É is … | |
Re: Never do this when writing new code: } catch (Exception e) { } If/when there is an error you just told Java that you didn't want to know anything about it, and please discard the detailed error message that Java just created for you. ALWAYS put an e.printStackTrace(); in your … | |
Re: This is difficult, if only because the problem isn't rich enough to require much in the way of OO design or implementation. Anyway, here's one thought: We start with picking Objects from the components in the problem defintion (DataSet, Filter), but you also need objects to represent the overall processes … | |
Re: Apart from being 11 years too late, your solution to counting capitals is way worse than the one in the previous post - not just longer more complex code, but fails completely for any alphabet other than basic English. | |
Re: Your question doesn't seem to make sense. You have one variable x that is defined in A and inherited in all its subclasses. That variable can only have one value at any one time. The constructors set x variously, and the value of x will be the last value set … | |
Re: A bit late for the O.P. (!), but may be useful to someone searching this topic, so thank you. | |
Re: Hi avudai, welcome to Daniweb. Your thanks are welcome, but if you like a post you should show that by giving it an up-vote. Don't make a new post unless you have a relevant contribution to the actual topic. You should also be aware that this is a six year … | |
Re: Look at line 18 If you try to create a value greater than 3 this will reject it | |
Re: 1. Google Java RSA 2. Click on any of the tutorial/example links that displays 3. Use some initiative and do a bit of work before posting another lazy request like this. | |
Re: So let's suppose I have done what you said and modified my Ackermann function successfully. Now, did you have question, or were you just issuing some kind of Xmas holiday challenge? | |
Re: You have tagged this Java, but your posted code is not Java code. | |
Re: It depends on your employer. Most companies expect you do attend meetings, drink coffee, document your code, fill in time sheets etc etc. Others expect you to code 22/24 hours for peanuts and treat you like an idiot slave. If you have any empathy sensors at all you will se … | |
Re: First thing is to fix that terrible catch clause. If/when there is an error you just told Java that you didn't want to know anything about it, and please discard the detailed error message that Java just created for you. ALWAYS put an e.printStackTrace(); in your catch blocks until/unless you … | |
Re: /n has no special meaning. But \n is the new line character. The \ is used to start an "escape sequence" that allows you to enter special codes like the following either as a char or as part of a String: \b (backspace BS, Unicode \u0008) \t (horizontal tab HT, … | |
Re: Was that intended to be a `for` loop? | |
Re: You don't. Java is cross-platform, and exe files are not. Give him the jar file and it will run on his Windows/Linux/Mac computer - anywhere with a JRE installed. If for some obscure reason you absolutely must have an exe file for some specific operating system there are a couple … | |
Re: It would help if you told us which line throws the NPE, we're not mind readers | |
Re: I'm no expert at C++, so can someone else look at this and see if I'm missing something? > zachattack05 : 25 % 2 would return 5 | |
Re: Yes. The simplest way is to display each node as some kind of button. Edges are a bit more fiddly - you proably want to allow the user to tap "close" to the line because the line itself will be a difficultly small target. If the graph is tidy, with … | |
Re: OK, it's a start. Be careful with your terminology. If Person is a class then the others have to `extend` it. If it's an interface the others `implement` it. Chosing between an abstract superclass and an interface is often one of those difficult decisions. Chose a class and you prevent … | |
Re: > you can help, and send me an e-mail of solution No, absolutely not. That will not help you (unless your only objective is to be a learn-nothing cheat). Yes, we will help you, IF you make a proper effort to learn and develop. Show your work and we will … | |
Re: Are you sure that code is being executed? Maybe there's a problem with your listener. Try printing the selected index in those if tests to confirm. You can have a "total" variable that you add 250 or 500 (etc) to in your listener the set the text field to `total … | |
Re: We only help people who are trying to help themselves. Your mastery of copy/ paste isn't enough. Don't post again until you have actually done some work, and have a genuine question | |
Re: Those two are not equivalent. In the first you seem to hope that allowing your entity manager to be garbage collected is enough to be sure you have no resource leaks. The second guarantees that the em is closed properly. The first is bad coding, the second is much better. … | |
Re: Android: yes Windows: yes, but it's not the best option IOS: No, not possible <edit> Seems I was wrong about that - see OMAF below </edit> Having said that, switching language Java - C# - Swift isn't that hard. Its the API that's hard to learn and doesn't translate. Start … |
The End.