Need help writing a code in Java?

Home » Programming & Design » Need help writing a code in Java?
Programming & Design No Comments

I haven't taken a single programming course in my school yet. However my discrete math professor gave an assignment to

"Write a program that, given a list of 20 integers and an integer n, determines the position of
the first integer in the list that is smaller than n."

I've decided to do it in

I haven't taken a single programming course in my school yet. However my discrete math professor gave an assignment to

"Write a program that, given a list of 20 integers and an integer n, determines the position of
the first integer in the list that is smaller than n."

I've decided to do it in Java, I've downloaded eclipse for the 1st time and I dont have a clue on how to even start it.

Could anyone help/provide useful links that can help me get started?
most students in class have taken programming courses before, my situation is different.

Other answer:

EddieJ:
Seems like an odd assignment out of the blue. I would have chosen Python instead of Java.

You should start with a Hello World program.

public class HelloWorld {
public static void main (String [] args) {
System.out.println ("Hello World");
}
}

If it was Python 2, the same program would be
print "Hello World"

So, start a new Eclipse project and copy the Java code I gave you into it and see if you can get it to run.

Just Another Soul:
My recommendation is to a) write your program in Python. For something like this it will be easier to learn and easier to access. And B) start by taking a look at Codacademy tutorials. It's a free website that can help a bunch!
rikens:
Are you taking discrete math from Computer science department or for the maths department. Usually there's two discrete math courses @ uni. Math one can easily replace computer ones for requirement.
I recommend you to go to youtube channel called newboston. He is the best at tutorial.
John Lincoln:
no

LEAVE A COMMENT