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...
Type: Posts; User: samfin
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...
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...
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...
I'm not following you, can you post some code with the lists, variables whatever, that shows what you're asking please
What is the problem you're having? I've put this into a class and it compiles and prints ok.
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.
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...
Hi and welcome to the forum
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...
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...
When you say you're getting errors, can you post the errors you're getting please.
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...
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...
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
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.
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.
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...
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...
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
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...
With this line:
System.out.println("Student Name:" + student.getFirstName() +" "+ student.getLastName() + " Enrollment on:" + student.getEnrollmentDate());
Your calling the Student methods on...
Also, can you put [ highlight=Java] and [ /highlight] tags round your code, makes it easier to read, cheers
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...
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...
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?