Archived

This topic is now archived and is closed to further replies.

The Saltman

Any Programmers out there want to help me with a program for school?

29 posts in this topic

Just make up some terms in the main method.... and then call your constructor, then call methods. Then print. then profit!!

public static void main(String[] args) {

System.out.println("The super insano calculator");

int aa =3;

int bb = 6;

.

.

int ff=8;

LinearEquation myLinearEquation = new LinearEquation(aa, bb, cc, dd, ee, ff);

int solve = myLinearEquation.isSolvable();

double x = myLinearEquation.getx();

double y = myLinearEquation.gety();

// then print .......

}

Share this post


Link to post
Share on other sites

Then just call your function in your main method with whatever input you feel like. How does he want you to submit this assignment?

he doesnt say .. what I posted was how he wanted the assignment. then wants me to send him the .java file.

Share this post


Link to post
Share on other sites

Are you using Eclipse?

I don't know why they're still teaching Java.

Share this post


Link to post
Share on other sites

Yes eclipse. Java is our first language we learn.

Share this post


Link to post
Share on other sites

Yes eclipse. Java is our first language we learn.

Yea it was our entry language too - I'm just not a big fan of it.

Share this post


Link to post
Share on other sites

Java is fine for learning to program. It covers the fundamentals like object oriented programming, encapsulation, constructors, etc.. without having to fuss with things like garbage collection, pointers. It is like a gateway drug to the other languages.

Share this post


Link to post
Share on other sites

lol I have an AS in programming from 10 years ago and we learned C, C++, VB, and some Java...

needless to say my skills are now utterly useless, and as such, mostly forgotten...

Sorry bro, but just looking at that gives me PTSD

1 person likes this

Share this post


Link to post
Share on other sites

Google is your friend. http://www.abbeyworkshop.com/howto/java/readLine/

I think something like this would work, I've never read from the console in java.

public static void main(String args[]) throws IOException {

BufferedReader consoleIn = new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter a:");

String a = consoleIn.readLine();

System.out.println("Enter b:");

String b = consoleIn.readLine();

System.out.println("Enter c:");

String c = consoleIn.readLine();

System.out.println("Enter d:");

String d = consoleIn.readLine();

LinearEquation equation = new LinearEquation(a,b,c,d);

if(equation.isSolvable()) {

System.out.println("x = " + equation.getX());

System.out.println("y = " + equation.getY());

} else {

System.out.println("Not solveable");

}

}

Share this post


Link to post
Share on other sites

Ya i googled it before i posted on here.

Thanks tho i just added a scanner to it anyway.

Oh well.

Share this post


Link to post
Share on other sites