السلام عليكم
كتبت كود عباره عن two dimensional array ولكن عجزت أعرف كيف اقوم بحسآب عدد الارقام السالبة وعدد الارقام الموجبة في method منفصل
import java.util.Scanner;public class G { public static void main(String[] args) { //input { int[][] arrayA = new int[2] [4]; int i,j; Scanner keyboard = new Scanner (System.in); for(i=0;i<2;i++) { for (j=0;j<4; j++) { System.out.printf(" please Enter a number arrayA[%d][%d] : ",i,j); arrayA[j] = keyboard.nextInt(); } } //output for(i=0;i<2;i++) { for (j=0;j<4; j++) System.out.printf("%d ",arrayA[j]); System.out.println(); } ///a)determine the largest(max) and smalles(min) ? public static int maxArray(int[][] myList) { int max = myList[0][0]; for (int i=1; i < myList.length; i++) { for(int j= 1; j < myList.length; j++){ if (myList[j] > max) max = myList[j]; } } return max ; } public static int minArray (int[][] myList){ int min = myList[0][0]; for (int i =1; i < myList.length; i++) { for(int j =1; j < myList.length; j++) if (myList[j] < min) { min = myList[j]; } } return min; } ///count how many positive and negative numbers? public static int oddeven (int myList) { هنا } }هذا الكود ، واللي عليه لون أحمر هو المكان اللي ناقصني، اريد كود يطلع كم رقم تم ادخاله كان سالب وكم رقم تم ادخاله كان موجب
بارك الله لكم.