Quiz)倹約値の取得
🔓 割引を求める
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("x의 값을 입력하세요 : ");
double x = scanner.nextDouble();
scanner.close();
Absolute absolute = new Absolute(x);
absolute.mtd_Abs();
}
}
public class Absolute {
private double x;
public Absolute(double x) {
this.x = x;
};
public void mtd_Abs() {
//2곱하기 x의 3제곱 표기 : 2*x^3
double res = 2 * Math.pow(this.x, 3) + 3 * Math.pow(this.x, 2) + 4;
res = Math.abs(res);
System.out.printf("res : %.2f", res);
}
}
📌 Math.abs(); : 絶対値を返すReference
この問題について(Quiz)倹約値の取得), 我々は、より多くの情報をここで見つけました https://velog.io/@losuif/Quiz-bjzrnd27テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol