打印我已經由具有下面的代碼段的開關情況下的餐廳程序:校正對準而在Java
for(int r=0;r<=17;r++)
{
while(qty[r]>0)
{
System.out.println(qty[r]+" X "+O[r]+" "+l[r]);
break;
}
}
//qty has the quantity(int) ; O has the Item name (String) and l has the cost (int)
由於在字符串的長度的不同,輸出不uniform-它不是沒有正確對齊。
輸出:
*********************************************************
*********************************************************
**************************BILL***************************
Thu Feb 09 22:01:36 IST 2017
Your phone number - 9821809843
Bill number is 4180536
You have ordered :
Item Name with quantity Price
1 X Fried Raviolli 400
1 X Potato Fries with Jalapeno and Cheese Dip 800
The total bill amount is Rs.1200
Hope you enjoyed. Visit us again soon!
任何想法,我怎麼能糾正呢?
@ nhouser9是的,這有點解決我的問題。但由於我是新手,我不確定我將如何編輯我的摘錄。請幫我一個忙,告訴我該怎麼做。提前致謝! – LinuxGeek
好的,我在下面發佈了一個答案。如果有幫助,請記住注意並接受。 – nhouser9