{
PrintHeaderLine();
System.out.format("%-15s %-55s %15s %n", "SL NO", "PRODUCT", "COST");
PrintHeaderLine();
for(int x=0;x<k;x++)
{
totalcash=totalcash+amount[x];
System.out.format("%-15s %-55s %15s %n", (x+1), itemsbought[x], "$"+ amount[x]);
}
if(totalcash>=500&&totalcash<1000)
{
totalcash=totalcash*(95/100);
}
else if(totalcash>=1000&&totalcash<3000)
{
totalcash=totalcash*(90/100);
}
else if(totalcash>=3000)
{
totalcash=totalcash*(85/100);
}
else
totalcash=totalcash+0;
PrintHeaderLine();
System.out.format("%-15s %71s %n", "GRAND TOTAL ", "$" + totalcash);
(我继续将输出设为 0)在此问题之前,我的代码没有任何问题。有人能告诉我我哪里错了吗