我试图弄清楚如何,或者是否可以调用一个包含参数的方法。我想在 costForPaint 方法中使用 requiredPaint 方法。(代码已简化):
public class job {
public static void main(String[] args) {
int rooms = 1;
double squareFeet = 0;
double totalSquareFeet = 115;
totalSquareFeet = squareFeet + totalSquareFeet;
}
requiredPaint(totalSquareFeet);
//i want to use the totalSquareFeet in this method, this is why it is called
public static double requiredPaint(double totalSquareFeet) {
double totalPaint = totalSquareFeet / 115;
return totalPaint;
}
public static double costForPaint() {
double paintCost = 2;
//shows error where required paint is
double totalPaintCost = requiredPaint() * paintCost;
return totalPaintCost;
}
RISEBY
杨__羊羊
慕盖茨4494581
相关分类