{"id":1056,"date":"2025-11-12T21:21:28","date_gmt":"2025-11-12T21:21:28","guid":{"rendered":"https:\/\/javigomez.org\/?p=1056"},"modified":"2025-12-05T16:51:21","modified_gmt":"2025-12-05T16:51:21","slug":"funcion-para-pedir-notas","status":"publish","type":"post","link":"https:\/\/javigomez.org\/index.php\/2025\/11\/12\/funcion-para-pedir-notas\/","title":{"rendered":"Funci\u00f3n para pedir notas"},"content":{"rendered":"\n<p>Crea la funci\u00f3n nota(texto).<\/p>\n\n\n\n<p>Esta funci\u00f3n debe solicitar una nota por pantalla. Debe validar que la nota est\u00e9 entre 0 y 10. Si no lo est\u00e1, sacar un mensaje y volver a solicitarla. El texto para solicitar la nota es el que se pasa por par\u00e1metro. La funci\u00f3n debe devolver el valor de la nota.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import java.util.Scanner;\n\npublic class T0501 {\n    public static void main(String&#91;] args) {\n        \/*\n        Crea la funci\u00f3n nota(texto).\nEsta funci\u00f3n debe solicitar una nota por pantalla.\nDebe validar que la nota est\u00e9 entre 0 y 10. Si no lo est\u00e1,\nsacar un mensaje y volver a solicitarla.\nEl texto para solicitar la nota es el que se pasa por par\u00e1metro.\nLa funci\u00f3n debe devolver el valor de la nota.\n         *\/\n\n        int nota1=nota(\"1er Trimestre: \");\n        System.out.println(\"->\" + nota1);\n        int nota2=nota(\"2\u00ba Trimestre: \");\n        System.out.println(\"->\" + nota2);\n        int nota3=nota(\"3er Trimestre: \");\n        System.out.println(\"->\" + nota3);\n\n    }\n\n    private static int nota(String texto) {\n        int n=0;\n        Scanner sc = new Scanner(System.in);\n        do{\n            System.out.print(texto);\n            n=sc.nextInt();\n            if (n&lt;0||n>10)\n                System.out.println(\"Error, la nota tiene que estar entre 0 y 10\");\n        }while (n&lt;0||n>10);\n        return n;\n    }\n\n}\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"T0501 Funci\u00f3n para pedir notas\" width=\"1200\" height=\"900\" src=\"https:\/\/www.youtube.com\/embed\/lnKTUkqVeXc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Crea la funci\u00f3n nota(texto). Esta funci\u00f3n debe solicitar una nota por pantalla. Debe validar que la nota est\u00e9 entre 0 y 10. Si no lo &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[203],"class_list":["post-1056","post","type-post","status-publish","format-standard","hentry","category-java","tag-java"],"_links":{"self":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/1056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/comments?post=1056"}],"version-history":[{"count":1,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/1056\/revisions"}],"predecessor-version":[{"id":1057,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/1056\/revisions\/1057"}],"wp:attachment":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media?parent=1056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/categories?post=1056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/tags?post=1056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}