Results 1 to 3 of 3
  1. #1
    mitch25 is offline Member
    Join Date
    Jul 2009
    Rep Power

    Default Need help on Fraction

    hi, I'm new to java and I need some idea on how can I do this program.

    For example:
    numerator: 7
    denominator: 49
    fraction type: proper fraction //the class will identify whether the fraction is proper, improper or mixed fractions
    decimal equiv: 0.14286

    Can anyone help me?


  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Rep Power


    Look at the / and % operators, especially when applied to int with an int result.

  3. #3
    javamadd is offline Member
    Join Date
    Jul 2009
    Rep Power

    Talking Well ..jus see this

    i wud say the solution is as simple as that ... but ..i m not sure abt the input .. how wud u input the numbers ?? jus numerator and denominator? then this shud work fine

    import java.util.*;
    public class fractions {

    * @author javamadd
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    int num,deno;
    Scanner scanboy = new Scanner(;
    System.out.println("Enter num");
    num = scanboy.nextInt();
    System.out.println("Enter deno");
    deno = scanboy.nextInt();
    System.out.println("the fraction is " + num +"/" +deno++);
    if ( num > deno)
    System.out.println("Its an Improper fraction");
    System.out.println("Its a Proper Fraction");


Similar Threads

  1. Replies: 3
    Last Post: 11-24-2008, 08:01 PM
  2. (Help) Fraction Summation and Exponents
    By SapphireSpark in forum New To Java
    Replies: 19
    Last Post: 10-09-2008, 05:01 AM
  3. Big Fraction 1.00
    By JavaBean in forum Java Software
    Replies: 1
    Last Post: 03-26-2008, 05:24 AM
  4. Trouble getting Julia fraction correct.
    By yllawwally in forum New To Java
    Replies: 0
    Last Post: 12-21-2007, 03:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts