# Help me please !!!!!!!!!!!!!!!!

• December 11th, 2011, 09:07 AM
sooonah
Help me please !!!!!!!!!!!!!!!!
please help me in this question as soon as possible

Design and implement a calculator for Fractions. The user should enter one or two fractions depending on the operation. The possible operations are reduce, add, subtract, multiply, or divide.
The class Fraction should have at least the following methods in addition to instance variables and a constructor:

public Fraction addFraction(Fraction other);
//subtract two fractions
public Fraction subtractFraction(Fraction other);
//multiply two fractions
public Fraction multiplyFraction(Fraction other);
//divide two fractions
public Fraction divideFraction(Fraction other);
//reduce a fraction
public void reduceFraction();

Display a menu with the following options:

1. Reduce a fraction
3. Subtract
4. Multiply
5. Divide
6. Quit

i cannot solve it
i tried many time
• December 11th, 2011, 10:53 AM
copeg
Re: Help me please !!!!!!!!!!!!!!!!
a) One exclamation point is too many b) No one is going to do this for you. Make an effort and you might receive effort in return. c) I recommend reading the link in my signature entitled getting help, and the following link:
http://www.javaprogrammingforums.com...e-posting.html
If you get stuck, ask a specific question. Dumping a homework assignment will consistently get you a response similar to this one.
• December 11th, 2011, 10:57 AM
sooonah
Re: Help me please !!!!!!!!!!!!!!!!
it is not homework
i did part of it
i need anyone to help me
Quote:

import java.io.*;
import java.util.*;
public class Calculator
{
public static void main(String[] args) throws IOException

{
String input, input1, input2;
double num1, num2, answer;
System.out.println ("\t\t\tWelcome to the calculator!");
do
{
System.out.print ("\nWould you like to Multiply(m), Divide(d), Subtract(s), Add(a)?: ");
if (input.equals("m"))
{
System.out.print ("Please enter the first number!: ");
num1 = Double.parseDouble (input1 = keyboard.readLine());
System.out.print ("Please enter the second number!: ");
num2 = Double.parseDouble (input1 = keyboard.readLine());
System.out.print ("You chose to multiply."+"\t"+"The Product is: "+answer);
}
if (input.equals("d"))
{
System.out.print ("Please enter the first number!: ");
num1 = Double.parseDouble (input1 = keyboard.readLine());
System.out.print ("Please enter the second number!: ");
num2 = Double.parseDouble (input2 = keyboard.readLine());
System.out.print ("You chose to divide."+"\t"+"The Dividend is: "+answer);
}
if (input.equals("a"))
{
System.out.print ("Please enter the first number!: ");
num1 = Double.parseDouble (input1 = keyboard.readLine());
System.out.print ("Please enter the second number!: ");
num2 = Double.parseDouble (input2 = keyboard.readLine());
System.out.print ("You chose to add."+"\t"+"The Sum is: "+answer);
}
if (input.equals("s"))
{
System.out.print ("Please enter the first number!: ");
num1 = Double.parseDouble (input1 = keyboard.readLine());
System.out.print ("Please enter the second number!: ");
num2 = Double.parseDouble (input2 = keyboard.readLine());
System.out.print ("You chose to subtract."+"\t"+"The Diffrence is: "+answer);
}
System.out.print ("\nWould you like another calculation (y/n)?: ");
}
while(input.equals("y"));
if(input.equals("n"));
System.exit(0);
}
}
• December 11th, 2011, 11:22 AM
copeg
Re: Help me please !!!!!!!!!!!!!!!!
Did you read the links I gave you above? You have not provided any information as to where you are stuck. And, as described in those links, please wrap your code in the code tags - it preserves indenting and makes code readable
• December 11th, 2011, 11:23 AM
Norm
Re: Help me please !!!!!!!!!!!!!!!!
Do you have any specific questions about the program?
Or errors you do not understand?
• December 11th, 2011, 11:49 AM
sooonah
Re: Help me please !!!!!!!!!!!!!!!!
How can i use these

public Fraction addFraction(Fraction other);
//subtract two fractions
public Fraction subtractFraction(Fraction other);
//multiply two fractions
public Fraction multiplyFraction(Fraction other);
//divide two fractions
public Fraction divideFraction(Fraction other);
//reduce a fraction
public void reduceFraction();
• December 11th, 2011, 11:54 AM
Norm
Re: Help me please !!!!!!!!!!!!!!!!
Quote:

How can i use these
Not sure what you mean by "use these"

Are you asking how to call a method? That's pretty basic programming. What problem are you having? Do you need to read your textbook or the tutorial? Go to this site and read up on methods:
Classes (The Java™ Tutorials > Learning the Java Language > Classes and Objects)

All the methods you've listed take a Fraction object as a parameter and return a Fraction object.