• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in anyone can help me to create a flowchart..

    Yes, we can help you do it. What have you got so far?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Bump in the Road

    Sorry sorry sorry. Looking back at that post I wonder what I was thinking! Please ignore it. I'm sorry if it distracted you. I knew what it should look like, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Bump in the Road

    You have the recursive call to `next` on line 4, which is before you test for n<=1 and terminate the recursion, so it always recurses while initialising the variables, even …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in charges of a simple desktop Point of Sale

    That sounds like an absolutely standard little shop accounting system. It would be madness to pay for a custom application development and its ongoing support rather than simply deploy a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Linked List - infinite loop issue

    Without any kind of spec etc it's hard to understand what that code is trying to do, but it looks to me like the private method is going into an …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Linked List - infinite loop issue

    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 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hailstone Sequence so far

    Yes, Java is pretty strict on making sure you have initialised variables - and the logic analysis it does to confirm that is pretty sophisticated, but in the end it …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Salesperson Java Application Pt 2. Homework

    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.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hailstone Sequence so far

    > If there are no bugs in your code, it will work everywhere. True for many modern languages, but not C++. C++ suffers from "undefined behaviour" - code situations that …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hailstone Sequence so far

    Yes, in the past I have seen style guides and standards that deprecate re-using parameter variables,even if the language allows it. I don't know the reason, but maybe its to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hailstone Sequence so far

    Although it's true that you can omit the guard, I would argue for leaving it in. When you're reading a recursive method the first question is (how) does it Terminate? …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in calendar in frontend

    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
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hailstone Sequence so far

    A small point: line 8 you `return` in the `if` construct, so the `else` and its associated brackets are redundant. This is a very common pattern (it's called a [guard](http://wiki.c2.com/?GuardClause) …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in improving time complexity

    <Started to write rubuttal, the realised AssertNull is right> Yes, you're right So all I'm claiming now is that my solution is simpler :) JC
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in improving time complexity

    Unlike the other solutions this is guaranteed time complexity On, (additional) memory zero. int count = a.length; for (int i = 0; i < a.length; i++) { if (a[i] == …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in improving time complexity

    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 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Salesperson Java Application

    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 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in comparing between 2 strings characters in a recursive way

    > i don't want to make an entire class just for comparing those strings i need to include this in a single class within my project.. It's a common beginner …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in comparing between 2 strings characters in a recursive way

    > i get this error... > java.lang.StringIndexOutOfBoundsException: > String index out of range: 5 (in java.lang.String) That's a start. Almost certainly an incorrect parameter in a call to String's substring …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in comparing between 2 strings characters in a recursive way

    This is a really interesting challenge! To cope with repeated consecutive chars I think you have to break each string up into blocks of repeated (1 or more) chars and …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in comparing between 2 strings characters in a recursive way

    > but i get outOfBounds error When you get an exception ALWAYS post th ecomplete message and the line where it was thrown. Knowing the exact line, and the index …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in comparing between 2 strings characters in a recursive way

    Hi Adam That's what I thought at first, but consider the sample data str1=abbcd and str2=abbcccd when processing the first b in str1 you will consume all the b's in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in comparing between 2 strings characters in a recursive way

    tried the de-duplication method, and discovered the idea doesn't work if the first string has consecutive duplicated characters, so forget that. Looking at it again, and remembering the s1 may …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in comparing between 2 strings characters in a recursive way

    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 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Marked Solved Status for finding the sum of a string's character's values

    Just as the title says im trying to get the sum of a string's characters values, but in a recursive way and without for loops i tried to do this, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hailstone Sequence so far

    Take another look at the other functions because they still contain a lot of fat just like you removed from the first fn. Otherwize it's OK. Purely to help learning, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hailstone Sequence so far

    I'm sorry to say that me eyes crossed when I tried to read that code! It's way too complex. and the temp variables are not needed. Looking at all your …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hailstone Sequence so far

    Hi Firstly, I have to confess that C++ is not a language I know well, so I'll confine myself to the logic which would look much the same in Java, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in to check whether the string is a palindrome

    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)`
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hailstone Sequence so far

    Function `next`... is this supposed to return the single next number in the sequence? If so it doesn't need a while loop - it's only calculating one value. What happens …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hailstone Sequence so far

    > The largest number in the sequence is: (Problem line) In general... you have a loop that is generating a sequence of values and you want to know the largest …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Sherwin_4 in Hailstone Sequence so far

    @rproffitt I have spent days getting to where I am with the current code above. I would like to learn how to overcome my current issue without copying a completed …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hailstone Sequence so far

    > 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 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited Library management system

    Hi I'm new to php,i need a code for issue and edit in library management system can someone please help
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Library management system

    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 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Library management system

    > 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 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Item management

    It is covered in Oracle's Java Tutorials https://docs.oracle.com/javase/tutorial/uiswing/components/button.html
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited Item management

    Moderator edit> Original text deleted Original post was just a copy of a homework brief. No effort shown, not even a question. Will everybody PLEASE read this advice before posting …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited Item management

    Moderator edit> Original text deleted Original post was just a copy of a homework brief. No effort shown, not even a question. Will everybody PLEASE read this advice before posting …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Stefce in Open mobile camera through web browser

    Can this be made into plugin or something to be used globaly? Because i think it will be game changer on user registrating and it will reduce fake user registration …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Creating object arrays

    Here's an outline of how something like this can be structured... it contains the ideas you need. Once again - you were asked to use List, not arrays. class Library …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Input/Output C++

    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 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to rubberman in Input/Output C++

    And no, I am not going to correct your code. This is too simple of a problem, and you should have no problem solving it!
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Creating object arrays

    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 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Shared editor window??

    OK, well, I hope you're right. It's tragic that such a valuable service to our future IT professionals is subject to G's whim, but "Where does a 1 ton gorilla …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Shared editor window??

    No, I would (humbly) suggest that your time should go on SEO and marketing to drive DaniWeb traffic in general. That would be refected in the kinds of posts you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Shared editor window??

    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 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Pizza program what can I do to make this program work - improvement

    More thoughts on Observer... If all you are doing is creating Pizzas then the GUI can call methods to set the size, ingredients etc, then call another method to get …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Pizza program what can I do to make this program work - improvement

    If that's what your lecturer wants, then yes, you have to supply it! Having said that, apart from the user interface itself I can't see where Observer pattern is relevant. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Pizza program what can I do to make this program work - improvement

    Which web site do you mean? Anyway, just Google - there are dozens or even hundreds of them. From what you have posted so far it's not obvious to me …

The End.