嘿,我有一個if和else語句,我想循環如果其他發生,因爲這意味着用戶沒有輸入所需的數量,因此程序重新啓動這裏是代碼任何想法?在Java中循環if語句
System.out.println("The area of the glass is " + area);
if (thick == 3)
{
System.out.println("The price to replace the glass will be £" + price1);
System.out.println("With VAT the price is £" + Final1 );
}
else if (thick == 5)
{
System.out.println("The price to replace the glass will be £" + price2);
System.out.println("With VAT the price is £" + Final2);
}
else if (thick == 7)
{
System.out.println("The price to replace the glass will be £" + price3);
System.out.println("With VAT the price is £" + Final3);
}
else
{
System.out.println("Sorry for the inconvenience but we do not do this size thinkness."); //If the we don't have the thickness this is displayed
}
在此先感謝
你的意思是你是檢查用戶輸入的,如果他們進入它錯誤地,你想重新開始? – Luminusss 2014-11-24 22:31:27
耶基本上如果用戶不輸入3 5或7然後我想程序重新啓動相當新的Java所以任何示例將是一個很大的幫助 – 2014-11-24 22:34:52
剛剛添加了另一個答案,你應該有一些建議現在。 – Luminusss 2014-11-24 22:42:56