PDA

View Full Version : سوال: بازنویسی و اصلاح کد



WebConsole
جمعه 26 مهر 1392, 10:25 صبح
درود، دوستان بنده این کد رو نوشتم قصد دارم که فقط از یک system.out.print برای نمایش جواب استفاده کنم اگه میشه راهنمایی کنید اینم کد بنده :

public class IncomeScot
{

public static void main(String[] args)
{
//get amount from program arguments and parse string argument to integer
int incomeAmount=Integer.parseInt(args[0]);
if (incomeAmount <= 1000) {
System.out.print("You have pay off 35% Scot");
} else {
System.out.print("You ought not pay off any Scot");
}
}// end main method
}// end class IncomeScot

esmaeilbf
جمعه 26 مهر 1392, 13:45 عصر
public static void main(String[] args) {

String txt;
int incomeAmount = Integer.parseInt(args[0]);
if (incomeAmount <= 1000) {
txt = "You have pay off 35% scot";
} else {

txt = "You have pay off 35% scot";
}

System.out.print(txt);

}