2 回答

TA貢獻(xiàn)1765條經(jīng)驗(yàn) 獲得超5個(gè)贊
//不要忘記導(dǎo)入JOptionPane庫
//我也不知道你是如何使用你的信用變量 public class prograde { public void showJoption(String position) { JOptionPane.showMessageDialog(null, position); }
public static void main(String[] args)
{
//this is the class object that you can use to call the showJoption() method.
prograde display = new prograde();
if(credit >= 120)
{
display.showJoption("You've graduated!");
}
else if (credit >= 90)
{
display.showJoption("You're a senior.");
}
else if (credit >= 60)
{
display.showJoption("You're a junior.");
}
else if (credit >= 30)
{
display.showJoption("You're a sophomore.");
}
else if (credit >= 0)
{
display.showJoption("You're a freshment.");
}
else {
display.showJoption("invalid input");
}
}
}

TA貢獻(xiàn)1847條經(jīng)驗(yàn) 獲得超7個(gè)贊
使用 if-else 語句生成要顯示的字符串,然后使用單行調(diào)用showMessageDialog()
使用該字符串。
添加回答
舉報(bào)