为什么购买是不兼容的类型scan.next()
?(我试图让用户输入购买和投标,然后使用一种方法来计算变化)。
public static void makeChange() //one method of a class
{
double purchase;
double tendered;
Scanner scan = new Scanner (System.in);
System.out.println ("How much was the Purchase?");
purchase = scan.next(); //why would this be an incompatible type?
System.out.println ("Amount Tendered");
tendered = scan.next();
System.out.println("Processing Transaction");
int ch[] = cd.makeChange(purchase, tendered);
.... continued