From 792de99fb9194ea3a0477f3815af63d5df12b9aa Mon Sep 17 00:00:00 2001 From: pamd7 Date: Thu, 26 Jul 2018 10:13:10 -0500 Subject: [PATCH 1/2] added method demo --- ch04/HelloMethod.java | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 ch04/HelloMethod.java diff --git a/ch04/HelloMethod.java b/ch04/HelloMethod.java new file mode 100644 index 0000000..e5b2568 --- /dev/null +++ b/ch04/HelloMethod.java @@ -0,0 +1,41 @@ +public class HelloMethod +{ + public static void main(String[] args) + { + String firstName = "Fred"; + String secondName = "Wilma"; + String lastName = "Flintstone"; + + printHelloWorld(firstName, lastName); + printHelloWorld(secondName, lastName); + + int firstNum = 5; + int secondNum = 10; + printOhNo(firstName, firstNum, secondNum, false); + + printNumberNoSign(5); + printNumberNoSign(-5); + } + + public static void printNumberNoSign(int number) + { + int positiveNumber = Math.abs(number); + System.out.println("The number is " + positiveNumber); + } + + public static void printHelloWorld(String fName, String lName) + { + System.out.println("Hello World " + fName + " " + lName); + } + + public static void printOhNo(String cat, int firstNumber, int secondNumber, boolean isAPerson) + { + System.out.println("OH NO!!!!!!!!!!!!!!!!!!!!!!! " + cat); + System.out.println("Is a person? " + isAPerson); + System.out.println("First Number is " + firstNumber); + System.out.println("Second Number is " + secondNumber); + System.out.println("total is " + (firstNumber + secondNumber)); + } + + +} \ No newline at end of file From 5ee3b843abffa11654dae392537d5eab5ce2fdf0 Mon Sep 17 00:00:00 2001 From: pamd7 Date: Thu, 26 Jul 2018 16:14:13 -0500 Subject: [PATCH 2/2] Comparison Exercise --- ch05/.idea/misc.xml | 6 ++++++ ch05/.idea/modules.xml | 8 ++++++++ ch05/.idea/vcs.xml | 6 ++++++ ch05/Comparison.java | 18 ++++++++++++++++++ ch05/ch05.iml | 11 +++++++++++ 5 files changed, 49 insertions(+) create mode 100644 ch05/.idea/misc.xml create mode 100644 ch05/.idea/modules.xml create mode 100644 ch05/.idea/vcs.xml create mode 100644 ch05/Comparison.java create mode 100644 ch05/ch05.iml diff --git a/ch05/.idea/misc.xml b/ch05/.idea/misc.xml new file mode 100644 index 0000000..e208459 --- /dev/null +++ b/ch05/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ch05/.idea/modules.xml b/ch05/.idea/modules.xml new file mode 100644 index 0000000..8aa42e1 --- /dev/null +++ b/ch05/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ch05/.idea/vcs.xml b/ch05/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/ch05/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ch05/Comparison.java b/ch05/Comparison.java new file mode 100644 index 0000000..bcf12d7 --- /dev/null +++ b/ch05/Comparison.java @@ -0,0 +1,18 @@ +public class Comparison +{ + public static void main(String[] args) + { + String txt = "Fantastic"; + String lang = "Java"; + boolean state = (txt ==lang); + System.out.println("String Equality Test:" + state); + state = (txt != lang); + System.out.println("String Inequality Test" + state); + int dozen = 12; + int score = 20; + state = (dozen > score); + System.out.println("Greater Than Test:" + state); + state = (dozen < score); + System.out.println("Less Than Test" + state); + } +} diff --git a/ch05/ch05.iml b/ch05/ch05.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/ch05/ch05.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file