コードを実行しようとすると、毎回 Aquarius Facilitator が 0.000 を示します。int と double が変数であり、int がトランクエイドへの回答を引き起こしていることと関係がありますか? 助けてくれてありがとう
これは私のプログラムです
public class JRambolus
{
public JRambolus(){}
public JRambolus(double A)
{
Lengtus = A;
}
public JRambolus(double A, int B)
{
Lengtus = A;
Actus = B;
}
//mutator
void SetLengtus( double A )
{
Lengtus = A;
}
//mutator
void SetActus(int A)
{
Actus = A;
}
//accessor
double GetLengtus()
{
return Lengtus;
}
//accessor
int GetActus()
{
return Actus;
}
//Facilitator
double Arius()
{
return 3*Lengtus+(1/2*Actus);
}
double Aquarius()
{
return 4/3*((1/2*Lengtus)+(2/5*Actus));
}
double Nebulus()
{
return (Math.pow(Lengtus,2)+Math.pow(Actus,3/2))*4/3;
}
//Memeber Varibales
private double Lengtus;
private int Actus;
}
これは私の呼び出しプログラムです
public class JShower
{
public static void main(String[] args)
{
JRambolus FullRambolus = new JRambolus();
//Calling out the the system
System.out.printf("%43s %4s %8.3f%n" ,"The Arius of FullRambolus is" ,"=", FullRambolus. Arius() );
System.out.printf("%46s %s %8.3f%n" ,"The Aquarius of FullRambolus is","=", FullRambolus.Aquarius() );
System.out.printf("%45s %2s %8.3f%n%n%n","The Lengtus of FullRambolus is" ,"=", FullRambolus.Nebulus () );
JRambolus DefaultRambolus = new JRambolus();
//Calling the Mutator From JRambolus
DefaultRambolus.SetLengtus(6);
DefaultRambolus.SetActus(3);
//Calling out to the system
System.out.printf("%46s %4s %8.3f%n","The Arius of DefaultRambolus is" ,"=", DefaultRambolus. Arius() );
System.out.printf("%49s %s %8.3f%n" ,"The Aquarius of DefaultRambolus is","=", DefaultRambolus.Aquarius() );
System.out.printf("%48s %2s %8.3f%n","The Nebulus of DefaultRambolus is" ,"=", DefaultRambolus.Nebulus () );
}
}