Hi, I will be giving a class on java programming, <\/p>\n
Today in our first lesson we are going to review\/learn some printing statements, for loops and if statements. To create a new project in IntelliJ, we click on, create new project ( the first time the project needs to be aligned with java sdk). In order for the java program to run, there should be a main static method. <\/p>\n We will be using the scanner class today, that must be imported with:<\/p>\n import java.util.Scanner;<\/p>\n Below there is an example for the lesson of today: <\/p>\n Printing to the screen: <\/code><\/p>\n >><\/p>\n hello Yanilda Comments can be done by using: ***** For beauty Today Practice programs: Indentation is needed for readability. For Homework submission email to: Homework # 1 - Hi, I will be giving a class on java programming, Today in our first lesson we are going to review\/learn some printing statements, for loops and if statements. First of all lets start by the software that we will be using for our class. for IDEA: IntelliJ Download IntelliJ Then we will have to download […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,7],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts\/197"}],"collection":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/comments?post=197"}],"version-history":[{"count":26,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts\/197\/revisions"}],"predecessor-version":[{"id":233,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/posts\/197\/revisions\/233"}],"wp:attachment":[{"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/media?parent=197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/categories?post=197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smartvania.com\/wp-json\/wp\/v2\/tags?post=197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\nFirst of all lets start by the software that we will be using for our class.
\nfor IDEA:
\nIntelliJ
\n Download IntelliJ<\/a>
\nThen we will have to download the java SDK:
\nDownload Java SDK<\/a><\/p>\n
\nThen we create a package, and afterwards a java class usually with the same name of the package. It will be assigned a default constructor.<\/p>\n
\n\u00a0<\/p>\n
<\/p>\n
\r\nimport java.util.Scanner;\r\npublic class Hello {\r\n\t\r\n\tpublic static void main(String[] args){\r\n\t\tSystem.out.println(\"hello Yanilda\");\r\n\t\tSystem.out.print(\"Hey Yani\");\r\n\t\tSystem.out.printf(\"Hi Yani\");\r\n\t\tSystem.out.print(\"Hey Yani\");\r\n\t\t\r\n\t\tfor(int i=0; i<10;i++){\r\n\t\t\tSystem.out.println(\"hello Yanilda\");\r\n\t\t}\r\n\t\t\r\n\t\tint aNumber, bNumber;\r\n\t\tSystem.out.println(\"enter input\");\r\n\t\tScanner scaner1 = new Scanner(System.in);\r\n\t\tAnumber=scaner1.nextInt();\r\n\t\tSystem.out.println(\"enter input\");\r\n\t\tBnumber=scaner1.nextInt();\r\n\t\tscaner1.close();\r\n\t\tint abSum=aNumber+bNumber;\r\n\t\tSystem.out.println(\"Sum is \"+abSum);\t\r\n\t\t\r\n\t\tif(abSum<10){\r\n\t\t\tSystem.out.println(\"Less than 10\");\r\n\t\t}\r\n\t\telse if(abSum>10){\r\n\t\t\tSystem.out.println(\"Greater than 10\");\r\n\t\t} \r\n\t\telse{\r\n\t\t\tfor(int i=0;i<5;i++){\r\n\t\t\tSystem.out.println(\" Equal to 10\");\r\n\t\t\t}\r\n\t\t}\r\n\t\r\n\t}\r\n}<\/pre>\n<\/div>\n
\nHey YaniHi YaniHey Yanihello Yanilda
\nhello Yanilda
\nhello Yanilda
\nhello Yanilda
\nhello Yanilda
\nhello Yanilda
\nhello Yanilda
\nhello Yanilda
\nhello Yanilda
\nhello Yanilda
\nenter input
\n5
\nenter input
\n5
\nSum is 10
\n Equal to 10
\n Equal to 10
\n Equal to 10
\n Equal to 10
\n Equal to 10<\/p>\n<\/div>\n
\n\/\/ for one line<\/p>\n
\nIt's always good to have documentation, name of the the program with extension, name of the author, the date and what the program does. under the import statements.<\/p>\n
\n * Hello.java
\n * Purpose: Uses if Statements and for loops, prints and gather input's user.
\n *
\n * @author Yanilda Peralta
\n * @version 1.0 6\/05\/2015
\n *\/<\/p>\n<\/div>\n
\n1- Create a program that asks user for name and then prints out the name + how are you?
\n2- Create Sum the numbers from 1 to 10 using for loops
\n3- Create program that takes an integer input from user and if the integer is positive prints \"positive\"x3, if it's negative it prints\"negative\"x4 and if it's zero, print neutral. Use For loops and if statements.<\/p>\n
\nwhite space between the things that don't belong to a group.
\nName convention.
\nMeaningful names will give you a description of the purpose of the the object\/class\/method\/variable.
\nWhen naming variable in java, the camel style is the way to go, start with lowercase then change to Uppercase if it's a combination of words, e.g. myNumber. don't use under bars, but if wanting to use under bars, put all letters in capital, MY_NUMBER.
\nFor Class names use Uppercase, MyClass.
\nFor methods start with lowercase. myMethod. <\/p>\n
\njava_homework@smartvania.com<\/p>\n
\nCreate 3 different programs:
\n1- Ask the user for 3 inputs. Then you will decide which input is larger than the other.Then you print out the largest.
\n2-Reverse string in 2 different ways.
\n3-Do the Palindrome in 2 different ways.<\/p>\n","protected":false},"excerpt":{"rendered":"