وهذي الفقرة في السؤال الاول مافهمت معناها بالتحديد اللي بالاحمر
6. Instead of always reading in 5 sales amounts, at the beginning ask the user for the number of sales people and then create an array that is just the right size. The program can then proceed as before.
|
يعني بدل ما تخلي البرنامج دائماً يدخل 5 أرقام من المستخدم في مصفوفة ،،
خلي المستخدم يدخل عدد الارقام إلي يحتاج يدخلها ( يعني من الأخير حجم المصفوفة
)،
يعني بدل ما يكون كذا:
كود PHP:
int[] salesAmounts = new int [ 5 ] ;
يسير كذا:
كود PHP:
Scanner input = new Scanner(System.in);
System.out.println("Enter the number of sales amounts you want to enter: ");
int size = input.nextInt();
int[] salesAmounts = new int [ size ];
بالتوفيق