{"action":"opened","issue":{"url":"https://api.github.com/repos/pabloleonalcaide/Exercises/issues/1","repository_url":"https://api.github.com/repos/pabloleonalcaide/Exercises","labels_url":"https://api.github.com/repos/pabloleonalcaide/Exercises/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/pabloleonalcaide/Exercises/issues/1/comments","events_url":"https://api.github.com/repos/pabloleonalcaide/Exercises/issues/1/events","html_url":"https://github.com/pabloleonalcaide/Exercises/issues/1","id":187691313,"number":1,"title":"MayorDelVector.java","user":{"login":"pabloleonalcaide","id":20721770,"avatar_url":"https://avatars.githubusercontent.com/u/20721770?v=3","gravatar_id":"","url":"https://api.github.com/users/pabloleonalcaide","html_url":"https://github.com/pabloleonalcaide","followers_url":"https://api.github.com/users/pabloleonalcaide/followers","following_url":"https://api.github.com/users/pabloleonalcaide/following{/other_user}","gists_url":"https://api.github.com/users/pabloleonalcaide/gists{/gist_id}","starred_url":"https://api.github.com/users/pabloleonalcaide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pabloleonalcaide/subscriptions","organizations_url":"https://api.github.com/users/pabloleonalcaide/orgs","repos_url":"https://api.github.com/users/pabloleonalcaide/repos","events_url":"https://api.github.com/users/pabloleonalcaide/events{/privacy}","received_events_url":"https://api.github.com/users/pabloleonalcaide/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-07T11:46:01Z","updated_at":"2016-11-07T11:46:01Z","closed_at":null,"body":"* @author Pablo Leon Alcaide\r\n* @version 1.0\r\n*/\r\nimport java.util.Scanner;\r\n\r\npublic class MayorDelVector{\r\n\t\r\npublic static void main (String[]args){\r\n\t\tScanner sc = new Scanner(System.in);\r\n\t\tint dimension = pedirDimension(), max=0;\r\n\t\tint [] miArray = new int [dimension];\r\n\t\t\r\n                System.out.println(\"introduce valor minimo y maximo\");\r\n\t\tinicializarVectorAleatoriamente(miArray,sc.nextInt(), sc.nextInt());\r\n\t\tmostrarVector(miArray);\r\n\t\t\r\n\t\t\r\n\t\tmostrarMax(hallarMaximo(miArray));\r\n\t}\r\n\r\n\t/**\r\n\t* Establece la dimension que tendra el array\r\n\t*@return devuelve la dimension del array\r\n\t*/\r\n\tprivate static int pedirDimension(){\r\n\t\tScanner sc = new Scanner(System.in);\r\n\t\tint dimension;\r\n\t\tdo{\r\n\t\t\tSystem.out.println(\" Introduce valor positivo\")\r\n\t\t\tdimension = sc.nextInt();\r\n\t\t}while(dimension<0);\r\n\t\treturn dimension;\r\n\t}\r\n\t/**\r\n\t* @param Array de enteros\r\n\t* @param valor maximo\r\n\t*/\r\nprivate static void inicializarVectorAleatoriamente(int[] miArray, int min, int max){\r\n\t\tfor (int i=0;i<miArray.length; i++){\r\n\t\t\tmiArray[i]= (int)(Math.round(Math.random()*(max-min)+min));\r\n\t\t}\r\n\t}\r\n\t/**\r\n\t* calcula el valor maximo del array\r\n\t* @param array de enteros int[]\r\n\t* @param valor maximo\r\n\t* @param posicion i\r\n\t*/\r\n\tprivate static int hallarMaximo(int[] miArray){\r\n\t\tint max =0;\r\n\r\n\t\tfor (int i=0;i<miArray.length; i++){\r\n\t\tif (miArray[i]>max){\r\n\t\t\t\tmax=miArray[i];\r\n\t\t\t} \r\n\t\t}\r\n\t\treturn max;\r\n\t}\r\n\t/**\r\n\t*Muestra los valores del vector y cual ha sido el valor maximo\r\n\t* @param valor maximo\r\n\t* @param array de enteros int []\r\n\t*/\r\n\tprivate static void mostrarVector(int[] vector){\r\n\t\tfor (int i=0;i<vector.length; i++){\r\n\t\t\tSystem.out.println(\"en la posicion \"+i+ \" valor: \"+vector[i]);}\r\n\t}\r\n\tprivate static void mostrarMax (int maximo){\r\n\t\tSystem.out.println(\"el valor maximo es \"+maximo);\r\n\t}\r\n\t}"}}
{"actor":{"display_login":"pabloleonalcaide"}}