Java做while循环正确编码?

时间:2011-08-02 03:47:08

标签: java

我试图从一个怪异的do或if语句循环返回数据,它不会返回我设置的项目为什么?

// yesno to n for first loop through.

do {
    System.out.println("Welcome Sales ID: " + salesID + "  please enter the samsung TV sold: \n");
    samsungProduct = scanValue.next();
    System.out.println("Please enter your total TV sales amounts individually for today \n");
    singleSale = scanValue.nextDouble();
    totalSales = totalSales + singleSale;
    totalItems = totalItems++;
    System.out.println("Do you want to enter another sales total(Y/N): \n ");
    yesNo = scanValue.next();

} while (!yesNo.equalsIgnoreCase("N"));

// get the items set inside of the do while loop.

// The system print out values are empty. 
System.out.printf(salesID + " you entered a total of: " + totalItems + "With a total sales of $%15.2f" + totalSales);

0 个答案:

没有答案