Search:

Type: Posts; User: samfin

Page 1 of 2 1 2

Search: Search took 1.03 seconds.

  1. Thread: HELP PLEASE

    by samfin
    Replies
    6
    Views
    200

    [SOLVED] Re: HELP PLEASE

    Mine isn't doing that, this is what I've got and its working as you say it should. Can you see what's different from yours`


    import java.io.*;
    public class gender{
    public static void...
  2. Thread: HELP PLEASE

    by samfin
    Replies
    6
    Views
    200

    [SOLVED] Re: HELP PLEASE

    Your problem is your if statements. At the moment you've got gender==f
    And from this statement

    int m=0, f=0;

    f and m are integers.

    f is an int so when you type 'f' it won't match. You need...
  3. Thread: HELP PLEASE

    by samfin
    Replies
    6
    Views
    200

    [SOLVED] Re: HELP PLEASE

    Hi,

    I've ran this and it does say Enter gender but it won't work beyond that. I'm guessing you want to enter m and it prints MALE and f to print FFEMALE. If you do then you've got gender==f and...
  4. Replies
    5
    Views
    418

    Re: Operate on list`s objects

    I'm not following you, can you post some code with the lists, variables whatever, that shows what you're asking please
  5. Replies
    5
    Views
    418

    Re: Operate on list`s objects

    What is the problem you're having? I've put this into a class and it compiles and prints ok.
  6. Replies
    4
    Views
    1,144

    Re: Finding the smallest element and shifting....

    That looks about right, you're just missing a closing bracket for the for loop in the min method, this needs to go before the return statement. That should get rid of those errors.
  7. Replies
    4
    Views
    1,144

    Re: Finding the smallest element and shifting....

    Your min method is more or less right. This line you've but index twice and then i for the last

    for (index = 1; index < numbers.length; i++)

    Change these all to i.
    You've also not returned min...
  8. Thread: Hello

    by samfin
    Replies
    1
    Views
    255

    Re: Hello

    Hi and welcome to the forum
  9. Replies
    3
    Views
    624

    Re: help me to solve my problem

    If it can't find Cards it means that you don't have a Cards class in the same folder or the same package when you're trying to compile. Have you written the Cards class? If so, can you post it along...
  10. Replies
    9
    Views
    1,535

    Re: writing java code help

    The loss of precision is because the return type on get_monthlysalary() is int but _monthlysalary is a double value.

    The other exception where it can't find the class is another typo. One package...
  11. Replies
    9
    Views
    1,535

    Re: writing java code help

    When you say you're getting errors, can you post the errors you're getting please.
  12. Replies
    9
    Views
    1,535

    Re: writing java code help

    Just a quick one, can you put your code in the [ highlight=Java] [ /highlight] tags, makes it easier to read.
    Also and this is totally up to you, class names are usually written with capital...
  13. Replies
    9
    Views
    1,535

    Re: writing java code help

    You're pretty much there, just a few typos stopping it working and you haven't done a method to work out the annual salary.
    _dependents() I'm guessing should be get_dependants as that's what you've...
  14. Replies
    9
    Views
    1,535

    Re: writing java code help

    We can't do your homework for you, try to write the code, there are tutorials on this forum and info from Google and if you get stuck, post the code and the problem
  15. Replies
    3
    Views
    420

    Re: How could I do this?

    Are you having a specific problem? Can you post the code that you have tried to write and any specific problems you're having and we'll try to help.
  16. Replies
    3
    Views
    509

    Re: Extracting letters as variables

    I would have a look at the API docs for String here. I've done this with substring and replaceFirst as a quick job but you might be able to find a better way.
  17. Replies
    4
    Views
    613

    Re: Looking for guidance and instructions

    Is there a problem with your code or do you no know how to run it. If you don't know how to run it, have a quick search on Google, there'll be sites there with tutorials on running from command line...
  18. Replies
    1
    Views
    505

    Re: how to return value ..

    Your netsalary() method is using the instance variables salary and tax which are initialised to 0 so when you do salary*tax it is 0*0=0
    The main method is using its own copy of the salary and tax...
  19. Thread: Runtime Error

    by samfin
    Replies
    5
    Views
    471

    Re: Runtime Error

    Best guess would be that this is a problem with your Java version. Google should be able to tell you which versions are compatible with Win 7 and which might cause problems
  20. Re: how to implement method to add new Student and display it

    The add method was ok as it was except maybe you'd want to put it like this

    public void addStudent()
    {
    students[length] = new Student();
    length++;
    }


    It was your...
  21. Re: how to implement method to add new Student and display it

    With this line:
    System.out.println("Student Name:" + student.getFirstName() +" "+ student.getLastName() + " Enrollment on:" + student.getEnrollmentDate());
    Your calling the Student methods on...
  22. Thread: Chess Problem

    by samfin
    Replies
    4
    Views
    1,403

    Re: Chess Problem

    Also, can you put [ highlight=Java] and [ /highlight] tags round your code, makes it easier to read, cheers
  23. Thread: Chess Problem

    by samfin
    Replies
    4
    Views
    1,403

    Re: Chess Problem

    Basically, to get to a diagonal from a square, you have to move up by a certain number, then across by the same number

    You need to think about the relation between the row and column value of the...
  24. Thread: Runtime Error

    by samfin
    Replies
    5
    Views
    471

    Re: Runtime Error

    That is odd, I've tried it in Eclipse and Netbeans and compiling from command line and each one gives the right output without the extra button at the top so the code is right, there must be...
  25. Re: how to implement method to add new Student and display it

    What is the problem you're having with the code, the methods and constructor you mention are in there. Are they not working as expected?
Results 1 to 25 of 37
Page 1 of 2 1 2