java - Fraction Creation Errors -
java - Fraction Creation Errors -
i made same set code day ago , working perfectly. gets ton of errors dont understand. can help? thanks.
import java.util.scanner; import java.io.printstream; import java.lang.math; import type.lib.*; public class fraction { public static void main(string[] args) { scanner scan = new scanner(system.in); printstream print = new printstream(system.out); print.println("for each fraction come in numerator/denominator,"); print.println("pressing come in after each"); print.println("enter x"); fraction = new fraction(scan.nextlong(),scan.nextlong()); print.println("enter y"); fraction b = new fraction(scan.nextlong(),scan.nextlong()); a.add(b); fraction = x; print.println("enter z"); fraction c = new fraction(scan.nextlong(),scan.nextlong()); print.println("enter t"); fraction d = new fraction(scan.nextlong(),scan.nextlong()); c.add(d); fraction c = y; x.divide(y); print.println("a = "); print.println(x.tostring()); } }
make next changes, , create methods u r using add together , divide
public class fraction { public fraction(long nextlong, long nextlong2) { // add together constructor // todo auto-generated constructor stub } public static void main(string[] args) { scanner scan = new scanner(system.in); printstream print = new printstream(system.out); print.println("for each fraction come in numerator/denominator,"); print.println("pressing come in after each"); print.println("enter x"); fraction = new fraction(scan.nextlong(),scan.nextlong()); print.println("enter y"); fraction b = new fraction(scan.nextlong(),scan.nextlong()); a.add(b); fraction x = a; // alter fraction places print.println("enter z"); fraction c = new fraction(scan.nextlong(),scan.nextlong()); print.println("enter t"); fraction d = new fraction(scan.nextlong(),scan.nextlong()); c.add(d); //create add together method fraction y =c; // alter fraction places x.divide(y); // create split method print.println("a = "); print.println(x.tostring()); } //create required methods.. private void divide(fraction y) { // todo auto-generated method stub } private void add() { // todo auto-generated method stub } }
java
Comments
Post a Comment