Fractional Calculator in Java

Posted by user2888881 on Stack Overflow See other posts from Stack Overflow or by user2888881
Published on 2013-10-24T03:31:51Z Indexed on 2013/10/24 3:54 UTC
Read the original article Hit count: 149

Filed under:
|

I am trying to create a fractional calculator in Java with inputs of mixed fractions, proper fractions, improper fractions or integers. It should include the four basic operators as well. The program should be set up as a loop where it is continuous until the user types "quit".

I have coded the beginning loop but have no idea where to go from there.

Please help, I am a beginner and would really appreciate it.

Thank you again.

This is what I have so far:

import java.util.*;

public class FractionCalculator {
    private static Scanner input;

    public static void main(String[] args) {
    input = new Scanner(System.in);
    String x = "quit";
    System.out.println("Enter a fraction");
    while (true) {
    String y = input.next();
    if (y.equals(x)) {
    break;
    }
    }
}
}

© Stack Overflow or respective owner

Related posts about java

Related posts about calculator