Search:

Type: Posts; User: BenjaminJ

Page 1 of 2 1 2

Search: Search took 0.17 seconds.

  1. Re: Advice needed about java database systems

    It's a job for a friend. Nothing overly serious.

    I'm looking for it to be a standalone app with a database inside it. So the database needs to be stored and accessed.

    SQL doesn't look too...
  2. Advice needed about java database systems

    Hi,

    I've been asked to create an app for nutritionalists to check what their clients are eating.

    I've found a database of all foods with nutritional values. In the past I've dealt with...
  3. Replies
    7
    Views
    251

    Re: Creating a separate method for for loop

    Partially - I was hoping to get the index of every character individually. So 'abc' would be '123' and then '123' would act as the seed for the psuedo-random number generator. Maybe a for loop isn't...
  4. Replies
    7
    Views
    251

    Re: Creating a separate method for for loop

    So, instead of:



    alphabet.indexOf(tokens[i]);

    int result = tokens[i];


    it should be
  5. Replies
    7
    Views
    251

    Re: Creating a separate method for for loop

    Okay, is that better?
  6. Replies
    7
    Views
    251

    Creating a separate method for for loop

    I'm trying to create a PRNG which takes a seed through Scanner.

    Here's the (terrible) code:



    import java.util.*;

    public class Numbers {
  7. Re: Identical if statements behaving in different ways

    Okay, so, my program needs to match this: Maisto Ford Mustang Limited Edition 1:18 Red
    with "Mustang" but not to "Ion"

    Sample input and output:

    INPUT:

    Maisto Ford Mustang Limited Edition...
  8. Re: Identical if statements behaving in different ways

    This is the part I updated.


    for (int i=0; i<scaleList.length; i++)

    if (title.toLowerCase().lastIndexOf(scaleList[i].toLowerCase())!= -1)

    { scale = scaleList[i];
    ...
  9. Re: Identical if statements behaving in different ways

    Well, another issue has come up. For example with a model of a 'GT500' the program reacts by matching that first with 'GT' and settling with that. I've tried '.contains', I've tried .indexOf != -1,...
  10. Re: Identical if statements behaving in different ways

    You're right, I've reduced the block of if statements to nine lines in total. And the problem, originally, was the way I joined new lines with +s instead of just pressing enter and typing a comma.
  11. Identical if statements behaving in different ways

    I'm writing a program which takes the title of a model car and breaks the elements down into HTML metadata.

    All of the car companies (Ford, etc.) are in an array, which is called upon to be...
  12. [SOLVED] Re: Potentially broken switch statement or program logic.

    Yes, sorry, it was a case of curly brace confusion once again.
  13. [SOLVED] Potentially broken switch statement or program logic.

    The premise is a brute force search for an inputted string. Based on the length of the inputted string (1-4) the switch statement executes one of four blocks which should break when it finds the...
  14. Re: if statement - might have problem with char to String casting?

    Would you mind naming the method? I'm only just starting to learn the String class.

    And thanks jdv for the information, much appreciated.
  15. Replies
    4
    Views
    113

    Re: HOW to do it?

    You could try a string array containing every stage of the dot pattern and having a for loop cycle through the elements.
  16. Re: if statement - might have problem with char to String casting?

    So I'd have the array which would have a .length as the amount of items as chars inputted by the user? Then what would I do with that array? Surely there'd be an amount of possibilities which I'd...
  17. Re: if statement - might have problem with char to String casting?

    Oh! Excellent. That totally slipped my mind. Why is not giving me an error, in that case? Is there any way of modifying this code so the user can input a string of any length they choose? I assume...
  18. Replies
    3
    Views
    76

    Re: Date conversion in java..

    Hi there,

    For people to help it's useful if you put [ code=java] [ /code] (without spaces) around your code, and also paste the sample output.

    Thanks
  19. if statement - might have problem with char to String casting?

    import java.io.IOException;
    import java.util.*;
    public class Guesser {
    public static void main(String[] args) throws IOException {

    char[] alphabet = "abcdefghijklmnopqrstuvwxyz1234567890...
  20. Re: Print variable which only exists within for loop?

    int[] onetoTen = {1,2,3,4,5,6,7,8,9,10};
    int sum = 0;

    for (int i=0; i<10; i++) {



    sum +=onetoTen[0]++;
    System.out.println(sum);
  21. Re: Print variable which only exists within for loop?

    Okay, thank you both that worked fine, does that mean that it needs to be declared in main only? I tried it in main and that worked, but would it work if it were to be declared in another method?
    ...
  22. Print variable which only exists within for loop?

    There's loads of problems with this. What I'm trying to do.

    1) get a program to add the contents of an array together, preferably with a for loop and not the heavy handed version I've tried to...
  23. Re: Randomise Placement of Variables in Outputted String

    Thanks for the suggestions but I think that it might be beyond my capabilities right now - I understand the logic but not how to implement it.
  24. Randomise Placement of Variables in Outputted String

    public class PasswordGen {

    public static void main (String[] args) {

    Generator();

    }

    public static void Generator() {
  25. [SOLVED] Re: Random 4 Char Generator Generates 3 Numbers Instead?

    I just realised the answer myself - the only part looping was the print method, not the random number generator. Everything's solved, thanks guys.
Results 1 to 25 of 29
Page 1 of 2 1 2