Jump to content


Photo
- - - - -

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


  • Please log in to reply
28 replies to this topic

#11 leaf

leaf

    NOT NEWB

  • Joined: 10-October 12
  • posts: 64
  • Reputation: 19
  • LocationHarrisburg
ROOKIE

Posted 30 October 2012 - 03:19 PM

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 .......

}

#12 Hawk

Hawk

    Banned

  • Joined: 24-November 08
  • posts: 15,399
  • Reputation: 1,894
Moderators

Posted 30 October 2012 - 03:24 PM

= lamp

#13 The Saltman

The Saltman

    I am always watching so make sure you keep your clothes on

  • Joined: 24-November 08
  • posts: -52,132
  • Reputation: 992
  • LocationAtlanta,GA
Moderators

Posted 30 October 2012 - 03:30 PM

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.

#14 Sapper

Sapper

    Healthy Scratch

  • Joined: 08-November 09
  • posts: 3,027
  • Reputation: 592
  • LocationCharlotte
SUPPORTER

Posted 30 October 2012 - 04:42 PM

Are you using Eclipse?

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

#15 The Saltman

The Saltman

    I am always watching so make sure you keep your clothes on

  • Joined: 24-November 08
  • posts: -52,132
  • Reputation: 992
  • LocationAtlanta,GA
Moderators

Posted 30 October 2012 - 04:57 PM

Yes eclipse. Java is our first language we learn.

#16 Sapper

Sapper

    Healthy Scratch

  • Joined: 08-November 09
  • posts: 3,027
  • Reputation: 592
  • LocationCharlotte
SUPPORTER

Posted 30 October 2012 - 06:21 PM

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.

#17 leaf

leaf

    NOT NEWB

  • Joined: 10-October 12
  • posts: 64
  • Reputation: 19
  • LocationHarrisburg
ROOKIE

Posted 30 October 2012 - 08:37 PM

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.

#18 Bronn

Bronn

    Sellsword

  • Joined: 26-November 08
  • PipPipPipPipPipPipPipPipPip
  • posts: 5,212
  • Reputation: 1,482
HUDDLER

Posted 30 October 2012 - 08:41 PM

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

#19 natty

natty

    Senior Member

  • Joined: 24-November 08
  • PipPipPipPipPipPipPipPipPip
  • posts: 4,783
  • Reputation: 535
HUDDLER

Posted 30 October 2012 - 09:46 PM


Google is your friend. http://www.abbeywork.../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");
}
}

#20 The Saltman

The Saltman

    I am always watching so make sure you keep your clothes on

  • Joined: 24-November 08
  • posts: -52,132
  • Reputation: 992
  • LocationAtlanta,GA
Moderators

Posted 30 October 2012 - 10:07 PM

Ya i googled it before i posted on here.

Thanks tho i just added a scanner to it anyway.

Oh well.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users