当我输入成本值(例如90.00)时,代码应显示“价格太低”。如果我输入的值超过850.00,它仍会给我相同的输出。也许我的问题出在if语句中。有人可以帮我解决这个问题吗?谢谢。
package cellularpdriver;
public class CellularPDriver {
public static void main(String[] args) {
Phone information = new Phone();
information.setCost(950.00);
information.setNetwork("3G");
information.setModel("Samsung");
if (information.setCost < 850.00) {
System.out.println("Price is too low");
} else {
System.out.println("The Cost of the phone is: $" + information.getCost());
}
System.out.println("The Network of the phone is: " + information.getNetwork());
System.out.println("The Model of the phone is: " + information.getModel());
}
}