我目前正在进行的项目要求程序将两个分数相加,并简化答案。我已经把分数加在一起了,但我不知道如何简化分数。
PS 到目前为止,我在顶部看到的所有内容都非常令人困惑,如果你能让答案变得简单,谢谢!
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Fractions {
public static void main(String[] args) {
Scanner Scan = new Scanner(System.in);
System.out.println("Numerator A");
int NuA = Scan.nextInt();
System.out.println("Denominator A");
int DeA = Scan.nextInt();
System.out.println("Numerator B");
int NuB = Scan.nextInt();
System.out.println("Denominator B");
int DeB = Scan.nextInt();
double NumA = NuA * DeB;
double NumB = NuB * DeA;
double Denominator= DeA * DeB;
double Numerator=NumA + NumB;
}
}