From 6fe7cb37e4e0a9bc16ddb6511cab8ea584619a31 Mon Sep 17 00:00:00 2001 From: Avinash v Garud <41214994+avigarud@users.noreply.github.com> Date: Thu, 26 Jul 2018 10:11:54 -0500 Subject: [PATCH 1/6] Added me --- ch03/.idea/vcs.xml | 6 ++++++ ch03/AddNumber.java | 21 +++++++++++++++++++++ ch03/Guess_My_Number.java | 22 ++++++++++++++++++++++ ch03/TongueWeight.java | 27 +++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 ch03/.idea/vcs.xml create mode 100644 ch03/AddNumber.java create mode 100644 ch03/Guess_My_Number.java create mode 100644 ch03/TongueWeight.java diff --git a/ch03/.idea/vcs.xml b/ch03/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/ch03/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ch03/AddNumber.java b/ch03/AddNumber.java new file mode 100644 index 0000000..3481d32 --- /dev/null +++ b/ch03/AddNumber.java @@ -0,0 +1,21 @@ +import java.util.Scanner; + +public class AddNumber +{ + public static void main(String[] args) + { + Scanner scanner=new Scanner(System.in ); + + System.out.println("I will add two number for you .Please enter the first number:"); + Double FristNumber= scanner.nextDouble(); + + System.out.println("Please enter the Second number:"); + Double SecondNumber= scanner.nextDouble(); + + double result=FristNumber+SecondNumber; + + System.out.println("the total of " +FristNumber+"and "+ SecondNumber +"is "+result ); + + + } +} diff --git a/ch03/Guess_My_Number.java b/ch03/Guess_My_Number.java new file mode 100644 index 0000000..52bf16d --- /dev/null +++ b/ch03/Guess_My_Number.java @@ -0,0 +1,22 @@ +import java.util.Scanner; +import java.util.Random; + +public class Guess_My_Number +{ + public static void main(String[] args) + { + Scanner scanner=new Scanner(System.in); + //pick a random number + + Random random=new Random(); + int number =random.nextInt(100)+1; + System.out.println(""); + System.out.println("I'm thinking of a number between 1 to 100 \n (including both). Can you guess what it is?"); + System.out.print("Type your Number:"); + int guess=scanner.nextInt(); + System.out.println("your guess is :"+guess); + System.out.println("The number I was thinking of is :"+number); + System.out.println("You were of by"+(number-guess)); + + } +} diff --git a/ch03/TongueWeight.java b/ch03/TongueWeight.java new file mode 100644 index 0000000..f0006d8 --- /dev/null +++ b/ch03/TongueWeight.java @@ -0,0 +1,27 @@ +import java.util.Scanner; + +public class TongueWeight +{ + public static void main(String[] args) + { + Scanner scanner=new Scanner(System.in); + + System.out.println("Please enter trailer Weight "); + double triweight=scanner.nextDouble(); + + System.out.println("Please enter cargo Weight "); + double cargoweight=scanner.nextDouble(); + + double totalweight=triweight+cargoweight; + + double min=0.09*totalweight; + double max=0.15*totalweight; + + System.out.println("the minimum weight "+min+"and maximum "+max+" toungue weight allowed "); + + + + + + } +} From 8719f8af39a849d7344b436e8f5cf03fb5108d0f Mon Sep 17 00:00:00 2001 From: Avinash v Garud <41214994+avigarud@users.noreply.github.com> Date: Thu, 26 Jul 2018 10:13:16 -0500 Subject: [PATCH 2/6] Create method exercise --- ch04/zool.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 ch04/zool.java diff --git a/ch04/zool.java b/ch04/zool.java new file mode 100644 index 0000000..62cba20 --- /dev/null +++ b/ch04/zool.java @@ -0,0 +1,16 @@ +public class zool +{ + public static void main(String[] args) + { + int number=11; + String one="jack"; + String two="pune"; + zool(number,one,two); + } + + public static void zool(int number,String one,String two) + { + System.out.println("output"+number+""+two+""+ one ); + + } +} From 13db0decde670f56266ab3396484178e546ad05c Mon Sep 17 00:00:00 2001 From: Avinash v Garud <41214994+avigarud@users.noreply.github.com> Date: Thu, 26 Jul 2018 10:17:49 -0500 Subject: [PATCH 3/6] Create method exercise --- ATM/.idea/vcs.xml | 6 ++++++ ch01/Hello.java | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 ATM/.idea/vcs.xml diff --git a/ATM/.idea/vcs.xml b/ATM/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/ATM/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ch01/Hello.java b/ch01/Hello.java index 593557b..347f8d5 100644 --- a/ch01/Hello.java +++ b/ch01/Hello.java @@ -1,8 +1,12 @@ public class Hello { public static void main(String[] args) { + + // generate some simple output System.out.println("Hello, World!"); + //this is comments + System.out.println("Hi there again "); } } From 4a7a41b7782ef589fc90ed9d928b0c82e61c96e9 Mon Sep 17 00:00:00 2001 From: Avinash v Garud <41214994+avigarud@users.noreply.github.com> Date: Thu, 26 Jul 2018 10:22:52 -0500 Subject: [PATCH 4/6] Atm Machine --- ATM/src/Withdrawal.java | 16 ++++++++++++++++ ATM/src/WithdrawalTwo.java | 24 ++++++++++++++++++++++++ ATM/src/withdrawalfees.java | 26 ++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 ATM/src/Withdrawal.java create mode 100644 ATM/src/WithdrawalTwo.java create mode 100644 ATM/src/withdrawalfees.java diff --git a/ATM/src/Withdrawal.java b/ATM/src/Withdrawal.java new file mode 100644 index 0000000..c63bf6d --- /dev/null +++ b/ATM/src/Withdrawal.java @@ -0,0 +1,16 @@ +public class Withdrawal +{ + public static void main(String[] args) + { + int withdrawal=137;//variable declaration + + //calculation + int five = withdrawal/ 5; + int remaining = withdrawal % 5; + int one = remaining/ 1; + //output + System.out.print("$5" + "( " + five + " )" + ", "); + System.out.println("$1" + "( " + one+ " )"); + + } +} diff --git a/ATM/src/WithdrawalTwo.java b/ATM/src/WithdrawalTwo.java new file mode 100644 index 0000000..7d5ce97 --- /dev/null +++ b/ATM/src/WithdrawalTwo.java @@ -0,0 +1,24 @@ +public class WithdrawalTwo +{ + public static void main(String[] args) + { + int withdrawal=137;//variable declaration + + //calculation + int twenty = withdrawal/ 20; + int remaining = withdrawal % 20; + int ten = remaining/ 10; + remaining = remaining % 10; + int five = remaining/ 5; + remaining = remaining % 5; + int two = remaining/ 2; + //output + System.out.print("$20" + "( " + twenty + " )" + ", "); + System.out.print("$10" + "( " + ten + " )" + ", "); + System.out.print("$5" + "( " + five + " )" + ", "); + System.out.println("$2" + "( " + two+ " )"); + + } +} + + diff --git a/ATM/src/withdrawalfees.java b/ATM/src/withdrawalfees.java new file mode 100644 index 0000000..48e1029 --- /dev/null +++ b/ATM/src/withdrawalfees.java @@ -0,0 +1,26 @@ +public class withdrawalfees +{ + public static void main(String[] args) + { + int withdrawal=137;//variable declaration + + //calculation + int twenty = withdrawal/ 20; + int remaining = withdrawal % 20; + int ten = remaining/ 10; + remaining = remaining % 10; + int five = remaining/ 5; + remaining = remaining % 5; + int two = remaining/ 2; + + double totalfees =1+((twenty*0.10)+ (ten*0.10)+(five*0.10)+(two*0.10)); + //output + System.out.print("$20" + "( " + twenty + " )" + ", "); + System.out.print("$10" + "( " + ten + " )" + ", "); + System.out.print("$5" + "( " + five + " )" + ", "); + System.out.println("$2" + "( " + two+ " )"); + System.out.println("Total convenienve Fees:" +totalfees); + + + } +} From 9f4fed480794104de13ceb512ef7ea2f0ccea452 Mon Sep 17 00:00:00 2001 From: Avinash v Garud <41214994+avigarud@users.noreply.github.com> Date: Thu, 26 Jul 2018 13:34:22 -0500 Subject: [PATCH 5/6] Create method exercise --- ch04/BigMethodSignature.java | 17 +++++++++++ ch04/Date.java | 13 ++++++++ ch04/DemoMath.java | 23 +++++++++++++++ ch04/Employee.java | 57 ++++++++++++++++++++++++++++++++++++ ch04/MathUtil.java | 24 +++++++++++++++ ch04/SImpleMethods4B3.java | 13 ++++++++ ch04/SimpleMethods.java | 13 ++++++++ ch04/SimpleMethods4b2.java | 23 +++++++++++++++ ch04/Temp4b7.java | 27 +++++++++++++++++ ch04/Tongueweight.java | 37 +++++++++++++++++++++++ 10 files changed, 247 insertions(+) create mode 100644 ch04/BigMethodSignature.java create mode 100644 ch04/Date.java create mode 100644 ch04/DemoMath.java create mode 100644 ch04/Employee.java create mode 100644 ch04/MathUtil.java create mode 100644 ch04/SImpleMethods4B3.java create mode 100644 ch04/SimpleMethods.java create mode 100644 ch04/SimpleMethods4b2.java create mode 100644 ch04/Temp4b7.java create mode 100644 ch04/Tongueweight.java diff --git a/ch04/BigMethodSignature.java b/ch04/BigMethodSignature.java new file mode 100644 index 0000000..e536151 --- /dev/null +++ b/ch04/BigMethodSignature.java @@ -0,0 +1,17 @@ +public class BigMethodSignature +{ + public static void main(String[] args) + { + int value=20; + printSum(value); + + System.out.println(""); + } + + public static void printSum(int value) + { + int sum=value+10; + System.out.println("the result of adding the 10 number together:"+sum); + + } +} diff --git a/ch04/Date.java b/ch04/Date.java new file mode 100644 index 0000000..8492ceb --- /dev/null +++ b/ch04/Date.java @@ -0,0 +1,13 @@ +public class Date +{ + public static void main(String[] args) + { + + + + + + + + } +} diff --git a/ch04/DemoMath.java b/ch04/DemoMath.java new file mode 100644 index 0000000..5fcdacf --- /dev/null +++ b/ch04/DemoMath.java @@ -0,0 +1,23 @@ +public class DemoMath +{ + public static void main(String[] args) + { + int a=5; + int b=10; + int abs=Math.abs(a); + int max=Math.max(a,b); + + double pow=Math.pow(a,a); + double pi=Math.PI; + + System.out.println(abs); + System.out.println(max); + System.out.println(pow); + System.out.println(pi); + + + + + + } +} diff --git a/ch04/Employee.java b/ch04/Employee.java new file mode 100644 index 0000000..5e03483 --- /dev/null +++ b/ch04/Employee.java @@ -0,0 +1,57 @@ +import java.util.Random; +import java.util.Scanner; + +public class Employee +{ + public static void main(String[] args) + { + int birthyear=1992; + boolean isUnionMember= true; + String fristname="Avi"; + String Lastname="Garud"; + String middlename="Vishwanath"; + int employeeNumber ; + Scanner scanner=new Scanner(System.in); + printHeader(); + System.out.println("Please enter your 5 digit employee number "); + employeeNumber=scanner.nextInt(); + printFullName(fristname,Lastname,middlename); + printUnionStatus(isUnionMember); + printAge(birthyear); + printEvenOrOdd(employeeNumber); + printGeneratedScreatPassword(employeeNumber); + } + public static void printHeader() + { + System.out.println("Welcome to the wallabutech Employee Application"); + System.out.println("==============================================="); + } + public static void printFullName(String fristname,String Lastname,String middlename) + { + System.out.println(Lastname+","+fristname+" "+middlename); + } + public static void printUnionStatus(boolean isUnioMember) + { + System.out.println("Your Union statues :"+isUnioMember); + } + public static void printAge(int birthyear) + { + int age=2018-birthyear; + System.out.println("Your Agr is :"+age); + } + public static void printEvenOrOdd( int employeeNumber ) + { + + System.out.println("Employee number is even /odd(1=odd,0=even:"+employeeNumber%2); + } + public static void printGeneratedScreatPassword(int employeeNumber) + { + Random random=new Random(); + int number =random.nextInt(10)+1; + + int password=(employeeNumber+number)*5; + System.out.println("Employee's random secreat pw is:"+password); + + + } +} diff --git a/ch04/MathUtil.java b/ch04/MathUtil.java new file mode 100644 index 0000000..0fe788e --- /dev/null +++ b/ch04/MathUtil.java @@ -0,0 +1,24 @@ +public class MathUtil +{ + public static void main(String[] args) + { + int one=-1000; + int two=400000; + printDiffernace(one,two); + printAbsValue(one); + System.out.println(); + } + + public static void printDiffernace(int one,int two) + { + int diff=one-two; + System.out.println("the differnce between two value is"+diff); + } + + public static void printAbsValue(int one) + { + int abs=Math.abs(one); + System.out.println("Value is :"+one+"and abs value is :"+abs); + + } +} diff --git a/ch04/SImpleMethods4B3.java b/ch04/SImpleMethods4B3.java new file mode 100644 index 0000000..346f66a --- /dev/null +++ b/ch04/SImpleMethods4B3.java @@ -0,0 +1,13 @@ +public class SImpleMethods4B3 +{ + public static void main(String[] args) + { + Boolean isStudent; + printBoolean(true); + } + + public static void printBoolean(boolean isStudent) + { + System.out.println("I am Student:"+isStudent); + } +} diff --git a/ch04/SimpleMethods.java b/ch04/SimpleMethods.java new file mode 100644 index 0000000..7f59ead --- /dev/null +++ b/ch04/SimpleMethods.java @@ -0,0 +1,13 @@ +public class SimpleMethods +{ + public static void main(String[] args) + { + int count=5; + printCount(count); + } + + public static void printCount(int count) + { + System.out.println("THe count is:"+count); + } +} diff --git a/ch04/SimpleMethods4b2.java b/ch04/SimpleMethods4b2.java new file mode 100644 index 0000000..497d721 --- /dev/null +++ b/ch04/SimpleMethods4b2.java @@ -0,0 +1,23 @@ +public class SimpleMethods4b2 +{ + public static void main(String[] args) + { + int numb1=4; + int numb2=6; + printSum(numb1,numb2); + numb1=7; + numb2=2; + printSum(numb1,numb2); + } + + public static void printSum(int numb1,int numb2) + { + + int sum=numb1+numb2; + System.out.println("THe count is:"+sum); + } + + + + +} diff --git a/ch04/Temp4b7.java b/ch04/Temp4b7.java new file mode 100644 index 0000000..aff6bec --- /dev/null +++ b/ch04/Temp4b7.java @@ -0,0 +1,27 @@ +import java.util.Scanner; +public class Temp4b7 +{ + + + + public static void main(String[] args) + { + + + System.out.println("This program will convert temperature from Celsius to Faherenheit"); + + printFahrenheit(); + + + } + public static void printFahrenheit() + { + Scanner scanner=new Scanner(System.in ); + System.out.println("Please enter the first number:"); + Double Celsius= scanner.nextDouble(); + Double Faherenheit=(Celsius*9.0/5.0)+35; + + System.out.println("The Temperature from"+Celsius+"C="+Faherenheit+"F"); + } + } + diff --git a/ch04/Tongueweight.java b/ch04/Tongueweight.java new file mode 100644 index 0000000..f92c100 --- /dev/null +++ b/ch04/Tongueweight.java @@ -0,0 +1,37 @@ +import java.util.Scanner; +public class Tongueweight +{ + + + + + + public static void main(String[] args) + { + printRange(); + + + + + + } + public static void printRange() + { + Scanner scanner=new Scanner(System.in); + + System.out.println("Please enter trailer Weight "); + double triweight=scanner.nextDouble(); + + System.out.println("Please enter cargo Weight "); + double cargoweight=scanner.nextDouble(); + + double totalweight=triweight+cargoweight; + + double min=0.09*totalweight; + double max=0.15*totalweight; + + System.out.println("the minimum weight "+min+"and maximum "+max+" toungue weight allowed "); + + } + +} From 2b71e3d711cdf8ccdbb4840bf8a2e286297c0614 Mon Sep 17 00:00:00 2001 From: Avinash v Garud <41214994+avigarud@users.noreply.github.com> Date: Thu, 26 Jul 2018 16:31:42 -0500 Subject: [PATCH 6/6] Conditional AND LOGIC --- ch05/Comparison.java | 19 +++++++++++++++++++ ch05/Condition.java | 15 +++++++++++++++ ch05/Else.java | 20 ++++++++++++++++++++ ch05/IF.java | 15 +++++++++++++++ ch05/Logic.java | 15 +++++++++++++++ ch05/Precedence.java | 12 ++++++++++++ ch05/Switch.java | 23 +++++++++++++++++++++++ 7 files changed, 119 insertions(+) create mode 100644 ch05/Comparison.java create mode 100644 ch05/Condition.java create mode 100644 ch05/Else.java create mode 100644 ch05/IF.java create mode 100644 ch05/Logic.java create mode 100644 ch05/Precedence.java create mode 100644 ch05/Switch.java diff --git a/ch05/Comparison.java b/ch05/Comparison.java new file mode 100644 index 0000000..e079f15 --- /dev/null +++ b/ch05/Comparison.java @@ -0,0 +1,19 @@ +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);//assign result + System.out.println("String inequality Test:"+state); + int dozen=12; + int score =20; + state=(dozen>score); + System.out.println("Great thanTest:"+state); + state=(dozen1) + System.out.println("Five is greater than one."); + if (2<4) + System.out.println( "Two os less than four"); + System.out.println("Test succeeded"); + + int num=11; + if(((num>5)&&(num<10))|| (num==12)) + System.out.println("Number is 6-9,or 12"); + } +} diff --git a/ch05/Logic.java b/ch05/Logic.java new file mode 100644 index 0000000..0cccbf3 --- /dev/null +++ b/ch05/Logic.java @@ -0,0 +1,15 @@ +public class Logic +{ + public static void main(String[] args) + { + boolean yes=true; + boolean no=false; + System.out.println("Both Yes Yes True:"+(yes && yes)); + System.out.println("Both Yes Yes True:"+(yes && no)); + System.out.println("Either YEs Yes True:"+(yes||yes)); + System.out.println("Either YEs no True:"+(yes||no)); + System.out.println("Either no no True:"+(no||no)); + System.out.println("Original Yes value:"+yes); + System.out.println("Original Yes value:"+ !yes); + } +} diff --git a/ch05/Precedence.java b/ch05/Precedence.java new file mode 100644 index 0000000..a5fe254 --- /dev/null +++ b/ch05/Precedence.java @@ -0,0 +1,12 @@ +public class Precedence +{ + public static void main(String[] args) + { + int sum=32-8+16*2; + System.out.println("Default order:"+sum); + sum=(32-816)*2; + System.out.println("Specified order:"+sum); + sum=(32-(8+16))*2; + System.out.println("Nested specific order:"+sum); + } +} diff --git a/ch05/Switch.java b/ch05/Switch.java new file mode 100644 index 0000000..acaa4bb --- /dev/null +++ b/ch05/Switch.java @@ -0,0 +1,23 @@ +public class Switch +{ + public static void main(String[] args) + { + int month=2,year=2016,num=31; + switch(month) + { + case 4: + case 6: + + case 9: + + case 11: + num=30; + break; + case 2: + num=(year%4==0) ? 29:28; + break; + + } + System.out.println(month+"/"+year+":"+num+"days"); + } +}