From 1c0ed3c6147833990f4ee78d442e9741f931f8b3 Mon Sep 17 00:00:00 2001 From: Abhilash G Date: Thu, 6 Sep 2018 15:04:38 +0530 Subject: [PATCH 01/14] Git and Java --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..573c4cb --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# test-repo +This is a test repo, please fork me!!! \(^_^)/ + +
+ +Please follow the below mentioned instructions; + +1. Fork this repository +2. Clone the forked the repository to your machine +3. Create a new branch from the development branch +4. Create a new folder :file_folder: and name it ```Java``` +5. Go into the Java directory +6. Create a java file called Student. + * Create a class Student + * Create the following fields and methods- + 1. String -> name [private] + 2. String -> rollNumber [private] + 3. String -> favoriteFruit [private] + 4. float -> height [private] + 5. float -> weight [private] + * Create getters and setters + * Create a argmumented-constructor which takes in all the declared fields, and a no-arg constructor(default constructor) + * Create a driver class which contains a main method. + * Create a non-static method called ```studentConsumer()```. The method takes two in arguments, which are as follows: + 1. An ```ArrayList``` of students + 2. A ```Consumer``` functional interface + * Inside the method body write the logic to consume the students in present in the ```ArrayList``` + by making use of the ```accept(T t)``` method of the ```Consumer``` functional interface. + * Create an ArrayList of students and populate the list by taking input from the user. + * Call the ```studentConsumer()``` method, pass in the list of students and also write the logic to print the details of each student from the list + * Once the program executes and displays the output, commit the file ```.java``` file only. +7. Now create a text file and write the name of your favorite fruit, song, and dessert. +8. Commit the text file as well. +9. Create a ```.gitignore``` file and add ```*.class``` entry in it. +10. Commit this file as well. +11. Squash the last three commits and send a pull request. + +:sparkles: Yay!! You're done. :sparkles: From 089746f52bd5decddca49e30d6b82fee7bcd6d02 Mon Sep 17 00:00:00 2001 From: AbhilashG97 Date: Sun, 28 Oct 2018 22:49:09 +0530 Subject: [PATCH 02/14] style: minor modifications --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 573c4cb..547c723 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ # test-repo This is a test repo, please fork me!!! \(^_^)/ - +This repository contains a simple test on Java Lambdas and Git.
-Please follow the below mentioned instructions; +Please follow the below mentioned instructions: 1. Fork this repository 2. Clone the forked the repository to your machine 3. Create a new branch from the development branch 4. Create a new folder :file_folder: and name it ```Java``` 5. Go into the Java directory -6. Create a java file called Student. +6. Create a java file called Student * Create a class Student * Create the following fields and methods- 1. String -> name [private] @@ -18,21 +18,21 @@ Please follow the below mentioned instructions; 3. String -> favoriteFruit [private] 4. float -> height [private] 5. float -> weight [private] - * Create getters and setters - * Create a argmumented-constructor which takes in all the declared fields, and a no-arg constructor(default constructor) + * Create getters and setters for these fields + * Create a argumented-constructor which takes in all the declared fields, and a no-arg constructor(default constructor) * Create a driver class which contains a main method. - * Create a non-static method called ```studentConsumer()```. The method takes two in arguments, which are as follows: + * Create a non-static method called ```studentConsumer()``` in the driver class. The method takes two in arguments, which are as follows: 1. An ```ArrayList``` of students 2. A ```Consumer``` functional interface * Inside the method body write the logic to consume the students in present in the ```ArrayList``` by making use of the ```accept(T t)``` method of the ```Consumer``` functional interface. * Create an ArrayList of students and populate the list by taking input from the user. - * Call the ```studentConsumer()``` method, pass in the list of students and also write the logic to print the details of each student from the list + * Call the ```studentConsumer()``` method inside the main thread, pass in the list of students and also write the logic to print the details of each student from the list. * Once the program executes and displays the output, commit the file ```.java``` file only. 7. Now create a text file and write the name of your favorite fruit, song, and dessert. 8. Commit the text file as well. -9. Create a ```.gitignore``` file and add ```*.class``` entry in it. +9. Create a ```.gitignore``` file and add ```*.class``` entry into it. 10. Commit this file as well. -11. Squash the last three commits and send a pull request. +11. Finally, squash the last three commits into a single commit and send a pull request. :sparkles: Yay!! You're done. :sparkles: From ae5ba4d43a3cd967052402afc0ec896495082190 Mon Sep 17 00:00:00 2001 From: AbhilashG97 Date: Tue, 11 Dec 2018 11:48:54 +0530 Subject: [PATCH 03/14] added files --- .gitignore | 1 + Fruits/Watermelon.java | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 .gitignore create mode 100644 Fruits/Watermelon.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5241a72 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.class \ No newline at end of file diff --git a/Fruits/Watermelon.java b/Fruits/Watermelon.java new file mode 100644 index 0000000..659058c --- /dev/null +++ b/Fruits/Watermelon.java @@ -0,0 +1,5 @@ +public class Watermelon { + public static void main(String[] args) { + System.out.println("Watermelons !!"); + } +} \ No newline at end of file From 2be9f4b2ca42e565a031cf2953aed99593f24104 Mon Sep 17 00:00:00 2001 From: hridya Date: Tue, 11 Dec 2018 14:07:16 +0530 Subject: [PATCH 04/14] new fruit added --- Fruits/Strawberry.java | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Fruits/Strawberry.java diff --git a/Fruits/Strawberry.java b/Fruits/Strawberry.java new file mode 100644 index 0000000..70f3518 --- /dev/null +++ b/Fruits/Strawberry.java @@ -0,0 +1,6 @@ +public class Strawberry { + public static void main(String[] args){ + //Hridya + System.out.println("I love Strawberries"); + } +} From f23b2f62ed682c91b05bca6fff8eef8459a469ee Mon Sep 17 00:00:00 2001 From: prabhakar369 Date: Tue, 11 Dec 2018 14:15:55 +0530 Subject: [PATCH 05/14] prabhakar --- Fruits/strawberry.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Fruits/strawberry.java diff --git a/Fruits/strawberry.java b/Fruits/strawberry.java new file mode 100644 index 0000000..3ab97e0 --- /dev/null +++ b/Fruits/strawberry.java @@ -0,0 +1,5 @@ +public class strawberry { + public static void main(String[] args) { + System.out.println("i love the strawberry !!"); + } +} From 46fb329c0efec2d7f92398edff5634c38cb520fb Mon Sep 17 00:00:00 2001 From: athiranair2000 Date: Tue, 11 Dec 2018 14:20:02 +0530 Subject: [PATCH 06/14] apple is added --- Fruits/Apple.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Fruits/Apple.java diff --git a/Fruits/Apple.java b/Fruits/Apple.java new file mode 100644 index 0000000..f5b758c --- /dev/null +++ b/Fruits/Apple.java @@ -0,0 +1,5 @@ +public class Apple { + public static void main(String[] args) { + System.out.println("Apple !!"); + } +} From 74400c3417f8766625a1ad798e17e99910156774 Mon Sep 17 00:00:00 2001 From: jasnasuresh Date: Tue, 11 Dec 2018 14:22:43 +0530 Subject: [PATCH 07/14] Changed the fruit name --- Fruits/pineapple.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Fruits/pineapple.java diff --git a/Fruits/pineapple.java b/Fruits/pineapple.java new file mode 100644 index 0000000..15d9d4d --- /dev/null +++ b/Fruits/pineapple.java @@ -0,0 +1,5 @@ +public class pineapple { + public static void main(String[] args) { + System.out.println("Pineapple!!"); //Jasna + } +} From b003dee01885b3c0e91d236b9431c7fb2efc3a41 Mon Sep 17 00:00:00 2001 From: gopikaharikumar Date: Tue, 11 Dec 2018 14:23:10 +0530 Subject: [PATCH 08/14] changed the fruit name --- Fruits/apple.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Fruits/apple.java diff --git a/Fruits/apple.java b/Fruits/apple.java new file mode 100644 index 0000000..25bac97 --- /dev/null +++ b/Fruits/apple.java @@ -0,0 +1,5 @@ +public class Apple { + public static void main(String[] args) { + System.out.println("Apple !!");//Gopika + } +} From 78893129b6c323a474b4a8e09c85c161b5bc715a Mon Sep 17 00:00:00 2001 From: AbhilashG97 Date: Tue, 11 Dec 2018 14:44:23 +0530 Subject: [PATCH 09/14] added star-fruit --- Fruits/StarApple.java | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Fruits/StarApple.java diff --git a/Fruits/StarApple.java b/Fruits/StarApple.java new file mode 100644 index 0000000..8bcd5cc --- /dev/null +++ b/Fruits/StarApple.java @@ -0,0 +1,6 @@ +public class StarApple { + // Abhilash G + public static void main(String[] args) { + System.out.println("Star Apple !!"); + } +} \ No newline at end of file From 4d9d4bbb887cb838d5fd472a4d701951525539fc Mon Sep 17 00:00:00 2001 From: abhijitramesh Date: Tue, 11 Dec 2018 23:48:58 +0530 Subject: [PATCH 10/14] added fruits --- Fruits/Apple.java | 13 +++++++++++++ Fruits/Mango.java | 13 +++++++++++++ Fruits/grapes.java | 13 +++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 Fruits/Apple.java create mode 100644 Fruits/Mango.java create mode 100644 Fruits/grapes.java diff --git a/Fruits/Apple.java b/Fruits/Apple.java new file mode 100644 index 0000000..c383f14 --- /dev/null +++ b/Fruits/Apple.java @@ -0,0 +1,13 @@ +/** + * + * @author abhijit + * + */ +public class Apple { + + public static void main(String[] args) { + System.out.println("Apple"); + + } + +} diff --git a/Fruits/Mango.java b/Fruits/Mango.java new file mode 100644 index 0000000..40f1a2f --- /dev/null +++ b/Fruits/Mango.java @@ -0,0 +1,13 @@ +/** + * + * @author abhijit + * + */ +public class Mango { + + public static void main(String[] args) { + System.out.println("Mango"); + + } + +} diff --git a/Fruits/grapes.java b/Fruits/grapes.java new file mode 100644 index 0000000..7b5620e --- /dev/null +++ b/Fruits/grapes.java @@ -0,0 +1,13 @@ +/** + * + * @author abhijit + * + */ +public class grapes { + + public static void main(String[] args) { + System.out.println("grapes"); + + } + +} From 15d86469a09ba632afa77edd8eef294fa7d9d286 Mon Sep 17 00:00:00 2001 From: AbhilashG97 Date: Wed, 12 Dec 2018 14:39:34 +0530 Subject: [PATCH 11/14] created fruit juice --- FruitJuice/Abhilash/DragonFruit.java | 5 +++++ FruitJuice/Abhilash/StarFruit.java | 5 +++++ FruitJuice/Abhilash/Watermelon.java | 5 +++++ FruitJuice/Abhilash/tmp.txt | 1 + 4 files changed, 16 insertions(+) create mode 100644 FruitJuice/Abhilash/DragonFruit.java create mode 100644 FruitJuice/Abhilash/StarFruit.java create mode 100644 FruitJuice/Abhilash/Watermelon.java create mode 100644 FruitJuice/Abhilash/tmp.txt diff --git a/FruitJuice/Abhilash/DragonFruit.java b/FruitJuice/Abhilash/DragonFruit.java new file mode 100644 index 0000000..e3c7c76 --- /dev/null +++ b/FruitJuice/Abhilash/DragonFruit.java @@ -0,0 +1,5 @@ +public class DragonFruit { + public static void main(String[] args) { + System.out.println("Dragon Fruit"); + } +} \ No newline at end of file diff --git a/FruitJuice/Abhilash/StarFruit.java b/FruitJuice/Abhilash/StarFruit.java new file mode 100644 index 0000000..80677d5 --- /dev/null +++ b/FruitJuice/Abhilash/StarFruit.java @@ -0,0 +1,5 @@ +public class StarFruit { + public static void main(String[] args) { + System.out.println("Star Fruit"); + } +} \ No newline at end of file diff --git a/FruitJuice/Abhilash/Watermelon.java b/FruitJuice/Abhilash/Watermelon.java new file mode 100644 index 0000000..3654e1d --- /dev/null +++ b/FruitJuice/Abhilash/Watermelon.java @@ -0,0 +1,5 @@ +public class Watermelon { + public static void main(String[] args) { + System.out.println("Watermelon"); + } +} \ No newline at end of file diff --git a/FruitJuice/Abhilash/tmp.txt b/FruitJuice/Abhilash/tmp.txt new file mode 100644 index 0000000..ffb123a --- /dev/null +++ b/FruitJuice/Abhilash/tmp.txt @@ -0,0 +1 @@ +Abhilash From f392a62e1541eb6923daf8ce6cb8953b11b335fc Mon Sep 17 00:00:00 2001 From: AbhilashG97 Date: Thu, 25 Apr 2019 19:07:04 +0530 Subject: [PATCH 12/14] Java Assignment: Beginner Assignment 1 :sparkles: --- README.md => Assignments/Advanced/README.md | 0 Assignments/Easy/README.md | 16 ++++++++++++++++ FruitJuice/Abhilash/DragonFruit.java | 5 ----- FruitJuice/Abhilash/StarFruit.java | 5 ----- FruitJuice/Abhilash/Watermelon.java | 5 ----- FruitJuice/Abhilash/tmp.txt | 1 - Fruits/Apple.java | 17 ----------------- Fruits/Mango.java | 13 ------------- Fruits/StarApple.java | 6 ------ Fruits/Strawberry.java | 6 ------ Fruits/Watermelon.java | 5 ----- Fruits/apple.java | 5 ----- Fruits/grapes.java | 13 ------------- Fruits/pineapple.java | 5 ----- Fruits/strawberry.java | 5 ----- 15 files changed, 16 insertions(+), 91 deletions(-) rename README.md => Assignments/Advanced/README.md (100%) create mode 100644 Assignments/Easy/README.md delete mode 100644 FruitJuice/Abhilash/DragonFruit.java delete mode 100644 FruitJuice/Abhilash/StarFruit.java delete mode 100644 FruitJuice/Abhilash/Watermelon.java delete mode 100644 FruitJuice/Abhilash/tmp.txt delete mode 100644 Fruits/Apple.java delete mode 100644 Fruits/Mango.java delete mode 100644 Fruits/StarApple.java delete mode 100644 Fruits/Strawberry.java delete mode 100644 Fruits/Watermelon.java delete mode 100644 Fruits/apple.java delete mode 100644 Fruits/grapes.java delete mode 100644 Fruits/pineapple.java delete mode 100644 Fruits/strawberry.java diff --git a/README.md b/Assignments/Advanced/README.md similarity index 100% rename from README.md rename to Assignments/Advanced/README.md diff --git a/Assignments/Easy/README.md b/Assignments/Easy/README.md new file mode 100644 index 0000000..68dec5f --- /dev/null +++ b/Assignments/Easy/README.md @@ -0,0 +1,16 @@ +# Beginner Java Assignment + +## Task 1 + +Please do the following and send the files as a pull request - + +1. Your task will be create a POJO class. +1. Define two variables of your choice. +1. Initialize the variables through a parameterized constructor that takes in both the variables. +1. Create getter and setters for the two variables. +1. Override the ```toString()``` method of that class. + +:sparkles: ```Bonus :``` Create a new class with ```main()``` method, create objects of the above class and print the object on the console. + +## Task 2 + diff --git a/FruitJuice/Abhilash/DragonFruit.java b/FruitJuice/Abhilash/DragonFruit.java deleted file mode 100644 index e3c7c76..0000000 --- a/FruitJuice/Abhilash/DragonFruit.java +++ /dev/null @@ -1,5 +0,0 @@ -public class DragonFruit { - public static void main(String[] args) { - System.out.println("Dragon Fruit"); - } -} \ No newline at end of file diff --git a/FruitJuice/Abhilash/StarFruit.java b/FruitJuice/Abhilash/StarFruit.java deleted file mode 100644 index 80677d5..0000000 --- a/FruitJuice/Abhilash/StarFruit.java +++ /dev/null @@ -1,5 +0,0 @@ -public class StarFruit { - public static void main(String[] args) { - System.out.println("Star Fruit"); - } -} \ No newline at end of file diff --git a/FruitJuice/Abhilash/Watermelon.java b/FruitJuice/Abhilash/Watermelon.java deleted file mode 100644 index 3654e1d..0000000 --- a/FruitJuice/Abhilash/Watermelon.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Watermelon { - public static void main(String[] args) { - System.out.println("Watermelon"); - } -} \ No newline at end of file diff --git a/FruitJuice/Abhilash/tmp.txt b/FruitJuice/Abhilash/tmp.txt deleted file mode 100644 index ffb123a..0000000 --- a/FruitJuice/Abhilash/tmp.txt +++ /dev/null @@ -1 +0,0 @@ -Abhilash diff --git a/Fruits/Apple.java b/Fruits/Apple.java deleted file mode 100644 index ce8aadc..0000000 --- a/Fruits/Apple.java +++ /dev/null @@ -1,17 +0,0 @@ - -class Pear { - public static void main(String[] args) { - System.out.println("Apple !!"); - } -/** - * - * @author abhijit - * - */ -public class Apple { - - public static void main(String[] args) { - System.out.println("Apple"); - - } -} diff --git a/Fruits/Mango.java b/Fruits/Mango.java deleted file mode 100644 index 40f1a2f..0000000 --- a/Fruits/Mango.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * - * @author abhijit - * - */ -public class Mango { - - public static void main(String[] args) { - System.out.println("Mango"); - - } - -} diff --git a/Fruits/StarApple.java b/Fruits/StarApple.java deleted file mode 100644 index 8bcd5cc..0000000 --- a/Fruits/StarApple.java +++ /dev/null @@ -1,6 +0,0 @@ -public class StarApple { - // Abhilash G - public static void main(String[] args) { - System.out.println("Star Apple !!"); - } -} \ No newline at end of file diff --git a/Fruits/Strawberry.java b/Fruits/Strawberry.java deleted file mode 100644 index 70f3518..0000000 --- a/Fruits/Strawberry.java +++ /dev/null @@ -1,6 +0,0 @@ -public class Strawberry { - public static void main(String[] args){ - //Hridya - System.out.println("I love Strawberries"); - } -} diff --git a/Fruits/Watermelon.java b/Fruits/Watermelon.java deleted file mode 100644 index 659058c..0000000 --- a/Fruits/Watermelon.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Watermelon { - public static void main(String[] args) { - System.out.println("Watermelons !!"); - } -} \ No newline at end of file diff --git a/Fruits/apple.java b/Fruits/apple.java deleted file mode 100644 index 25bac97..0000000 --- a/Fruits/apple.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Apple { - public static void main(String[] args) { - System.out.println("Apple !!");//Gopika - } -} diff --git a/Fruits/grapes.java b/Fruits/grapes.java deleted file mode 100644 index 7b5620e..0000000 --- a/Fruits/grapes.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * - * @author abhijit - * - */ -public class grapes { - - public static void main(String[] args) { - System.out.println("grapes"); - - } - -} diff --git a/Fruits/pineapple.java b/Fruits/pineapple.java deleted file mode 100644 index 15d9d4d..0000000 --- a/Fruits/pineapple.java +++ /dev/null @@ -1,5 +0,0 @@ -public class pineapple { - public static void main(String[] args) { - System.out.println("Pineapple!!"); //Jasna - } -} diff --git a/Fruits/strawberry.java b/Fruits/strawberry.java deleted file mode 100644 index 3ab97e0..0000000 --- a/Fruits/strawberry.java +++ /dev/null @@ -1,5 +0,0 @@ -public class strawberry { - public static void main(String[] args) { - System.out.println("i love the strawberry !!"); - } -} From afc216c0a5a46f1ca24e53caeb01c58de4902699 Mon Sep 17 00:00:00 2001 From: AbhilashG97 Date: Sat, 27 Apr 2019 20:56:03 +0530 Subject: [PATCH 13/14] Java: Simple Java Excercises --- Assignments/Easy/README.md | 46 +++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/Assignments/Easy/README.md b/Assignments/Easy/README.md index 68dec5f..16f6f47 100644 --- a/Assignments/Easy/README.md +++ b/Assignments/Easy/README.md @@ -4,13 +4,47 @@ Please do the following and send the files as a pull request - -1. Your task will be create a POJO class. -1. Define two variables of your choice. -1. Initialize the variables through a parameterized constructor that takes in both the variables. -1. Create getter and setters for the two variables. -1. Override the ```toString()``` method of that class. +1. Your task will be create a POJO. +1. Define two variables of any data type. +1. Initialize the variables through a parameterized constructor that takes in **both** the variables. +1. Create ```getter and setters``` for the two variables. +1. Override the ```toString()``` method of this class. -:sparkles: ```Bonus :``` Create a new class with ```main()``` method, create objects of the above class and print the object on the console. +:sparkles: ```Bonus :``` Create a new class with a ```main()``` method, create objects of the above class and print the objects on the console. ## Task 2 +Your task will be to simulate a **Grocery shop**. + +1. Create a ```Fruit``` class and two subclasses of the ```Fruit``` class. + 1. The ```Fruit``` class should contain the following variables - + 1. fruitName of type ```String``` + 1. price of type ```float``` + 1. Create a parameterized constructor which takes in both the variables and then also a default non-parameterized constructor. + 1. Override the ```toString()``` method. + 1. Create getters and setters for all the variables. +1. Create a ```Vegetable``` class and two subclasses of the ```Vegetable``` class. + 1. The ```Vegetable``` class should contain the following variables - + 1. vegetableName of type ```String``` + 1. price of type ```float``` + 1. Create a parameterized constructor which takes in both the variables and then also a default non-parameterized constructor. + 1. Override the ```toString()``` method. + 1. Create getters and setters for all the variables. +1. Create a ```FruitAndVeggeShop``` class which contains the following variables - + 1. ArrayList + 1. ArrayList +1. Create a parameterized constructor that takes in both the ArrayList's as arguments. +1. Create a method which prints all the fruits present in the ArrayList. +1. Create a method which prints all the vegetables present in the ArrayList. + +:sparkles: **Bonus:** Print all the fruits present in the ArrayList using the forEach() method by making use of a method reference. + +## Task 3 + +Complete the exercises present [here](https://www.hackerrank.com/domains/java) + +Also try completing [this](https://www.hackerrank.com/domains/tutorials/30-days-of-code) + +:sparkles: :sparkles: + +
\ No newline at end of file From 1bcb506058e3f79aa00d80b72b329319b5b2c161 Mon Sep 17 00:00:00 2001 From: Abhilash G Date: Sun, 19 May 2019 03:41:40 +0530 Subject: [PATCH 14/14] Create README.md --- Assignments/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Assignments/README.md diff --git a/Assignments/README.md b/Assignments/README.md new file mode 100644 index 0000000..96c1c2c --- /dev/null +++ b/Assignments/README.md @@ -0,0 +1,3 @@ +# Java Assignments + +This folder will contain ```Java``` assignments. It will be updated soon with a lot more problems. :sparkles: