问题告诉我...编写一个构造 2 个分数 5/7 和 3/8 的主要方法,然后创建 2 个其他分数,其值是原始分数的总和和乘积
public class Fraction
{
int num;
int den;
public int sum;
public int getAddition()
{
sum = (this.num + other.num);
return sum;
}
}
public class tester
{
public static void main (String args[])
{
Fraction f1 = new Fraction ();
f1.num = 5;
f1.den = 7;
Fraction f2 = new Fraction ();
f2.num = 3;
f2.den = 8;
//Fraction f3 = getAddition();
Fraction f4 = new Fraction ();
}
}