2017-02-12 24 views
-1

所以我很困惑這個問題,我現在很困惑。這是一個問題:JOptionPane房源編號

「要求用戶輸入開始號碼和結束號碼,在表格中打印出所有號碼及其平方值。」

import javax.swing.JOptionPane; 

public class P4_1 
{ 
    public static void main(String[] args) 
    { 
     String response_1 = JOptionPane.showInputDialog(null, "Please enter the starting number: "); 
     int start_number = Integer.parseInt(response_1); 
     String response_2 = JOptionPane.showInputDialog(null, "Please enter the ending number: "); 
     int end_number = Integer.parseInt(response_2); 

     int set = start_number; 

     while(start_number > end_number); 
     { 
     set++; 
     } 

     JOptionPane.showMessageDialog(null, set); 

     JOptionPane.showConfirmDialog(null, "Would you like to run the program again? "); 

    } 
} 
+1

所以,我很困惑與你的問題太 – Andremoniy

+0

什麼是你的問題。什麼讓你煩惱?理解這個問題? – user3437460

+0

耶認識這個問題,我需要做什麼以及如何列出數字 – GeneralWolf

回答

1

「要求用戶輸入一個起始號碼和結束號碼。打印輸出的所有號碼,並在表的平方值。」

該問題要求您在每次通過JOptionPane提示整數時提示用戶兩次。如果用戶輸入3和5

所以,打印出3至5平方:

i.e: 9 16 25