Case: there are 1000 people (male and female) will be made statistical data of gender, birth month, birth day and I was born in the most in the month, day and gender what? To get sex, month and day of birth at random, Random class is used (for the case of real month and day of birth obtained from the database).
sourceprint view?
01.import java.util.Random;
02.class dimensi3
03. (Public static void main (String [] args)
04th Random (x = new Random ();
05.int [][][] data = new int [2] [7] [12];
06.String [] = (jenKel "Male", "Female");
07.String [] (hr = "Mon", "Tue", "Wed", "Thu", "Fri", "sab", "Sun");
08.String [] = (bl "\ tJan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
09th "Sep", "Okt", "Nov", "Dec");
10.int Jml [] = new int [2];
Jk 11.int, day, bln;
12.for (int i = 0; i <1000; i + +) 13. = (Jk x.nextInt (2); 14.hari = x.nextInt (7); 15.bln = x.nextInt (12); 16.data [jk] [day] [bln] + = 1; 17.jml [jk] + = 1; 18.) 19.for (int jenkel = 0; jenkel <2; jenkel + +) 20th (for (int i = 0; i <12; i + +) 21.System.out.print (bl [i] + "\ t"); 22.System.out.println (); 23.for (int row = 0; row <7; row + +) 24th (System.out.print (hr [line] + "\ t"); 25.for (int column = 0; column <12; column + +) 26th (System.out.print (data [jenkel] [row] [column] + "\ t"); 27.) 28.System.out.println (); 29.) 30.System.out.println ( "Number" + jenKel [jenkel] + "" + Jml [jenkel] + "\ n"); 31.) 32.int max = data [0] [0] [0], IMAX = 0, jmax = 0, kmax = 0; 33.for (int jenkel = 0; jenkel <2; jenkel + +) 34th (for (int row = 0; row <7; row + +) 35th (for (int column = 0; column <12; column + +) 36th (if (data [jenkel] [row] [column]> max)
37th (max = data [jenkel] [row] [column];
38.imax = jenkel; jmax = line; kmax = column;
39.)
40.)
41.)
42.)
43.System.out.println ( "Most are" + jenKel [IMAX] + "born in" +
44.bl [kmax] + "days" + hr [jmax] + "" + max + "people");
45.)
46.)
this more cleanly (admin)
little help for a half-confused
data [0] [0] [0] the number of its men, who was born January senin months
data [1] [3] [2] the number of its women, who was born Thursday maret months
data [0] [6] [11] man days per month of birth desember
still ^^@&%$%$^@#? patient only .... So also
sourceprint view?
01.import java.util.Random;
02.class dimensi3
03. (Public static void main (String [] args)
04th Random (x = new Random ();
05. int [][][] data = new int [2] [7] [12];
06. String [] jenKel = ( "Male", "Female");
07. String [] (hr = "Mon", "Tue", "Wed", "Thu", "Fri", "sab", "Sun");
08. String [] bl = ( "\ tJan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
09. "Sep", "Okt", "Nov", "Dec");
10. Jml int [] = new int [2];
11. int jk, day, bln;
12. for (int i = 0; i <1000; i + +) 13. Jk = (x.nextInt (2); / / sex 14. day = x.nextInt (7); 15. bln = x.nextInt (12); 16. data [jk] [day] [bln] + = 1; 17. Jml [jk] + = 1; / / the number of sex per 18. ) 19th / / until here [][][] array data already filled data 20th / / the following is to appear on the screen into 2-dimensional table 2 21. / / The first table to do the statistics of men and women to do both 22. / / The results so I have 2 tables each column 7 line 12 23. for (int jenkel = 0; jenkel <2; jenkel + +) 24. (For (int i = 0; i <12; i + +) 25. System.out.print (bl [i] + "\ t"); 26. System.out.println (); 27. for (int row = 0; row <7; row + +) 28. (System.out.print (hr [line] + "\ t"); 29. for (int column = 0; column <12; column + +) 30. System.out.print (data [jenkel] [row] [column] + "\ t"); 31. System.out.println (); 32. ) 33. System.out.println ( "Number" + jenKel [jenkel] + "" + Jml [jenkel] + "\ n"); 34. ) 35. int max = data [0] [0] [0], IMAX = 0, jmax = 0, kmax = 0; 36. for (int jenkel = 0; jenkel <2; jenkel + +) 37. for (int row = 0; row <7; row + +) 38. for (int column = 0; column <12; column + +) 39. if (data [jenkel] [row] [column]> max)
40. (Max = data [jenkel] [row] [column];
41. IMAX = jenkel; jmax = line; kmax = column;
42. )
43. System.out.println ( "your answer is" + jenKel [IMAX] + "born in" +
44. bl [kmax] + "days" + hr [jmax] + "" + max + "people");
45.
46.)
47.)
Then for the calculation of line and perkolomnnya:
sourceprint view?
01.import java.util.Random;
02.class dimensi3
03. (Public static void main (String [] args)
04th Random (x = new Random ();
05.int [][][] data = new int [2] [8] [13];
06.String [] = (jenKel "Male", "Female");
07.String [] (hr = "Mon", "Tue", "Wed", "Thu", "Fri", "sab", "Min", "number");
08.String [] = (bl "\ tJan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
09th "Sep", "Okt", "Nov", "Dec", "Jml");
10.int Jml [] = new int [2];
Jk 11.int, day, bln;
12.for (int i = 0; i <1000; i + +) 13. = (Jk x.nextInt (2); 14.hari = x.nextInt (7); 15.bln = x.nextInt (12); 16.data [jk] [day] [bln] + = 1; 17.data [jk] [days] [12] + = 1; 18.data [jk] [7] [bln] + = 1; 19.data [jk] [7] [12] + = 1; 20.jml [jk] + = 1; 21.) 22.for (int jenkel = 0; jenkel <2; jenkel + +) 23. (For (int i = 0; i <13; i + +) 24.System.out.print (bl [i] + "\ t"); 25.System.out.println (); 26.for (int row = 0; row <8; row + +) 27th (System.out.print (hr [line] + "\ t"); 28.for (int column = 0; column <13; column + +) 29th (System.out.print (data [jenkel] [row] [column] + "\ t"); 30.) 31.System.out.println (); 32.) 33.System.out.println ( "Number" + jenKel [jenkel] + "" + Jml [jenkel] + "\ n"); 34.) 35.int max = data [0] [0] [0], IMAX = 0, jmax = 0, kmax = 0; 36.for (int jenkel = 0; jenkel <2; jenkel + +) 37th (for (int row = 0; row <7; row + +) 38th (for (int column = 0; column <12; column + +) 39th (if (data [jenkel] [row] [column]> max)
40th (max = data [jenkel] [row] [column];
41.imax = jenkel; jmax = line; kmax = column;
42.)
43.)
44.)
45.)
46.System.out.println ( "Most are" + jenKel [IMAX] + "born in" +
47.bl [kmax] + "days" + hr [jmax] + "" + max + "people");
48.)
49.)
the headache? please ask here.
Cara Cuan Trading AI Memecoins: Panduan Lengkap untuk Pemula
-
(adsbygoogle = window.adsbygoogle || []).push({}); Trading AI memecoins
bisa sangat menguntungkan. Pelajari caranya di sini!Dunia cryptocurrency
selalu me...
1 week ago
0 komentar:
Post a Comment