From 37a6470034629108c66d599aa5d65ab0e230eb28 Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Sun, 5 Sep 2021 13:47:30 +0100 Subject: [PATCH 01/24] Queues were mentioned twice instead of once --- MustKnow/README.md | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/MustKnow/README.md b/MustKnow/README.md index 64e43db..e92d1da 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -73,12 +73,23 @@ 4. Queues -- Movie Theatre +- People waiting in line in the Movie Theatre +- Linear - FIFO -- aka people waiting in line +- Pushes To The End +- Pops From The Front - Ordered Collection - Operations: add(), remove() - +- Part of the java.util.* package +- Part of the collection Interface +- Two Classes Implement the Queue Interface: + - Linked List + - Priority Queue +- Supports all the methods in the Collection Interface +- Element & Remove Method Throws NoSuchElementException if the queue is empty +- Poll Method removes the head of the queue and returns it + - if the queue is empty the poll method call returns null + 5. Hash Table @@ -145,21 +156,6 @@ - -9. Queues - -- FIFO DS -- Linear -- Pushes To The End -- Pops From The Front -- Part of the java.util.* package -- Part of the collection Interface -- Two Classes Implement the Queue Interface: - - Linked List - - Priority Queue -- Supports all the methods in the Collection Interface -- Element & Remove Method Throws NoSuchElementException if the queue is empty -- Poll Method removes the head of the queue and returns it - - if the queue is empty the poll method call returns null 1. When the sample size increases of an Array what should you do? @@ -492,4 +488,4 @@ public class myclass{ //Total: O(1) + O(n) + O(n^2) ≈ O(n^2) } } -``` \ No newline at end of file +``` From a4af42c35e8778839c2c6049674d3c24528ca5c0 Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Wed, 8 Sep 2021 14:06:22 +0000 Subject: [PATCH 02/24] Encapsulation Concept is now fully complete --- Encapsulation/README.md | 83 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Encapsulation/README.md diff --git a/Encapsulation/README.md b/Encapsulation/README.md new file mode 100644 index 0000000..0d55687 --- /dev/null +++ b/Encapsulation/README.md @@ -0,0 +1,83 @@ +### Encapsulation + +- One of the 4 pillars of OOP(A,E,I,P): +- I have 3 elements: + - Class + - Method + - Variables +- I wrap the variables and the code implementation which interacts with the methods as one +- Variables within my class cannot be accessed by other classes +- Only the methods of that particular class can access them +- All in all, it is the process by which I group information + + +#### Good Practice + +- Class Variables should always be declared private +- Setter and Getter Methods should be public + + +#### Example Encapsulating Class + +```java +public class EncapsulatingThis{ + + + + private String myFullName; + private String myIdentifNum; + private int myAge; + + + + public int getMyAge(){ + return myAge; + } + + public void setMyAge(int theAge){ + myAge = theAge; + } + + public String getMyId(){ + return myIdentifNum; + } + + public void setMyId(String myNewId){ + myIdentifNum = myNewId; + } + + + public String getMyName(){ + return myFullName; + } + + public void setMyName(String fullName){ + myFullName = fullName; + } + + //overriding the toString() method + @Override + public String toString() + { + return ("Hi my Name is: " + getMyName() + " and I am " + getMyAge() + " and my ID is: " + getMyId()); + } + +} +``` + + +#### Main Class + +```java +import java.util.*; +public class RunnerClass{ + public static void main(String [] args){ + EncapsulatingThis encapsObj = new EncapsulatingThis(); + encapsObj.setMyName("Omar"); + encapsObj.setMyAge(27); + encapsObj.setMyId("165X70B15D"); + + System.out.println(encapsObj.toString()); + } +} +``` \ No newline at end of file From 2ea09fd929e447aebacde36715a25048565ef054 Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Fri, 10 Sep 2021 11:48:04 +0000 Subject: [PATCH 03/24] Maven And Fibonacci Stuff --- Dynamic_Pro/{ => Fibonacci}/Fib.class | Bin Dynamic_Pro/{ => Fibonacci}/Fib.java | 0 Dynamic_Pro/README.md | 46 ++++ Maven/README.md | 301 ++++++++++++++++++++++++++ MustKnow/README.md | 58 ++++- 5 files changed, 399 insertions(+), 6 deletions(-) rename Dynamic_Pro/{ => Fibonacci}/Fib.class (100%) rename Dynamic_Pro/{ => Fibonacci}/Fib.java (100%) create mode 100644 Maven/README.md diff --git a/Dynamic_Pro/Fib.class b/Dynamic_Pro/Fibonacci/Fib.class similarity index 100% rename from Dynamic_Pro/Fib.class rename to Dynamic_Pro/Fibonacci/Fib.class diff --git a/Dynamic_Pro/Fib.java b/Dynamic_Pro/Fibonacci/Fib.java similarity index 100% rename from Dynamic_Pro/Fib.java rename to Dynamic_Pro/Fibonacci/Fib.java diff --git a/Dynamic_Pro/README.md b/Dynamic_Pro/README.md index 423adf3..db9496e 100644 --- a/Dynamic_Pro/README.md +++ b/Dynamic_Pro/README.md @@ -1 +1,47 @@ ### Dynamic Programming + + + +#### Fibonacci Algorithm + +- A Tree like data structure +- Any computation I made within the tree that I plug into the formula ... +- I shouldn't have to compute again thanks to memoization it stores the value +- in an object and spits it out whenever there is a call to it +- I store the answer within the memo and caches that result +- My key is the nth number in the fibonacci sequence +- My value is the value i.e. output +- When making recursive calls, thanks to memoization, it outputs a stored value + - and doesn't have to travel through any further subtrees +- So memoizing my fib function ends up reducing the number of recursive calls I make + +##### Runtime Complexity + +- Memoizing my algo I see a linear functional call pattern +- i.e. I have n node and that's why the runtime complexity is O(n) +- where n is the top level call + +##### Space Time Complexity + +- O(n) + + +#### Grid Traveler + +- You want to travel +- You start at the top left corner and your goal is to end in the bottom right corner +- You can only go down or to the right +- You CANNOT move up or left or diagonally +- Find the # of different ways you can travel +- gridTravelTo(2,3) means how many different ways you can travel +- ...from the top left to bottom right in a 2x3(2 rows by 3 columns) + - 3 dif ways: + - right, right, down + - right,down, right, + - down, right, right +- gridTravelTo(1) means do nothing because you are already there +- gridTravelTo(0,1) means 0 rows and 1 column i.e. the grid is empty +- gridTravelTo(1,0) means 1 row and 0 columns i.e. the grid is empty +- gridTravelTo(8,0) means 8 rows and 0 columns i.e. the grid is empty +- gridTravelTo(0,0) means 0 rows and 0 columns i.e. the grid is empty +- base case: if one of your dimensions is empty then there is no grid diff --git a/Maven/README.md b/Maven/README.md new file mode 100644 index 0000000..9f232f8 --- /dev/null +++ b/Maven/README.md @@ -0,0 +1,301 @@ +## Maven + +- PM tool for JVM Languages + +- Used To Perform Major Tasks: + - Build Your Source Code + + - Testing Your Code + + - Packaging Your Code(JAR, WAR, EAR) + + - Generate Java docs + + - Dependency Management + + - Handling, Versioning Your Artifacts + + +### How To Install: + + - Head over to: https://maven.apache.org/download.cgi + - Download the Binary Zip Archive + - Extract It + +### 2- Create an environment variable in your system name it M2_HOME + + - This is where Other SW and libraries look for the Maven Installation + - Give it a path in the bin folder + +### Checking if the installation is successful + +```bash +mvn --version +``` + +### File Structure + +``` +├── /my-project-demo + ├── /.idea + ├── /src + ├── /main + ├── /java + └── /resources + ├── /test + └── /java + ├── /target + └── pom.xml +├── /External Libraries +└── /Scratches and Consoles +``` + +- All the static files go in our resources folder +- e.g. Property Files, or any file we need to read from(xml, csv,html, css, js) +- test file I store all my unit tests and integration tests +- pom.xml holds all the metadata of my Application i.e. project dependencies +- target folder holds all the java compiled class files + + +### Creating A Project + + - Give it an artifact id(this is usually the name of your project) e.g. my-project-demo + - Give it group Id(this is usually the name of your company id in reverse order i.e. com.herokuapp.omarbelkady) + - Give it a version number e.g. 1.0-SNAPSHOT + + +### 3rd Party JAR files i.e. Dependencies + +- External Libraries are called "dependencies" +- Maven provides me with functionality on how to manage my dependencies +- ...thanks to the pom.xml file + + +### Life Without Maven + +- I have to manually download the JAR files from the internet +- then I add them one by one + + +### Dependency Section Thanks To Maven + +- Maven provides me with a dependency section where I can specify the info of the JAR I require in my project + - artifactid + - groupid + - version +- Maven will then automatically download these dependency specified, from the internet and load them into my project +- Load each dependency in a "dependency" tag +- And all your depenency tags should be in between 1 dependencies tag + +< dependencies > + < dependencyA > + + < /dependencyA > + + < dependencyB > + + < /dependencyB > +< dependencies > + +- To add a dependency go to https://www.mvnrepository.com/ + + +- Click on the Maven Icon to force IntelliJ to download the dependencies you have specified + + +### Transitive Dependencies + +- Dependencies of my dependencies + + +``` +├── /my-project-demo + ├── /.idea + ├── /src + ├── /main + ├── /java + └── /resources + ├── /test + └── /java + ├── /target + └── pom.xml +├── /External Libraries +└── /Scratches_and_Consoles +``` + +- All the static files go in our resources folder +- e.g. Property Files, or any file we need to read from(xml, csv,html, css, js) +- test file I store all my unit tests and integration tests +- pom.xml holds all the metadata of my Application i.e. project dependencies +- target folder holds all the java compiled class files + +### Maven Dependency +- Can be categorized into two categories: + - Snapshot Dependency + - This dependency was created when the software was in active development + - Unstable + - Release Dependency: + - This dependency was created after the software was developed and is ready to be released i.e. ready to be deployed for production + - Stable + +- In all, when I am developing the software I use the snapshot versions for the dependencies. When the software is released, I use the release versions + +--- +### Dependency Scopes + +- enables me to control the visibility of a Maven depenendency +- 4 types: +1. **Compile**: made available at compile time within classpath [default scope] +2. **Provided**: dependency provided at runtime by JDK or webserver, e.g. Servlet API dependency. The web server which is running my project provides me with the java servlet-api during runtime. This means that the dependency will be available in the class path of the project but will not be packaged in the JAR file nor the WAR file +3. **Runtime**: dependency provided ONLY at runtime and NOT at compile time e.g. MySQL JDBC connector dependency. I mark the dependency as runtime to make sure I do not use the MySQL JDBC classes in my code instead of standard jdbc api +4. **Tests**: dependency only available at the time of writing and running my unit tests e.g. junit, spring-boot-starter-test +5. **System**: the path to the JAR should be specified manually using the < systemPath > tag. The only restriction is that I must specify the exact path of where to locate this dependency within my system. + +### Repositories +- a special directory called a **repository** is the location where Maven stores my dependencies +- Local Repository[directory/folder in your machine] +- Remote Repository[Maven Website] where I can download the Maven dependencies +- If a dependency I specified in my pom is not in my local repository it goes ahead and connects to the remote repository and downloads the remote repository and stores the dependency within my local repository + +##### How To Define A Repository within my POM always after my closing dependency tag +```xml + + + my-internal-website + https://myserver/repo + + +``` + + +### Build Lifecycle Within Maven + +- How Does Maven Build Our Projects? + 1. default + 2. clean + 3. site + +#### Default Lifecycle Build Step Phases +1. validate + - Makes sure pom.xml is validated or not validated +2. compile + - Compiles my source code +3. test + - Runs the unit tests in my project +4. package + - Packages the source code into an artifact +5. integration-test + - Executes the integration tests +6. verify + - Verifies the results of the integrations tests +7. install + - Installs the newly created package files(JAR or any other artifact) within my local repository + - Maven +8. deploy + - Deploy the newly created package to the remote repository + - If the newly created package is configured in the pom.xml file it will deploy the new package into the remote repository + + +### Command +```java +mvn clean install +``` + +- This command compiles the source code +- Runs the unit tests +- Creates the JAR file +- Install the JAR file into your local repository + +### Site Step + +- generate Java documentation that is present in my project + + +### Plugins and Goals + +- To be able to execute the different lifecyle phases, Maven provides me with different plugins in order for me to perform each task in the lifecycle +- Every plugin has a relationship to a goal which is linked to the lifecycle phase(e.g. compile) +- To declare a plugin simple place in between a **plugin** tag that is within the **plugins** tag +- Any plugin I want to define must be within the build tag +- The build tag will usually be right below the dependencies section + +```xml + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + + +``` + +- The plugin above is in charge of compiling any test files or source files I have within my project. This is familiar to running +```java +javac nameofclass.java +``` + + +#### To trigger the compile lifecycle phase +```java +mvn compiler:compile +``` + +### Maven tab⇒ Plugin section ⇒ Hit Expand ⇒ Click on Compile Goal + +- Compilation fails +- Java compiler of Maven within IntelliJ is configured to Java version 1.X +- To fix: +      0. Go to your pom.xml +      1. Head to build section +      2. Plugins ⇒ plugin +      3. Configuration Tag +      4. Change the source & target properties to the java version installed on your machine + +### Maven Install Plugin + +- This plugin is used to run the install lifecycle phase within the maven build lifecycle +1. Compiles My Source Code +2. Runs Our Unit Tests +3. Package The Cource Code into an Artifact +4. Installs The Artifact Within My Local Repository + + +### Maven Deploy Plugin + +- Self-explanatory plugin +- runs all the phases which are part of the install phase +- deploys the created artifact to the remote repository +0. To deploy the artifact to the remote repo you have to specify the remote repo details within your pom +1. Create a tag right above your dependencies tag and give it a name of **distributionManagement** +2. Within the distributionManagement tag create a tag named **repository** and place the information of your repository there +3. To uniquely identify a repository I specify the **id**, **name** and **url** +4. Run the command below to deploy your plugin + +```java +mvn clean deploy +``` + +### Maven Profiles + +- Profiles can be used within maven to create customized build configurations within my project +- I can customize the behavior of a build based upon specific conditions +- e.g. I can skip the test execution due to the fact that my build process may take a long time +- I create a profile that will skip the test execution phase + +##### How To Create + +- Right below your build tag create a **profiles** tag + +- Within your profiles tag create a **profile** tag I give it an: + - *id* + - *properties* + +- After creating a profile for the above example Maven will make sure to skip the test execution + +- I head over to the terminal and run the following command: +- -P flag indicates the id of the profile +```java +mvn -Pskip-tests clean install +``` \ No newline at end of file diff --git a/MustKnow/README.md b/MustKnow/README.md index e92d1da..501a14d 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -51,6 +51,8 @@ - LIFO/FILO - Dinner Plates - When items are pushed they are placed on the top +- Only can push/pop an element from this DS at one end only +- Requires You To Have One Reference Pointer i.e. "TOP" 2. Linked List @@ -76,8 +78,9 @@ - People waiting in line in the Movie Theatre - Linear - FIFO -- Pushes To The End -- Pops From The Front +- Has Side A and Side B +- Pushes On Side A i.e. Enqueue +- Pops On Side B i.e. Dequeue - Ordered Collection - Operations: add(), remove() - Part of the java.util.* package @@ -89,6 +92,7 @@ - Element & Remove Method Throws NoSuchElementException if the queue is empty - Poll Method removes the head of the queue and returns it - if the queue is empty the poll method call returns null +- Requires You To Have Two Reference Pointers i.e. "FRONT" & "REAR" @@ -100,6 +104,7 @@ - Cannot store null as a key nor as a value - First parameter within your Hash Table declaration is the data type of the key - Second parameter within your Hash Table declaration is the data type of the value +- Restaurant Pager i.e. you give your name and they assign a number to you when a seat frees up you get an empty table 6. Trees @@ -127,19 +132,22 @@ - no duplicate vals - val on the left most subtree of the node is always smaller than the val on its immediate right - Node on the left is always less than the node on the right +- Linux File Structure +- Classification Tree in Biology 7. Heap - Special Tree Based DS - Binary Tree -- Patients Being Admitted to the Hospital - - Patients with life-threatning situation get taken care of first - - Patients that don't have threatening situation wait in line - Parent node makes a comparison with its child nodes and are arranged accordingly - Two Scenarios: - Key present at the root node is the greatest among all of its children and successors - Key present at the root node is the smallest among all of its children and successors +- Patients Being Admitted to the Hospital + - Patients with life-threatning situation get taken care of first + - Patients that don't have threatening situation wait in line + 8. Graphs @@ -153,7 +161,7 @@ - Undirected - Simple Graph: Each edge connects to two different vertices whereby no two edges connect to the same group of vertices - Multigraph: An edge can connect to the same pair of vertices -- +- Google Maps Usage of Connecting Roads i.e. vertex therefore, I use an algo to determine the shortest path between vertex A & B @@ -209,6 +217,44 @@ But actually the runtime is O(n) because when we calculate runtime we drop the c - In the worst case scenario, if the number I am looking for is at the end of the array then I have to inspect one index at a time - The more items I have the longer the operation will take +```java +import java.util.*; + +public class LinSearch{ + + public static void main(String [] args){ + int [] myArr = {18, 34, 65, 92, 32, 94, 15, 10, 16, 8, 26}; + int elem,elemExistsTimes=0; + Scanner sc = new Scanner(System.in); + System.out.println("Enter The Element You Are Hunting For: "); + elem = sc.nextInt(); + + for(int x = 0; x<10; x++){ + if(myArr[x] == elem){ + elemExistsTimes= x + 1; + break; + } + + else{ + elemExistsTimes = 0; + } + } + + if(elemExistsTimes != 0) + { + System.out.println("I found the item at location: "+elemExistsTimes); + } + + else{ + System.out.println("Not Found Man"); + } + + } + +} +``` + + ### Example: Binary Search 1. We start by searching in the middle of the array. Is the item in the middle smaller or bigger than the elem I am searching for? From 07fb66f53565618242376d3f95be1c0ab4006fbf Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Thu, 16 Sep 2021 10:41:44 +0000 Subject: [PATCH 04/24] Different types of Algorithms --- MustKnow/AlgoTypes/README.md | 33 +++++++++++++++++++++++++++++++++ MustKnow/README.md | 15 +++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 MustKnow/AlgoTypes/README.md diff --git a/MustKnow/AlgoTypes/README.md b/MustKnow/AlgoTypes/README.md new file mode 100644 index 0000000..b2bc520 --- /dev/null +++ b/MustKnow/AlgoTypes/README.md @@ -0,0 +1,33 @@ +## Types of Algorithms + +- Backtracking Algorithm + - recursive problem solving approach + - I come up with N number of solution + - If the first solution does not solve my problem I go back + - I try the second solution and so forth + - I remove the first solution + - Playing soduku you find 4 is in the row, column and box therefore you backtrack and check 5 + - Trying to find your way out in a maze + +- Brute Force Algorithm + - Check every possible solution for the problem to be solved + +- Divide And Conquer Algorithm + - Divide the problem into sub-problems and solve each sub-problem independently + - i.e. Binary Search + +- Dynamic Programming Algorithm + - function X generates the output Y + - I store the result of Y and use it in function D + +- Greedy Algorithm + - Always chooses the best solution + - Solution is built piece by piece + - The subsequent piece chosen by the algorithm is usually the most obvious + - Examples in Various DS: + +- Recursive Algorithm + - an algorithm which calls itself + - i.e. factorial + + diff --git a/MustKnow/README.md b/MustKnow/README.md index 501a14d..e4b2533 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -53,6 +53,13 @@ - When items are pushed they are placed on the top - Only can push/pop an element from this DS at one end only - Requires You To Have One Reference Pointer i.e. "TOP" +- Applications: + - Redoing/Undoing stuff within your application + - Memory Management +- Allows you to fully control how memory is allocated and deallocated +- Pitfalls of Stack: + - Cannot access a random element + - Not able to be scaled i.e. not flexible 2. Linked List @@ -131,6 +138,14 @@ - Arranged in some order - no duplicate vals - val on the left most subtree of the node is always smaller than the val on its immediate right + - Btree + - every btree has an order i.e. the number of levels + - A leaf in a btree the i.e. the parent to the last level in a btree(i.e. child nodes) + - ...must always have more nodes than the child so as the keys(1 key... 2 child nodes, 2 keys, 3 child nodes) + - the keys cannot be larger than the leaf nodes + - All leaf nodes are at the same level + - whenever one of the rules is violated, i have to rebalance and restructure my tree + - Root node must have a minimum of two children - Node on the left is always less than the node on the right - Linux File Structure - Classification Tree in Biology From 2fca4a7a74e87facfb0bc5e9932084425afebf43 Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Thu, 16 Sep 2021 19:52:20 +0000 Subject: [PATCH 05/24] More Info about the most important DS and implementations of each DS --- MustKnow/Main.java | 30 ------ MustKnow/README.md | 221 +++++++++++++++++++++++++++++++-------------- 2 files changed, 151 insertions(+), 100 deletions(-) delete mode 100644 MustKnow/Main.java diff --git a/MustKnow/Main.java b/MustKnow/Main.java deleted file mode 100644 index 8b15607..0000000 --- a/MustKnow/Main.java +++ /dev/null @@ -1,30 +0,0 @@ -public class Main{ - - public void logLn(Object o){ - System.out.println(o); - } - - public void log(Object o){ - System.out.print(o); - } - - public void printArr(int [] arr){ - logLn(arr[0]); //has one operation and takes constant time to run ===> O(1) - logLn(arr[0]); //has two operation but still O(1) - } - - /* - small small will run fast but as the sample size increase e.g. 1,000,000 items then you will have it running slowly - - cost of algo: linear and is directly proportional to the size of the input therefore the runtime complexity O(n) - */ - public void logging(int [] nums){ - for(int i=0; i myStack= new Stack(); +``` + + 2. Linked List - Sequential Order @@ -71,6 +78,17 @@ - A Node is composed of data and a pointer - Last node has a null pointer i.e. the pointer is used but doesn't point to anything - Folders on your computer(i.e. last folder is null because it has no folder within it) +- Node[0] = Head +- Node[n-1] = Tail + + +```java +import java.util.*; +/* +How To Declare: +LinkedListnameOfLL = new LinkedList() */ +LinkedList mylist=new LinkedList(); +``` 3. Array @@ -79,8 +97,62 @@ - All the elements in the DS must be of the same type - Muffin/Egg Tray - Rectangular in shape +- Good For Storing Multiple items in it +- Address in Memory increases by the size of the datatype you store +- I.e. say I have 6 ints location in memory of the first is 104 second is 108 third is 112 +- because an int = 4 bytes that's why you increment by 4 +- Searching an Array by index is super fast, supply to an idx to the array and it will be super fast to locate it +- Calc of Mem Address Runtime is: O(1) +- Downsides: Static, failure to know size if too large: waste memory too small: array gets filled quickly +- And If I fill it up quickly I must create a 2nd array and copy the elements of the first array into the second + +- Cost of Lookup: O(1) +- Cost of Insertion: O(n) +- Cost Of Removal: O(n) + +1. Best Case: I remove from the end of the array and I delete that index +2. Worst Case: I remove from the beginning of the array and shift all the items in the right one index less to fill +3. Therefore, for the worst case it is O(n) when removing an item in the array + -4. Queues +- Dynamic Array DS in Java: ArrayList +- Grows by 50% of its size everytime I add sth to it +- synchronous aka one 7652626 thread at a time + +#### Declaring an array in Java +```java +import java.util.*; +public class Arr{ + public static void main(String [] args){ + /* + 1. declare the data type of the array + 2. indicate that I want an array data structure by using the brackets.. MUST BE EMPtY + 3. give it a name + 4. use the new operator to allocate memory for the array + 5. repeat the data type of the array + 6. indicate the size of the array + + */ + int [] myArr = new int[7]; + //this output the memory location of the array + //System.out.println(myArr); + + /* + if you know the vals: + + */ + int [] myArrTw = {7, 6, 5, 2, 6, 2, 6} + + //proper way to output + System.out.println(Arrays.toString(myArr)) + } +} +``` + +4. Vector: Grows by 100% of its size everytime I add sth to it... asynchronous aka multiple threads at a time + + +5. Queues - People waiting in line in the Movie Theatre - Linear @@ -101,7 +173,17 @@ - if the queue is empty the poll method call returns null - Requires You To Have Two Reference Pointers i.e. "FRONT" & "REAR" +```java +//How To Declare a Priority Queue of type String +import java.util.*; + +public class queueimpl{ + public static void main(String [] args){ + Queue mypq = new PriorityQueue<>(); + } +} +``` 5. Hash Table @@ -113,6 +195,39 @@ - Second parameter within your Hash Table declaration is the data type of the value - Restaurant Pager i.e. you give your name and they assign a number to you when a seat frees up you get an empty table +```java +/* +How To Declare a Hash Table of type: +- Integer for the key +- String for the value +*/ + +import java.util.*; + +public class HashTable{ + public static void main(String [] args){ + Integer mystr; + Hashtable myhashtable = new Hashtable(); + myhashtable.put(1,"Blue"); + myhashtable.put(2,"Red"); + myhashtable.put(3,"Yellow"); + + //Storage of the keys in the HashTable Set + Set keys = myhashtable.keySet(); + + Iterator itr = keys.iterator(); + + + while (itr.hasNext()) { + // Getting Key + mystr = itr.next(); + System.out.println("Key: "+mystr+"\nValue: "+myhashtable.get(mystr)); + } + } +} + +``` + 6. Trees - Hierarchical Structure where data is org in a hierarchy and everything is linked together @@ -146,6 +261,7 @@ - All leaf nodes are at the same level - whenever one of the rules is violated, i have to rebalance and restructure my tree - Root node must have a minimum of two children + - Node on the left is always less than the node on the right - Linux File Structure - Classification Tree in Biology @@ -269,6 +385,40 @@ public class LinSearch{ } ``` +```java +public class Main{ + + public void logLn(Object o){ + System.out.println(o); + } + + public void log(Object o){ + System.out.print(o); + } + + public void printArr(int [] arr){ + logLn(arr[0]); //has one operation and takes constant time to run ===> O(1) + logLn(arr[0]); //has two operation but still O(1) + } + + /* + small small will run fast but as the sample size increase e.g. 1,000,000 items then you will have it running slowly + + cost of algo: linear and is directly proportional to the size of the input therefore the runtime complexity O(n) + */ + public void logging(int [] nums){ + for(int i=0; i; -//where E is the generic key type -//Integer keyword is the wrapper class around the native/primitive type int -``` -2. Vector: Grows by 100% of its size everytime I add sth to it... asynchronous aka multiple threads at a time - - -### LinkedList - -- We use a LL when wanting to store an object in sequential||7652626 order -- LinkedList are better than arrays because they can grow/shrink auto -- It consists of a group of nodes in seq order. Every node has two pieces of data: - 1. value - 2. address of the next node in the list -- AKA every node (points to)/references the next node in the list -- Node[0] = Head -- Node[n-1] = Tail #### Searching A LL value Time C From d766cd87ba4f0d8f5321de23f16bcd2935e37471 Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Fri, 17 Sep 2021 12:20:32 +0000 Subject: [PATCH 06/24] Btree, B* tree and AVL tree info --- MustKnow/README.md | 180 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 171 insertions(+), 9 deletions(-) diff --git a/MustKnow/README.md b/MustKnow/README.md index 4e69088..10b8084 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -232,12 +232,13 @@ public class HashTable{ - Hierarchical Structure where data is org in a hierarchy and everything is linked together - Not the same as linked list because LL is linear +- Log(n) runtime complexity where n is the number of levels - Trees are faster to access than a LL because they are non-linear - Node: person who holds our data - Child Node: person who has a parent - Leaf Node: person who has no children - Edge: person who connects two nodes -- Root: Person who is the topmost node +- Root: person who is the topmost node - Node Height: # of edges from the node to the deepest leaf node - Node Depth: # of edges from the root to the node - Tree Height: Depth of the deepest node @@ -245,27 +246,188 @@ public class HashTable{ - Leaves: Person who has no children - Use when you want to store items in a hierarchial fashion - Quicker to access/search than a LL but slower than an Array - - Binary Tree + - AVL Tree: + - Self-balanced trees + - Searching, Inserting, Deleting in the worst case is logarithmic time complexity + - Balance factor is determined by the height of the right subtree tree + - ... minus the height of the left subtree + - I have a height of 1 in the left subtree ... I have a height of 1 in the right subtree + - balance factor = 0 + - Objective: make sure every node is balanced i.e. bf = -1,0,1 + - all nodes must be balanced ... if one node is not balanced the whole tree is unbalanced + - balance factor in relation to its neighboring subtree + - -1 means the right subtree is greater than the left subtree + - 1 means the left subtree is greater than the right subtree + - 0 means the left subtree and right subtree have equal lengths + - LL rotation means I inserted a node in the left subtree of the left subtree of A + - LR rotation means I inserted a node in the right subtree of the left subtree of A + - RR rotation means I inserted a node in the right subtree of the right subtree of A + - RL rotation means I inserted a node in the left subtree of the right subtree of A + - Binary Tree - Can Have 0,1,2 nodes + - right child is always larger & left child is always smaller - Binary Search Tree: - Used for sorting, getting and searching data - Non-linear - Arranged in some order - no duplicate vals - val on the left most subtree of the node is always smaller than the val on its immediate right - - Btree - - every btree has an order i.e. the number of levels - - A leaf in a btree the i.e. the parent to the last level in a btree(i.e. child nodes) + - B-tree + - every b-tree has an order i.e. the number of levels + - Root node must have a minimum of two children + - A leaf in a b-tree the i.e. the parent to the last level in a b-tree(i.e. child nodes) - ...must always have more nodes than the child so as the keys(1 key... 2 child nodes, 2 keys, 3 child nodes) - the keys cannot be larger than the leaf nodes - - All leaf nodes are at the same level - - whenever one of the rules is violated, i have to rebalance and restructure my tree - - Root node must have a minimum of two children - + - All leaf nodes must be at the same level + - whenever you delete a leaf node all you have to do is do a rotation to the values + - if you delete a middle value you must do rebalancing + - whenever one of the rules is violated, I have to rebalance and restructure my tree + - ... by shifting the center value + - once you access one element in the block you have access to all the elements in the block + - B*-tree + - Values in the middle are not essentially referred to as value + - they are just navigation values(go left, go down, go right) + - the parent is always the largest value of its left child subtree + - the number of values I am allowed to store at the leaf level is determined by a parameter k* + - so if k* = 2 that means I am allowed to have a max of 2k* elements at the leaf level + - ...and a minimum of 2 + - m is the order of the tree i.e. the number of the levels + - B* trees have a smaller height than Btrees because all the data is stored in the leaf level - Node on the left is always less than the node on the right - Linux File Structure - Classification Tree in Biology +- Runtime of Operations Performed on A Balanced Tree + +| Operation | Runtime | +| ----------- | ----------- | +| Inserting | log(n) | +| Deleting | log(n) | +| Rebalancing | log(n) | +| Searching | log(n) | +#### 4 Cases of AVL Trees of Balance Factors + +- We will never have to make more rotations than the number of levels +- Number of level is log2(n) + +##### Case A +``` + A(-2) + / \ + B(-1) C(0) height of 3 vs height of 1 + / \ ∴ BF=-2 + D(-1) E(0) + / +F(0) +``` + +- Balance Factor of: -2 +- The left most subtree has a height that is 2 levels greater than the right subtree +- Perform a single right rotation + +``` + B(0) + / \ + D(0) A(0) + / / \ + F(0) E(0) C(0) + +``` +
+
+ + +##### Case B +``` + A(-2) + / \ + B(1) C(0) + / \ +D(0) E(1) + \ + F(0) +``` +
+
+ +- Perform a single left rotation on the subtree +- Make E the root node of the left subtree +- Make B the left child node of E +- Make F the right child node of E +``` + A(-2) + / \ + E C(0) + / \ + B F + / + D +``` + + + + +##### Case C + +``` + A(-2) + / \ + B(1) C(0) + / \ + D(0) E(1) + \ + F(0) +``` + +- Perform a single left rotation +- Make A the root node of the left subtree +- Make E the root node of the right subtree +- Make F the child node of E +- Make B the left child node of A +- Make D the right child node of A + +``` + C(0) + / \ + A(0) E(1) + / \ \ +B(0) D(0) F(0) + +``` + + + + +##### Case D + +``` + A + / \ + B C + / \ + D E + / + F +``` + +1. Perform a single right rotation now we are in Case C +2. That means To Solve Case D I perform a double right-left rotation + +``` + A + / \ + B D + / \ + F C + \ + E +``` + + + + + + 7. Heap From 87ae3ced315a0da054dfb7825b12d05788f81d96 Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Wed, 22 Sep 2021 11:56:28 +0000 Subject: [PATCH 07/24] More Did Some Fixing To Interfaces README, more info about Maps, Maven, and Most Used DS in Java --- Interfaces/README.md | 28 ++++-- Maps/README.md | 202 +++++++++++++++++++++++++++---------------- Maven/README.md | 73 +++++++++------- MustKnow/README.md | 7 +- README.md | 3 +- 5 files changed, 197 insertions(+), 116 deletions(-) diff --git a/Interfaces/README.md b/Interfaces/README.md index 38bad94..b6e0cd5 100644 --- a/Interfaces/README.md +++ b/Interfaces/README.md @@ -1,8 +1,20 @@ -Interfaces are a little bit similar in concept to Inheritance. An interface defines behavior. So we have an object and right after it is a biiiig barrier, -this barrier is the interface. The barrier serves as to limit on how we interact with the object. We use an interface to work with an object. -When we program we tell the class that the object has to meet the requirements imposed by interface. Say I have a class Dog. The dog has the following behaviors -which are: walk(), woof(), eat(). We can define the behaviors thanks to interfaces. All in all, interfaces define behavior/characteristics that -classes need to implement. We can define how an animal eats/walks within the interface. Then the class can implement the interface. -A class does not extend an interface, it implements it. Whenever we work with multiple classes as a team of developer. We must believe that every developer will do -their part to implements the works of the interface of the designated class they are working on. Say for example, a class that implements the interface -walking well then we can trust that class that it can walk properly and not limp. An interface can extend interfaces but cannot extend/implement the class. +### Interfaces + +
+ +- Similar in concept to Inheritance. +- defines behavior. So we have an object and right after it is a biiiig barrier, this barrier is the interface +- The barrier serves as to limit on how we interact with the object. We use an interface to work with an object. + +- I tell the class that the object has to meet the requirements imposed by interface. Say I have a class Dog. The dog has the following behaviors which are: + - walk() + - woof() + - eat() +- We can define the behaviors thanks to interfaces. All in all, interfaces define behavior/characteristics that classes need to implement. +- We can define how an animal eats/walks within the interface. Then the class can implement the interface. + +- A class does not extend an interface, it implements it. Whenever we work with multiple classes as a team of developer. We must believe that every developer will do their part to implements the works of the interface of the designated class they are working on. + +- Say for example, a class that implements the interface walking well then we can trust that class that it can walk properly and not limp. + +- An interface can extend interfaces but cannot extend/implement the class. \ No newline at end of file diff --git a/Maps/README.md b/Maps/README.md index c9beb03..c80f71e 100644 --- a/Maps/README.md +++ b/Maps/README.md @@ -1,89 +1,145 @@ -### A map is an object that maps keys and values -### A map cannot contain the same keys -### A map is similar to a dictionary in Python and a Key-Value pair in JS -### Each key must be unique within a map -### Maps are very important to know when dealing with Abstraction in OOP -### Java has three types of maps: HashMap , TreeMap and and LinkedHashMap + +## Maps + + + +- A map is an object that maps keys and values + +- Cannot contain the same keys + +- similar to a dictionary in Python and a Key-Value pair in JS + +- Keys must be unique within a map + +- Maps are very important to know when dealing with Abstraction in OOP + + + +### Java has three types of maps: HashMap , TreeMap and and LinkedHashMap + + + ### Ordering: - 1- HashMap:Key Order - 2- TreeMap: Key Order - 3- LinkedHasMap: Reverse Insertion Order FIFO - -### HashMap: - ``` - Key Order - ``` + + + +
+ +1. HashMap + +- Check if Empty: isEmpty() +- Remove a particular key: .remove() +- Does Not Maintain Insertion Order +- Holds A Value Depending on A Key +- Only Holds Unique Elements +- Lookup & Insertion: O(1) +- Only allowed to store 1 Null Key +- Allowed to store multiple null values + +2. TreeMap + +- Key Order +- Only Holds Unique Elements +- Lookup & Insertion: O(log(n)) +- Cannot Store Null as a key +- Allowed to store multiple null values +- Maintains Ascending Orders + +3. LinkedHasMap: + +- Only Holds Unique Elements +- Allowed to store only one null key +- Allowed to store multiple null values. +- Maintains Insertion Order +- FIFO + + + ```java + import java.util.*; -public class HashMap +public class HashMap { - public static void main(String args[]) - { - //HashMap Declaration - //HashMap
nameOfHashMap= new HashMap
(); - HashMap myHashMap=new HashMap();//Creating HashMap. - - myHashMap.put(2,"Papaya"); //Putting elements in Map. - myHashMap.put(3,"Mango"); - myHashMap.put(1,"Apple"); - myHashMap.put(4,"Lemon"); - - System.out.println(myHashMap); - } - - //Output: {1=Apple, 2=Papaya, 3=Mango, 4=Lemon} meaning Key Order + public static void main(String args[]) + { + //HashMap Declaration + //HashMap
nameOfHashMap= new HashMap
(); + + HashMap myHashMap=new HashMap();//Creating HashMap. + + myHashMap.put(2,"Papaya"); //Putting elements in Map. + + myHashMap.put(3,"Mango"); + + myHashMap.put(1,"Apple"); + + myHashMap.put(4,"Lemon"); + + System.out.println(myHashMap); + } + +//Output: {1=Apple, 2=Papaya, 3=Mango, 4=Lemon} meaning Key Order } + ``` + ### TreeMap + + ```java import java.util.*; -public class Main + +public class Main { - public static void main(String args[]) - { - //Tree Declaration - //TreeMap
nameOfTreeMap= new HashMap
(); - TreeMap myTreeMap=new TreeMap();//Creating HashMap. - - myTreeMap.put(2,"Papaya"); //Putting elements in Map. - myTreeMap.put(3,"Mango"); - myTreeMap.put(1,"Apple"); - myTreeMap.put(4,"Lemon"); - - System.out.println(myTreeMap); - } - - //Output: {1=Apple, 2=Papaya, 3=Mango, 4=Lemon} - //meaning Key Order + public static void main(String args[]) + { + //Tree Declaration + + //TreeMap
nameOfTreeMap= new HashMap
(); + + TreeMap myTreeMap=new TreeMap();//Creating HashMap. + + myTreeMap.put(2,"Papaya"); //Putting elements in Map. + + myTreeMap.put(3,"Mango"); + + myTreeMap.put(1,"Apple"); + + myTreeMap.put(4,"Lemon"); + + System.out.println(myTreeMap); } + +//Output: {1=Apple, 2=Papaya, 3=Mango, 4=Lemon} +//meaning Key Order +} +``` + - - - ``` -### LinkedHashMap - ``` - Ordered by Insertion FIFO - ``` - + ```java import java.util.*; -public class Main +public class Main { - public static void main(String args[]) - { - //LHM Declaration - //LinkedHashMap
nameOfLinkedHashMap= new LinkedHashMap
(); - LinkedHashMap myLHashMap=new LinkedHashMap();//Creating Linked HashMap. - - myLHashMap.put("MW","Calculus3"); //Putting elements in Map. - myLHashMap.put("MWF","OrgCh1"); - myLHashMap.put("T","DS"); - myLHashMap.put("F","Music"); - - System.out.println(myLHashMap); - } - - //Output: {MW=Calculus3, MWF=OrgCh1, T=DS, F=Music} - //meaning Reverse Insertion Order FIFO + public static void main(String args[]) + { + //LHM Declaration + + //LinkedHashMap
nameOfLinkedHashMap= new LinkedHashMap
(); + + LinkedHashMap myLHashMap=newLinkedHashMap();//Creating Linked HashMap. + + myLHashMap.put("MW","Calculus3"); //Putting elements in Map. + + myLHashMap.put("MWF","OrgCh1"); + + myLHashMap.put("T","DS"); + + myLHashMap.put("F","Music"); + + System.out.println(myLHashMap); + } + //Output: {MW=Calculus3, MWF=OrgCh1, T=DS, F=Music} + //meaning Reverse Insertion Order FIFO } - ``` +``` \ No newline at end of file diff --git a/Maven/README.md b/Maven/README.md index 9f232f8..ef521d9 100644 --- a/Maven/README.md +++ b/Maven/README.md @@ -15,8 +15,7 @@ - Handling, Versioning Your Artifacts - -### How To Install: +### How To Install - Head over to: https://maven.apache.org/download.cgi - Download the Binary Zip Archive @@ -56,7 +55,6 @@ mvn --version - pom.xml holds all the metadata of my Application i.e. project dependencies - target folder holds all the java compiled class files - ### Creating A Project - Give it an artifact id(this is usually the name of your project) e.g. my-project-demo @@ -70,13 +68,11 @@ mvn --version - Maven provides me with functionality on how to manage my dependencies - ...thanks to the pom.xml file - ### Life Without Maven - I have to manually download the JAR files from the internet - then I add them one by one - ### Dependency Section Thanks To Maven - Maven provides me with a dependency section where I can specify the info of the JAR I require in my project @@ -87,27 +83,26 @@ mvn --version - Load each dependency in a "dependency" tag - And all your depenency tags should be in between 1 dependencies tag -< dependencies > - < dependencyA > +```xml + + - < /dependencyA > + - < dependencyB > + - < /dependencyB > -< dependencies > - -- To add a dependency go to https://www.mvnrepository.com/ + + +``` +- To add a dependency go to - Click on the Maven Icon to force IntelliJ to download the dependencies you have specified - -### Transitive Dependencies +### Transitive Dependencies - Dependencies of my dependencies - ``` ├── /my-project-demo ├── /.idea @@ -130,6 +125,7 @@ mvn --version - target folder holds all the java compiled class files ### Maven Dependency + - Can be categorized into two categories: - Snapshot Dependency - This dependency was created when the software was in active development @@ -141,23 +137,31 @@ mvn --version - In all, when I am developing the software I use the snapshot versions for the dependencies. When the software is released, I use the release versions --- + ### Dependency Scopes - enables me to control the visibility of a Maven depenendency -- 4 types: +- 5 types: + 1. **Compile**: made available at compile time within classpath [default scope] + 2. **Provided**: dependency provided at runtime by JDK or webserver, e.g. Servlet API dependency. The web server which is running my project provides me with the java servlet-api during runtime. This means that the dependency will be available in the class path of the project but will not be packaged in the JAR file nor the WAR file -3. **Runtime**: dependency provided ONLY at runtime and NOT at compile time e.g. MySQL JDBC connector dependency. I mark the dependency as runtime to make sure I do not use the MySQL JDBC classes in my code instead of standard jdbc api -4. **Tests**: dependency only available at the time of writing and running my unit tests e.g. junit, spring-boot-starter-test + +3. **Runtime**: dependency provided ONLY at runtime and NOT at compile time e.g. MySQL JDBC connector dependency. I mark the dependency as runtime to make sure I do not use the MySQL JDBC classes in my code instead of standard jdbc api + +4. **Tests**: dependency only available at the time of writing and running my unit tests e.g. junit, spring-boot-starter-test + 5. **System**: the path to the JAR should be specified manually using the < systemPath > tag. The only restriction is that I must specify the exact path of where to locate this dependency within my system. ### Repositories + - a special directory called a **repository** is the location where Maven stores my dependencies - Local Repository[directory/folder in your machine] - Remote Repository[Maven Website] where I can download the Maven dependencies - If a dependency I specified in my pom is not in my local repository it goes ahead and connects to the remote repository and downloads the remote repository and stores the dependency within my local repository -##### How To Define A Repository within my POM always after my closing dependency tag +#### How To Define A Repository within my POM always after my closing dependency tag + ```xml @@ -167,7 +171,6 @@ mvn --version ``` - ### Build Lifecycle Within Maven - How Does Maven Build Our Projects? @@ -176,6 +179,7 @@ mvn --version 3. site #### Default Lifecycle Build Step Phases + 1. validate - Makes sure pom.xml is validated or not validated 2. compile @@ -190,27 +194,26 @@ mvn --version - Verifies the results of the integrations tests 7. install - Installs the newly created package files(JAR or any other artifact) within my local repository - - Maven + - Maven 8. deploy - Deploy the newly created package to the remote repository - If the newly created package is configured in the pom.xml file it will deploy the new package into the remote repository - ### Command + ```java mvn clean install ``` - This command compiles the source code - Runs the unit tests -- Creates the JAR file +- Creates the JAR file - Install the JAR file into your local repository ### Site Step - generate Java documentation that is present in my project - ### Plugins and Goals - To be able to execute the different lifecyle phases, Maven provides me with different plugins in order for me to perform each task in the lifecycle @@ -232,12 +235,13 @@ mvn clean install ``` - The plugin above is in charge of compiling any test files or source files I have within my project. This is familiar to running + ```java javac nameofclass.java ``` - #### To trigger the compile lifecycle phase + ```java mvn compiler:compile ``` @@ -251,11 +255,12 @@ mvn compiler:compile      1. Head to build section      2. Plugins ⇒ plugin      3. Configuration Tag -      4. Change the source & target properties to the java version installed on your machine - -### Maven Install Plugin +      4. Change the source & target properties to the java version installed on your machine + +### Maven Install Plugin - This plugin is used to run the install lifecycle phase within the maven build lifecycle + 1. Compiles My Source Code 2. Runs Our Unit Tests 3. Package The Cource Code into an Artifact @@ -267,11 +272,12 @@ mvn compiler:compile - Self-explanatory plugin - runs all the phases which are part of the install phase - deploys the created artifact to the remote repository + 0. To deploy the artifact to the remote repo you have to specify the remote repo details within your pom 1. Create a tag right above your dependencies tag and give it a name of **distributionManagement** 2. Within the distributionManagement tag create a tag named **repository** and place the information of your repository there 3. To uniquely identify a repository I specify the **id**, **name** and **url** -4. Run the command below to deploy your plugin +4. Run the command below to deploy your plugin ```java mvn clean deploy @@ -284,9 +290,9 @@ mvn clean deploy - e.g. I can skip the test execution due to the fact that my build process may take a long time - I create a profile that will skip the test execution phase -##### How To Create +#### How To Create -- Right below your build tag create a **profiles** tag +- Right below your build tag create a **profiles** tag - Within your profiles tag create a **profile** tag I give it an: - *id* @@ -296,6 +302,7 @@ mvn clean deploy - I head over to the terminal and run the following command: - -P flag indicates the id of the profile + ```java mvn -Pskip-tests clean install -``` \ No newline at end of file +``` diff --git a/MustKnow/README.md b/MustKnow/README.md index 10b8084..35212d3 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -236,7 +236,7 @@ public class HashTable{ - Trees are faster to access than a LL because they are non-linear - Node: person who holds our data - Child Node: person who has a parent -- Leaf Node: person who has no children +- Leaf: person who has no children - Edge: person who connects two nodes - Root: person who is the topmost node - Node Height: # of edges from the node to the deepest leaf node @@ -446,12 +446,17 @@ B(0) D(0) F(0) - Finite set of vertices, nodes and edges. The edges are what connect one vertex with another - Graphs are connected in a network form +- Vertex: Circle +- Edge: Arrow - Non-linear - Nodes are the vertices(i.e. endpoints) - Edges are the lines/arcs that connect one node with another node - Two Types: - Directed - Undirected +- Traversing Algo Implementing A Graph: + - BFS + - DFS - Simple Graph: Each edge connects to two different vertices whereby no two edges connect to the same group of vertices - Multigraph: An edge can connect to the same pair of vertices - Google Maps Usage of Connecting Roads i.e. vertex therefore, I use an algo to determine the shortest path between vertex A & B diff --git a/README.md b/README.md index 04e7a6a..20850df 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,10 @@ public void theBestMethod() #### Primitive DS: 1. Integer 2. Float -3. Char` +3. Char 4. Pointers + #### Non-Primitive DS: 1. Arrays 2. List From e53cc78fb77614ddc692e9c2f63dc050b9c805bb Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Tue, 28 Sep 2021 00:11:37 +0000 Subject: [PATCH 08/24] The static keyword in Java + More Info on LHMap, HMap and TMap --- Maps/README.md | 25 +++++----------- STATIC/README.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 18 deletions(-) create mode 100644 STATIC/README.md diff --git a/Maps/README.md b/Maps/README.md index c80f71e..493c697 100644 --- a/Maps/README.md +++ b/Maps/README.md @@ -1,8 +1,6 @@ ## Maps - - - A map is an object that maps keys and values - Cannot contain the same keys @@ -13,15 +11,11 @@ - Maps are very important to know when dealing with Abstraction in OOP +- Java has three types of maps: HashMap, TreeMap and LinkedHashMap +
-### Java has three types of maps: HashMap , TreeMap and and LinkedHashMap - - - -### Ordering: - - +### Ordering
@@ -115,31 +109,26 @@ public class Main } ``` - - ```java import java.util.*; + public class Main { public static void main(String args[]) { - //LHM Declaration + //LHM Declaration //LinkedHashMap
nameOfLinkedHashMap= new LinkedHashMap
(); LinkedHashMap myLHashMap=newLinkedHashMap();//Creating Linked HashMap. myLHashMap.put("MW","Calculus3"); //Putting elements in Map. - myLHashMap.put("MWF","OrgCh1"); - myLHashMap.put("T","DS"); - myLHashMap.put("F","Music"); - + System.out.println(myLHashMap); } - //Output: {MW=Calculus3, MWF=OrgCh1, T=DS, F=Music} - //meaning Reverse Insertion Order FIFO + } ``` \ No newline at end of file diff --git a/STATIC/README.md b/STATIC/README.md new file mode 100644 index 0000000..dc38e49 --- /dev/null +++ b/STATIC/README.md @@ -0,0 +1,75 @@ +## Static Keyword In Java + + +- SUPER IMPORTANT +- Anything I label static means the class can access it directly + +- Instead of: + - Creating An Object + - THEN ACCESSING IT + +- I can: + - Create a variable to store data + - Create a static method + +```java +import java.util.*; + +public class User{ + private String _name; + private String _membership; + public static List administrators; +} +``` + +### Main Class + +```java +import java.util.*; + +public class Main{ + + public static void main(String [] args){ + User.administrators = new ArrayList(); + User.administrators.add(new User("Abraham")); + User.administrators.add(new User("DJ32")); + } +} +``` + + +
+ +### Static Methods + + + +- I access data members directly on the User class + +- System.out.println where **out** is a static data member of the System class + +- e.g. Whenever you want to read Data from a file You can associate it to a user + - Instead of creating a function I create a static method return a list + +- Example: + +```java +public class User{ + public static List administrators; + + public static void print_the_admins(){ + + /* + since List and print_the_admins are both static + I can omit User.administrators + + */ + //for(User j: User.administrators) + for(User j: administrators){ + + System.out.println(j.get_The_Names()) + } + } +} + +``` \ No newline at end of file From 443d31c18801594d3eed0db72f7b5cfd0746d370 Mon Sep 17 00:00:00 2001 From: Omar Belkady Date: Mon, 18 Apr 2022 22:03:35 +0000 Subject: [PATCH 09/24] .equals() vs == --- README.md | 655 +++++++++++++++++++++++++++--------------------------- 1 file changed, 330 insertions(+), 325 deletions(-) diff --git a/README.md b/README.md index 20850df..6e9f0c8 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,11 @@ 6. UI: How We Present the data +### == vs .equals() + +- ==: compares content and reference +- .equals(): compares just the content + ## Class Naming is Pascal Case The case name is = to 2526 fav programming language and fav screen color: ```java class PascalCase{} @@ -26,9 +31,9 @@ ## Method Naming is Camel Case: ```java public void theBestMethod() -{ - logln("2526: 727225, 27736259, 27429, 27375, 746867 ARE THE BEST THINGS EVER and 557 AKA LLP Prog is also my fav!!!"); -} + { + logln("2526: 727225, 27736259, 27429, 27375, 746867 ARE THE BEST THINGS EVER and 557 AKA LLP Prog is also my fav!!!"); + } ``` ## Data Structures @@ -43,12 +48,12 @@ public void theBestMethod() #### Non-Primitive DS: 1. Arrays 2. List - - Linear: - - Stacks - - Queues - - Non-Linear: - - Graphs - - Trees + - Linear: + - Stacks + - Queues + - Non-Linear: + - Graphs + - Trees @@ -72,16 +77,16 @@ $~ java callingProgram.java MethodProgram.java ## What is the "this" keyword in Java and why do we use it ```java class NelanLvsBDAndCSunAndFTN{ - int cobolfb = 2626532; - int pascalfb= 72722532; - - public void setVals(int cobolfb, int pascalfb){ + int cobolfb = 2626532; + int pascalfb= 72722532; + + public void setVals(int cobolfb, int pascalfb){ /*here is where the this keyword comes to play to tell java that I want to use the parameter of my function aka local variables and not the instance variables(up top) */ - this.cobolfb = cobolfb; - this.pascalfb = pascalfb; - } + this.cobolfb = cobolfb; + this.pascalfb = pascalfb; + } } ``` @@ -93,14 +98,14 @@ class NelanLvsBDAndCSunAndFTN{ Raised when you try to call an undeclared variable ```java public class Omar{ - public static void main(String [] args) - { - int a = 1; - int b= 2; - int c= 3; - mean = (a+b+c)/2; - System.out.println(mean); - } + public static void main(String [] args) + { + int a = 1; + int b= 2; + int c= 3; + mean = (a+b+c)/2; + System.out.println(mean); + } } ``` @@ -108,30 +113,30 @@ In line 8 we try to print to the console mean we have set the value of mean but To solve we do this ```java public class Omar{ - public static void main(String [] args) - { - int a = 1; - int b= 2; - int c= 3; - double mean = (a+b+c)/2; - System.out.println(mean); - } + public static void main(String [] args) + { + int a = 1; + int b= 2; + int c= 3; + double mean = (a+b+c)/2; + System.out.println(mean); + } } ``` ### 2- cannot find symbol PART 2 Raised when you try to call an undeclared variable ```java public class Great{ - public static void main(String [] args) - { - the_best_method; - } - - public static void the_best_method() - { + public static void main(String [] args) + { + the_best_method; + } + + public static void the_best_method() + { System.out.println("This is the best method in the world"); - } - + } + } ``` @@ -139,41 +144,41 @@ In line 4 we are incorrectly calling the_best_method but we forget the parenthes ```java public class Great{ - public static void main(String [] args) - { - the_best_method(); - } - - public static void the_best_method() - { + public static void main(String [] args) + { + the_best_method(); + } + + public static void the_best_method() + { System.out.println("This is the best method in the world"); - } - + } + } ``` -### 3- cannot find symbol : -### symbol: class Scanner +### 3- cannot find symbol : +### symbol: class Scanner ### location: class Great Raised when you are using the scanner ```java public class Great{ - public static void main(String [] args) - { - Scanner useInput= new Scanner(); // scanner is not imported - int l = useInput.nextInt(); - } + public static void main(String [] args) + { + Scanner useInput= new Scanner(); // scanner is not imported + int l = useInput.nextInt(); + } } ``` -In line 4 we are using the scanner but we never imported the library that enables us to use it +In line 4 we are using the scanner but we never imported the library that enables us to use it ```java import java.util.Scanner; public class Great{ - public static void main(String [] args) - { - Scanner useInput= new Scanner(); // scanner has no default constructor - int l = useInput.nextInt(); - } + public static void main(String [] args) + { + Scanner useInput= new Scanner(); // scanner has no default constructor + int l = useInput.nextInt(); + } } ``` @@ -182,10 +187,10 @@ public class Great{ ```java public class Thebest -{ - public static void main(String[] args) { - System.out.println("Hello, world!"); - } +{ + public static void main(String[] args) { + System.out.println("Hello, world!"); + } } ``` ## SOOO, I save the file and I name it Lemon.java well, it will error because our class is Thebest so that means our file name should be Thebest.java @@ -196,22 +201,22 @@ This error is raised when I try to write code outside of a method which is unint ```java public class Test { System.out.println("Hello!"); - - public static void main(String[] args) { - System.out.println("World!"); - } - } + + public static void main(String[] args) { + System.out.println("World!"); + } +} ``` - + To fix I just place the print Statement of hello inside of main ```java - public class Test { - public static void main(String[] args) { - System.out.println("Hello!"); - System.out.println("World!"); - } - } + public class Test { + public static void main(String[] args) { + System.out.println("Hello!"); + System.out.println("World!"); + } +} ``` ### 6- illegal start of expression @@ -219,29 +224,29 @@ To fix I just place the print Statement of hello inside of main An "illegal start of expression" error occurs when the compiler when we start a expression before closing the previous one. ```java public class Test { - public static void main(String[] args) { - my_method(); - - - public static void my_method() { - System.out.println("Hello, world!"); - } - } + public static void main(String[] args) { + my_method(); + + + public static void my_method() { + System.out.println("Hello, world!"); + } + } ``` To fix this piece of code, I simply add a closing curly brace for the main method. To know we are doing the right thing, just look at the lines of code before the error, there may be a missing closing paranthesis or a missing closing curly brace. This would give us what the error is. ```java public class Test { - public static void main(String[] args) - { - my_method(); - } - - public static void my_method() - { - System.out.println("Hello, EVERYONEEEE!"); - } + public static void main(String[] args) + { + my_method(); + } + + public static void my_method() + { + System.out.println("Hello, EVERYONEEEE!"); + } } ``` @@ -249,12 +254,12 @@ public class Test The incompatible types error is raised when we are facing with data type errors. We can overcome this, by converting say a char to an int. We can convert a double to an integer with typecasting. BUt WE CANNOT convert between primitive types and objects. A primitive type is say a: null, undefined, boolean, number, string or char. However objects can be: Arrays, Maps, Sets, Functions, Regular Expression or Date.. ```java -public class Test +public class Test { - public static void main(String[] args) - { - int num = "Hello, world!"; - } + public static void main(String[] args) + { + int num = "Hello, world!"; + } } ``` The above code is an error because we are assigning the string Hello World to the variable num of type int. @@ -263,24 +268,24 @@ Step 1: Change the String value from Hello, world! to 500 ```java public class Test { - public static void main(String[] args) - { - int num = "500"; - } + public static void main(String[] args) + { + int num = "500"; + } } ``` - + Step 2: Use parsing to convert the string to an integer ```java public class Test { - public static void main(String[] args) - { - int num = Integer.parseInt("500"); - } + public static void main(String[] args) + { + int num = Integer.parseInt("500"); + } } ``` - + ### 8- invalid method declaration; return type required @@ -290,16 +295,16 @@ When a method declaration does not contain a return type, this error will occur: ```java public class Test { - public static void main(String[] args) - { - int x = getValue(); - System.out.println(x); - } - - public static getValue() - { - return 10; - } + public static void main(String[] args) + { + int x = getValue(); + System.out.println(x); + } + + public static getValue() + { + return 10; + } } @@ -308,48 +313,48 @@ To fix this, simply insert the appropriate return type in the method signature a ```java -public class Test +public class Test { - public static void main(String[] args) - { - int x = getValue(); - System.out.println(x); - } - - public static int getValue() - { - return 10; - } + public static void main(String[] args) + { + int x = getValue(); + System.out.println(x); + } + + public static int getValue() + { + return 10; + } } ``` ### 9-java.lang.ArrayIndexOutOfBoundsException: -An ArrayIndexOutOfBoundsException is thrown when an attempt is made to access an index in an array that is not valid. This means that say an array has 8 elements and we know that the number of elements in index is 7. We start counting at 0. So, if I enter a value of 8 or greater to access, this will raise an error. +An ArrayIndexOutOfBoundsException is thrown when an attempt is made to access an index in an array that is not valid. This means that say an array has 8 elements and we know that the number of elements in index is 7. We start counting at 0. So, if I enter a value of 8 or greater to access, this will raise an error. ```java public class Test { - public static void main(String[] args) { - int[] arr = {1, 2, 3}; - for (int i = 0; i <= arr.length; i++) { - System.out.println(arr[i]); - } - } - } + public static void main(String[] args) { + int[] arr = {1, 2, 3}; + for (int i = 0; i <= arr.length; i++) { + System.out.println(arr[i]); + } + } +} ``` The code above errored due to the for loop iteration settings. The first element is index 0 which is fine however, the function's output of arr.length of our array named arr of type int is 3. However, we are using the comparison operator of <=. This means less than or equal to. If, we change it to < it will not error. The equal means it will try to access index 3 which is the 4th item in the array which we do not have. ```java public class Test { - public static void main(String[] args) { - int[] arr = {1, 2, 3}; - for (int i = 0; i < arr.length; i++) { - System.out.println(arr[i]); - } - } + public static void main(String[] args) { + int[] arr = {1, 2, 3}; + for (int i = 0; i < arr.length; i++) { + System.out.println(arr[i]); + } + } } ``` -### 10- StringIndexOutOfBoundsException -The exception StringIndexOutOfBoundsException is thrown to the console when an attempt is made to access an index in +### 10- StringIndexOutOfBoundsException +The exception StringIndexOutOfBoundsException is thrown to the console when an attempt is made to access an index in the String that is not valid. The only valid index of the String we can access is from 0 to the (length of the String-1). This means that if the array 8 elements. The biggest number I can access is 7 not 8. If we enter any number greater than 7 for access will throws an outofBoundsException. This is an error in runtime not compile-time. It is accepted by the compiler because it is a logical error ``` java @@ -371,16 +376,16 @@ To fix this I simply change the String a declaration in line 7 from index -1 to Therefore the bottom code is bug free ```java -public class Test +public class Test { - public static void main(String[] args) - { - String str = "Hello, world!"; + public static void main(String[] args) + { + String str = "Hello, world!"; - String a = str.substring(1, 3); - char b = str.charAt((str.length())-1); - String c = str.substring(0, 6); - } + String a = str.substring(1, 3); + char b = str.charAt((str.length())-1); + String c = str.substring(0, 6); + } } ``` @@ -402,178 +407,178 @@ public class Test This errors because I have called the methods with the specified data types in the wrong order. I must call it in the right order ```java -public class Omar -{ - public static void main(String[] args) { - omarMethod(1.0,"YOLO!", 2); - } - - public static void omarMethod(double a, String b, int c) { - System.out.println(a + " " + b + " " + c); - } +public class Omar +{ + public static void main(String[] args) { + omarMethod(1.0,"YOLO!", 2); + } + + public static void omarMethod(double a, String b, int c) { + System.out.println(a + " " + b + " " + c); + } } ``` ### 12- Left out return statement ```java - public class Omar + public class Omar { - public static void main(String[] args) - { - int x = doubleMyNum(5); - System.out.println(x); - } + public static void main(String[] args) + { + int x = doubleMyNum(5); + System.out.println(x); + } - public static int doubleMyNum(int m) - { - int value = 2 * m; - } - } + public static int doubleMyNum(int m) + { + int value = 2 * m; + } +} ``` -The above code errors because I have made the function behave like a void but my 3rd keyword indicates my return type should +The above code errors because I have made the function behave like a void but my 3rd keyword indicates my return type should be of type int. To fix this, after storing the computation in a variable. I use the return keyword to return to the console. The output of the computation performed by the method. ```java -public class Omar +public class Omar { - public static void main(String[] args) - { - int x = doubleMyNum(5); - System.out.println(x); - } + public static void main(String[] args) + { + int x = doubleMyNum(5); + System.out.println(x); + } - public static int doubleMyNum(int m) - { - int value = 2 * m; - return value; - } - } + public static int doubleMyNum(int m) + { + int value = 2 * m; + return value; + } +} ``` ### - Left out return statement in CASE#2 ```java - public class Omar + public class Omar { - public static void main(String[] args) - { - int x = myAwesomeAbsVal(-5); - System.out.println(x); - } - - public static int myAwesomeAbsVal(int m) - { - if(m<0) - { - return -m; - } + public static void main(String[] args) + { + int x = myAwesomeAbsVal(-5); + System.out.println(x); + } - if(m>0) - { - return m; - } - } - } + public static int myAwesomeAbsVal(int m) + { + if(m<0) + { + return -m; + } + + if(m>0) + { + return m; + } + } +} ``` The above lines of code have an error in logic. We should switch the code to this: ```java -public class Omar +public class Omar { - public static void main(String[] args) - { - int x = myAwesomeAbsVal(-5); - System.out.println(x); - } - - public static int myAwesomeAbsVal(int m) - { - if(m<0) - { - return -m; - } + public static void main(String[] args) + { + int x = myAwesomeAbsVal(-5); + System.out.println(x); + } - else - { - return m; - } - } + public static int myAwesomeAbsVal(int m) + { + if(m<0) + { + return -m; + } + + else + { + return m; + } + } } ``` ### 13 - possible loss of precision ```java -public class Omar +public class Omar { - public static void main(String[] args) - { - int theAwesomePi = 3.14159; - System.out.println("The value of pi is: " + theAwesomePi); - } - } + public static void main(String[] args) + { + int theAwesomePi = 3.14159; + System.out.println("The value of pi is: " + theAwesomePi); + } +} ``` There is an error above being raised being we are store double in an integer. An integer can only store 4 4 bytes in main memory. The value we are storing in it is a double which has a memory size of 8 bytes. The way to solve this issue. We will explictly cast the variable theAwesomePi to an int. ```java -public class Omar +public class Omar { - public static void main(String[] args) - { - int theAwesomePi = (int)3.14159; - System.out.println("The value of pi is: " + theAwesomePi); - } - } + public static void main(String[] args) + { + int theAwesomePi = (int)3.14159; + System.out.println("The value of pi is: " + theAwesomePi); + } +} ``` ### 14 - Reached end of file while parsing ```java -public class Omar +public class Omar { - public static void main(String[] args) - { - myWonderfulMethod(); - } - - public static void myWonderfulMethod() - { - System.out.println("How Awesome do you think my Method is?"); - } + public static void main(String[] args) + { + myWonderfulMethod(); + } + + public static void myWonderfulMethod() + { + System.out.println("How Awesome do you think my Method is?"); + } ``` There is an error above being raised being we are not properly closing our class. To solve this issue we add a closing curly brace. After, the closing curly brace of my method. ```java -public class Omar +public class Omar { - public static void main(String[] args) - { - myWonderfulMethod(); - } - - public static void myWonderfulMethod() - { - System.out.println("How Awesome do you think my Method is?"); - } + public static void main(String[] args) + { + myWonderfulMethod(); + } + + public static void myWonderfulMethod() + { + System.out.println("How Awesome do you think my Method is?"); + } } ``` ### 15 - unreachable statement -An "unreachable statement" error takes place when the compiler sees that it is impossible to reacha a certain statement. This is caused by the following code. +An "unreachable statement" error takes place when the compiler sees that it is impossible to reacha a certain statement. This is caused by the following code. ```java -public class Omar +public class Omar { - public static void main(String[] args) - { - int theAwesomeNum = doubleMe(5); - System.out.println(theAwesomeNum); - } - - public static int doubleMe(int a) - { - int doubleMe = 2 * a; - return doubleMe; - System.out.println("Returning " + doubleMe); - } + public static void main(String[] args) + { + int theAwesomeNum = doubleMe(5); + System.out.println(theAwesomeNum); + } + + public static int doubleMe(int a) + { + int doubleMe = 2 * a; + return doubleMe; + System.out.println("Returning " + doubleMe); + } } ``` @@ -581,47 +586,47 @@ The compiler will generate a number of errors. The first one to be listed is tha This is because whenever we create a method and use the keyword return the compiler says you are done with the method therefore, we can exit out of the method and execute the next line of code. To fix this error I simply reverse the order of the print statement and the return statement. ```java -public class Omar +public class Omar { - public static void main(String[] args) - { - int theAwesomeNum = doubleMe(5); - System.out.println(theAwesomeNum); - } + public static void main(String[] args) + { + int theAwesomeNum = doubleMe(5); + System.out.println(theAwesomeNum); + } - public static int doubleMe(int a) - { - int doubleMe = 2 * a; - System.out.println("Returning " + doubleMe); - return doubleMe; - } + public static int doubleMe(int a) + { + int doubleMe = 2 * a; + System.out.println("Returning " + doubleMe); + return doubleMe; + } } ``` -### 16 - Variable might not have been initialized +### 16 - Variable might not have been initialized An variable might not have been initialized error is triggered when we declare a variable and specify its type but never give it an initial value; ```java - public class Omar - { - public static void main(String[] args) { - int myNum = 16; - int myNum2; - System.out.println(myNum + myNum2); - } - } + public class Omar +{ + public static void main(String[] args) { + int myNum = 16; + int myNum2; + System.out.println(myNum + myNum2); + } +} ``` The compiler will generate the error variable myNum2 might not have been initialized because we declared it with the specified data type but never gave it an initial value. To solve this, I simply give it an initial value. ```java -public class Omar +public class Omar { - public static void main(String[] args) - { - int myNum = 16; - int myNum2=3; - System.out.println(myNum + myNum2); - } + public static void main(String[] args) + { + int myNum = 16; + int myNum2=3; + System.out.println(myNum + myNum2); + } } ``` ### 17 - constructor X in class X cannot be applied to given types @@ -631,34 +636,34 @@ super() ### 18 - Cannot make a static reference to the non-static method logLn(object) from the type Omar ```java -public class Omar +public class Omar { - public void logLn(object o){ - System.out.println(o); - } + public void logLn(object o){ + System.out.println(o); + } - public static void main(String[] args) - { - int myNum = 16; - int myNum2=3; - logLn(myNum + myNum2); - } + public static void main(String[] args) + { + int myNum = 16; + int myNum2=3; + logLn(myNum + myNum2); + } } ``` I am getting this error because logLn should me a static method ```java -public class Omar +public class Omar { - public static void logLn(object o){ - System.out.println(o); - } + public static void logLn(object o){ + System.out.println(o); + } - public static void main(String[] args) - { - int myNum = 16; - int myNum2=3; - logLn(myNum + myNum2); - } + public static void main(String[] args) + { + int myNum = 16; + int myNum2=3; + logLn(myNum + myNum2); + } } ``` @@ -699,8 +704,8 @@ public void setLuckyNum(int luckyNum) { this.luckyNum = luckyNum; } */ -@Getter -@Setter +@Getter +@Setter private int luckyNum = 3532; ``` @@ -714,7 +719,7 @@ public class Example ### Equals And Hash Code Annotation ```java @EqualsAndHashCode( - exclude={"id1", "id2"}) + exclude={"id1", "id2"}) public class Example { } ``` \ No newline at end of file From f294d649fd27d8df7115da89ce4292ed0c5f02a7 Mon Sep 17 00:00:00 2001 From: Omar Belkady Date: Wed, 20 Apr 2022 15:12:36 +0000 Subject: [PATCH 10/24] Abstraction is now detailed and well written --- Abstraction/README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Abstraction/README.md diff --git a/Abstraction/README.md b/Abstraction/README.md new file mode 100644 index 0000000..9919894 --- /dev/null +++ b/Abstraction/README.md @@ -0,0 +1,35 @@ +## Abstraction + +- Hide certain details and show only what's necessary to the User +- Used through Abstract Classes/Interfaces +- Any class that inherits from an abstract class must implement all the abstract methods declared in the abstract class +- An abstract Class Cannot be instantiated + + +### Example + + +```java +public abstract class Animal{ + public abstract void animalSound(); + + public void sleep(){ + System.out.println("Zzz"); + } +} + +public class Dog extends Animal{ + public void animalSound(){ + System.out.println("Woofwoof"); + } +} + +public class Base{ + public static void main(String [] args) + { + Dog olivia = new Dog(); + olivia.animalSound(); + olivia.sleep(); + } +} +``` \ No newline at end of file From 99151d4707b2db40822a6d46c97c1925460238eb Mon Sep 17 00:00:00 2001 From: Omar Belkady Date: Mon, 25 Apr 2022 02:27:20 +0000 Subject: [PATCH 11/24] Topics to Know To Understand Java --- MustKnow/README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/MustKnow/README.md b/MustKnow/README.md index 35212d3..367ba3d 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -13,6 +13,36 @@ - Binary Tree - Binary Search Tree +##### Things You Must Know To Understand Java +- Abstract +- Arrays And ArrayList +- Collections +- Conditionals +- Default +- Enum +- Exception Handling +- Final Keyword +- Generics +- Interfaces +- Loops +- Maps +- OOP(Abstraction, Encapsulation, Inheritance, Polymorphism) +- Passing By Value Vs. Passing By Reference +- Reference Types Vs Primitive Types +- Sets +- Static +- ToString & Equals & Hashcode + + + + + + + + + + + ##### ★★★★Operation You Can Perform On A Data Structure★★★★ From 9d5a094ad7f3eb20d7d7af47e921cc8cfc925499 Mon Sep 17 00:00:00 2001 From: Omar Belkady Date: Sun, 3 Jul 2022 20:56:38 +0000 Subject: [PATCH 12/24] DFS Graph Algorithm Pre order, Post order and Regular Order --- MustKnow/Graphs/README.md | 35 ++++++++++++++++++++ MustKnow/README.md | 67 ++++++++++++++++++++++----------------- 2 files changed, 73 insertions(+), 29 deletions(-) create mode 100644 MustKnow/Graphs/README.md diff --git a/MustKnow/Graphs/README.md b/MustKnow/Graphs/README.md new file mode 100644 index 0000000..21f602f --- /dev/null +++ b/MustKnow/Graphs/README.md @@ -0,0 +1,35 @@ +### Graphs Implementation + + +
+ +##### DFS +```java +import java.util.*; +class Main{ + public final int depthfirsts(int node, int result){ + /*PRE ORDER + * + * result.push(node,value); + * */ + + if(node.left) { + depthfirsts(node.left, result); + } + + + result.push(node,value); + + + if(node.right){ + depthfirsts(node.right); + } + + /*POST ORDER + * + * result.push(node,value); + * */ + return result; + } +} +``` \ No newline at end of file diff --git a/MustKnow/README.md b/MustKnow/README.md index 367ba3d..317df54 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -6,12 +6,18 @@ ##### ★★★★★Most Popular Data Structures★★★★★ -- Array -- Linked List -- Stack -- Queue -- Binary Tree -- Binary Search Tree +- Array [Linear and Non-Primitive] + +- Char [Primitive] +- Double [Primitive] +- Float [Primitive] +- Graph [Non-Linear and Non-Primitive] +- Integer [Primitive] +- Linked List [Linear and Non-Primitive] +- Stack [Linear and Non-Primitive] +- String [Primitive] +- Tree [Non-Linear and Non-Primitive] +- Queue [Linear and Non-Primitive] ##### Things You Must Know To Understand Java - Abstract @@ -33,17 +39,9 @@ - Static - ToString & Equals & Hashcode +
- - - - - - - - - -##### ★★★★Operation You Can Perform On A Data Structure★★★★ +##### ★★★★Operations You Can Perform On A Data Structure★★★★ - Delete: Remove an item from the data structure @@ -75,7 +73,7 @@ -1. Stack +1. **Stack** - Linear - LIFO/FILO @@ -98,7 +96,7 @@ Stack myStack= new Stack(); ``` -2. Linked List +2. **Linked List** - Sequential Order - No Random Access @@ -120,7 +118,7 @@ LinkedListnameOfLL = new LinkedList() */ LinkedList mylist=new LinkedList(); ``` -3. Array +3. **Array** - Indexed - When Size increases performance decreases @@ -179,10 +177,10 @@ public class Arr{ } ``` -4. Vector: Grows by 100% of its size everytime I add sth to it... asynchronous aka multiple threads at a time +4. **Vector** : Grows by 100% of its size everytime I add sth to it... asynchronous aka multiple threads at a time -5. Queues +5. **Queues** - People waiting in line in the Movie Theatre - Linear @@ -215,7 +213,7 @@ public class queueimpl{ ``` -5. Hash Table +6. **Hash Table** - Contains an index and its corresponding Hash_Value @@ -258,7 +256,7 @@ public class HashTable{ ``` -6. Trees +7.**Trees** - Hierarchical Structure where data is org in a hierarchy and everything is linked together - Not the same as linked list because LL is linear @@ -459,7 +457,7 @@ B(0) D(0) F(0) -7. Heap +8.**Heap** - Special Tree Based DS - Binary Tree @@ -472,7 +470,7 @@ B(0) D(0) F(0) - Patients that don't have threatening situation wait in line -8. Graphs +9.**Graphs** - Finite set of vertices, nodes and edges. The edges are what connect one vertex with another - Graphs are connected in a network form @@ -481,14 +479,25 @@ B(0) D(0) F(0) - Non-linear - Nodes are the vertices(i.e. endpoints) - Edges are the lines/arcs that connect one node with another node -- Two Types: - - Directed - - Undirected +- Types: + - **Directed**: no particular direction and two-way relation + - e.g. Friends on Facebook + - **Undirected**: Particular Direction and one-way relation + - e.g. who you're following on Twitter + - **Unweighted**: Every edge has no particular weight + - **Weighted**: Each edge has a respective value this is referred to as weight + - e.g. distance between cities +- **Note** A (directed/undirected )graph is independent of being weighted or not +- We can have: + - Direct Weighted Graphs + - Direct Unweighted Graphs + - Undirected Weighted Graphs + - Undirected Unweighted Graphs - Traversing Algo Implementing A Graph: - BFS - DFS - Simple Graph: Each edge connects to two different vertices whereby no two edges connect to the same group of vertices -- Multigraph: An edge can connect to the same pair of vertices +- Multi-graph: An edge can connect to the same pair of vertices - Google Maps Usage of Connecting Roads i.e. vertex therefore, I use an algo to determine the shortest path between vertex A & B From af5e4b881c0b69e6c4d797c93527713ebfe5fccc Mon Sep 17 00:00:00 2001 From: Omar Belkady Date: Tue, 5 Jul 2022 19:56:28 +0000 Subject: [PATCH 13/24] Different Types of Algo --- MustKnow/README.md | 56 +++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/MustKnow/README.md b/MustKnow/README.md index 317df54..62559fc 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -457,7 +457,7 @@ B(0) D(0) F(0) -8.**Heap** +8. **Heap** - Special Tree Based DS - Binary Tree @@ -470,7 +470,7 @@ B(0) D(0) F(0) - Patients that don't have threatening situation wait in line -9.**Graphs** +9. **Graphs** - Finite set of vertices, nodes and edges. The edges are what connect one vertex with another - Graphs are connected in a network form @@ -493,29 +493,53 @@ B(0) D(0) F(0) - Direct Unweighted Graphs - Undirected Weighted Graphs - Undirected Unweighted Graphs -- Traversing Algo Implementing A Graph: +## Important Algorithms +- Graph Algorithms: - BFS - DFS + - Dijkstra(Shortest Path) - Simple Graph: Each edge connects to two different vertices whereby no two edges connect to the same group of vertices - Multi-graph: An edge can connect to the same pair of vertices - Google Maps Usage of Connecting Roads i.e. vertex therefore, I use an algo to determine the shortest path between vertex A & B +### Sorting +- Bubble Sort +- Bucket/Insertion Sort +- Counting Sort +- Heap Sort +- Merge Sort +- Quick Sort +- Selection Sort -1. When the sample size increases of an Array what should you do? +
+ +## Search Algorithms + +1. Breath First Search[Graphs] +2. Depth First Search[Graphs] +3. Binary Search[Linear] +4. Linear Search + +**Other** +- Recursive Algorithms +- Hashing Algorithms +- Randomized Algorithms + -- Use A Linked List DS because it increases performance and isn't slow as the sample size increases + +1. When the sample size increases of an Array what should you do? + - Use A Linked List DS because it increases performance and isn't slow as the sample size increases 2. For Loop Runtime: O(n) where n is the size of the input 3. Function with 1 operation: O(1) 4. Say I have a print statement before a for loop and after what's the runtime: - -- Print statement: O(1) -- For Loop: O(n) -- Print statement: O(1) + - Print statement: O(1) + - For Loop: O(n) + - Print statement: O(1) Total: O(1+n+1)= O(n+2) @@ -795,23 +819,9 @@ O(n) - compare using .compareTo() method -### Important Algo - -#### Sorting -1. Merge Sort -2. Quick Sort -3. Bucket/Insertion Sort -4. Heap Sort -5. Selection Sort -6. Counting Sort -#### Searching - -1. Breath First Search[Graphs] -2. Depth First Search[Graphs] -3. Binary Search[Linear] #### Divide & Conquer From 47d212f1a4d8472b8b1e6c963e93404f3c1aa458 Mon Sep 17 00:00:00 2001 From: Omar Belkady Date: Fri, 18 Nov 2022 03:48:23 +0000 Subject: [PATCH 14/24] Selection Sort Implementation 7652626 32 --- MustKnow/README.md | 59 ++++++++++++++++++++++++++++++++++++- MustKnow/Selectionso.class | Bin 0 -> 1223 bytes MustKnow/Selectionso.java | 39 ++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 MustKnow/Selectionso.class create mode 100644 MustKnow/Selectionso.java diff --git a/MustKnow/README.md b/MustKnow/README.md index 62559fc..988f7eb 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -504,7 +504,15 @@ B(0) D(0) F(0) ### Sorting - Bubble Sort -- Bucket/Insertion Sort +- Bucket/Insertion Sort + - Runtime: O(n^2) ... ie terrible + - useful when paired with other more complex sorting algo + - i.e. Quicksort, Merge Sort + - good for ordering a small sample size + - Step 1: iterate from the 2nd array to the nth array over the array + - Step 2: compare the element which you are at with its parent/predecessor + - Step 3: if the key is less than its predecessor compare it to the preceding elements + - Step 4: Move the greater element up one spot to give space for the modified element - Counting Sort - Heap Sort - Merge Sort @@ -701,6 +709,9 @@ public class Main{ - O(n) because the val we are searching for maybe stored in the last node aka n that is worst case. + + + #### Insertion Sort Implementation ```java @@ -747,6 +758,52 @@ Space C: O(1) because I am adding a var ``` +#### Selection Sort Implementation + +```java +import java.util.*; + +public class Selectionso { + public static void Selectionso(int myArr[]) + { + for(int i=0;i myArr[j]) + { + position = j; + } + } + //perform a swap + int myTempVar = myArr[position]; + myArr[position] = myArr[i]; + myArr[i] = myTempVar; + } + } + + public static void PrintMyArray(int myArr[]) + { + for(int i=0; iJKH9dKy0#|nLGEMbMBd$Z+}is0p#&eMgTzxAq8PX7}Py} zz_TW|cCw|dJ-zBNM3xN8@bV17)a*tSU5HAM6?8+nkX~-Oo?fRcd!LF1i$0KHXP-NU z<&`~0=k;8SIIk(_g~~8o=QX`xTUGA8FuYxwxgNJXmuge1v#oMp2h|$ZPEJM){SpQg z3}T3({|bDDa6_;Oh|2)88v??jdYt2WF!S|+dXs%JZ-`Aw%c?Zg)76K-vrx|=N8c5T0ryR5V$a-nd&+0d^@@9ed8n{u58 z+lDA`(<~dFp6kLLh5#EUmsc%IcM2wVUEP&%k74>!Z&yi{u*fj>|5Uort^VjhHM;!b z7XqC%BJ@8=s|1aV#&G%**aw<0OwqsC27-u+n?iGu`kG2ZH0Fa#TKY7!eS}4ASqr_& zC&cP42Ga3NI+1yYaANr|$lm|`L4kZap4Kv@w3a9xGKzf_908vrL(fVu$@I(=Vj7|K z1bS#Midpnwo^J30`tg8rmgylRDLaPnFS6}7dKinHA^el}qvE!`JlHwh_#6m<;} U!H}l!Hty0&rr84SlLw>!0MRfMf&c&j literal 0 HcmV?d00001 diff --git a/MustKnow/Selectionso.java b/MustKnow/Selectionso.java new file mode 100644 index 0000000..d9f16b8 --- /dev/null +++ b/MustKnow/Selectionso.java @@ -0,0 +1,39 @@ +import java.util.*; + +public class Selectionso { + public static void Selectionso(int myArr[]) + { + for(int i=0;i myArr[j]) + { + position = j; + } + } + //perform a swap + int myTempVar = myArr[position]; + myArr[position] = myArr[i]; + myArr[i] = myTempVar; + } + } + + public static void PrintMyArray(int myArr[]) + { + for(int i=0; i Date: Fri, 18 Nov 2022 04:56:24 +0100 Subject: [PATCH 15/24] Not Necessary --- MustKnow/Selectionso.class | Bin 1223 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 MustKnow/Selectionso.class diff --git a/MustKnow/Selectionso.class b/MustKnow/Selectionso.class deleted file mode 100644 index 173336513209512dbdce26d8e3e201de238a0a4c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1223 zcmaJ=T~8B16g|_grOP5q`F306qhKl0swkQinrIUurdX2_Oy$L)Y+&hjx7l4t`p$1K zKBI}x`hbQQo{j%R|AEA>JKH9dKy0#|nLGEMbMBd$Z+}is0p#&eMgTzxAq8PX7}Py} zz_TW|cCw|dJ-zBNM3xN8@bV17)a*tSU5HAM6?8+nkX~-Oo?fRcd!LF1i$0KHXP-NU z<&`~0=k;8SIIk(_g~~8o=QX`xTUGA8FuYxwxgNJXmuge1v#oMp2h|$ZPEJM){SpQg z3}T3({|bDDa6_;Oh|2)88v??jdYt2WF!S|+dXs%JZ-`Aw%c?Zg)76K-vrx|=N8c5T0ryR5V$a-nd&+0d^@@9ed8n{u58 z+lDA`(<~dFp6kLLh5#EUmsc%IcM2wVUEP&%k74>!Z&yi{u*fj>|5Uort^VjhHM;!b z7XqC%BJ@8=s|1aV#&G%**aw<0OwqsC27-u+n?iGu`kG2ZH0Fa#TKY7!eS}4ASqr_& zC&cP42Ga3NI+1yYaANr|$lm|`L4kZap4Kv@w3a9xGKzf_908vrL(fVu$@I(=Vj7|K z1bS#Midpnwo^J30`tg8rmgylRDLaPnFS6}7dKinHA^el}qvE!`JlHwh_#6m<;} U!H}l!Hty0&rr84SlLw>!0MRfMf&c&j From 088d4252e0b62b78c6d95d416a090a46dcf3606c Mon Sep 17 00:00:00 2001 From: Omar Belkady Date: Thu, 24 Nov 2022 06:04:48 +0000 Subject: [PATCH 16/24] Merge Sort and Better Selection Sort implementation --- MustKnow/README.md | 148 +++++++++++++++++++++++++++++++++---- MustKnow/Selectionso.class | Bin 1223 -> 0 bytes MustKnow/Selectionso.java | 39 ---------- 3 files changed, 135 insertions(+), 52 deletions(-) delete mode 100644 MustKnow/Selectionso.class delete mode 100644 MustKnow/Selectionso.java diff --git a/MustKnow/README.md b/MustKnow/README.md index 988f7eb..3327f7d 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -766,20 +766,29 @@ import java.util.*; public class Selectionso { public static void Selectionso(int myArr[]) { - for(int i=0;i myArr[j]) - { - position = j; + /* + 0. take an unsorted num of elements within an array + 1. find the minimum and place it on its own + 2. find the second min and place it after the min in the other array + 3. repeat till you have one left(i.e. largest) and place it at the end of the array + */ + int arr_size = myArr.length; + for(int x=0;xJKH9dKy0#|nLGEMbMBd$Z+}is0p#&eMgTzxAq8PX7}Py} zz_TW|cCw|dJ-zBNM3xN8@bV17)a*tSU5HAM6?8+nkX~-Oo?fRcd!LF1i$0KHXP-NU z<&`~0=k;8SIIk(_g~~8o=QX`xTUGA8FuYxwxgNJXmuge1v#oMp2h|$ZPEJM){SpQg z3}T3({|bDDa6_;Oh|2)88v??jdYt2WF!S|+dXs%JZ-`Aw%c?Zg)76K-vrx|=N8c5T0ryR5V$a-nd&+0d^@@9ed8n{u58 z+lDA`(<~dFp6kLLh5#EUmsc%IcM2wVUEP&%k74>!Z&yi{u*fj>|5Uort^VjhHM;!b z7XqC%BJ@8=s|1aV#&G%**aw<0OwqsC27-u+n?iGu`kG2ZH0Fa#TKY7!eS}4ASqr_& zC&cP42Ga3NI+1yYaANr|$lm|`L4kZap4Kv@w3a9xGKzf_908vrL(fVu$@I(=Vj7|K z1bS#Midpnwo^J30`tg8rmgylRDLaPnFS6}7dKinHA^el}qvE!`JlHwh_#6m<;} U!H}l!Hty0&rr84SlLw>!0MRfMf&c&j diff --git a/MustKnow/Selectionso.java b/MustKnow/Selectionso.java deleted file mode 100644 index d9f16b8..0000000 --- a/MustKnow/Selectionso.java +++ /dev/null @@ -1,39 +0,0 @@ -import java.util.*; - -public class Selectionso { - public static void Selectionso(int myArr[]) - { - for(int i=0;i myArr[j]) - { - position = j; - } - } - //perform a swap - int myTempVar = myArr[position]; - myArr[position] = myArr[i]; - myArr[i] = myTempVar; - } - } - - public static void PrintMyArray(int myArr[]) - { - for(int i=0; i Date: Sun, 4 Dec 2022 07:59:29 -0800 Subject: [PATCH 17/24] Bubble Sort Implementation --- MustKnow/README.md | 161 ++++++++++++++++++++++++++++++--------------- 1 file changed, 108 insertions(+), 53 deletions(-) diff --git a/MustKnow/README.md b/MustKnow/README.md index 3327f7d..4e38180 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -710,6 +710,53 @@ public class Main{ +#### Bubble Sort Implementation + +```java +/* + + 1. Compare the first two elements if the first is + bigger than the second swap + + 2. compare the rest and if the second is less than + the first move the second to the left of the first + + */ + + +public class BubbleSort{ + + public static void bubbleSort(int [] arr){ + int arrsize = arr.length; + for(int s=0;sarr[t+1]){ + int temporary = arr[t]; + arr[t]=arr[t+1]; + arr[t+1]= temporary; + } + } + } + } + + public static void main(String [] args){ + int myarr[] ={3,60,35,2,45,320,5}; + System.out.println("Before Bubble Sort"); + for(int x=0; x + #### Insertion Sort Implementation @@ -757,59 +804,7 @@ Space C: O(1) because I am adding a var */ ``` - -#### Selection Sort Implementation - -```java -import java.util.*; - -public class Selectionso { - public static void Selectionso(int myArr[]) - { - /* - 0. take an unsorted num of elements within an array - 1. find the minimum and place it on its own - 2. find the second min and place it after the min in the other array - 3. repeat till you have one left(i.e. largest) and place it at the end of the array - */ - int arr_size = myArr.length; - for(int x=0;x #### Merge Sort Implementation @@ -925,6 +920,66 @@ public class MergeSort ``` +
+ + +#### Selection Sort Implementation + +```java +import java.util.*; + +public class Selectionso { + public static void Selectionso(int myArr[]) + { + /* + 0. take an unsorted num of elements within an array + 1. find the minimum and place it on its own + 2. find the second min and place it after the min in the other array + 3. repeat till you have one left(i.e. largest) and place it at the end of the array + */ + int arr_size = myArr.length; + for(int x=0;x + + #### Insertions at the End in a LL index Time C From 99c0cb3e2133c4d75b579f60fe91fa05729657db Mon Sep 17 00:00:00 2001 From: Omar Belkady Date: Tue, 13 Dec 2022 20:27:47 +0000 Subject: [PATCH 18/24] GCD aka Greatest common divisor --- MustKnow/GCDeuclid/README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 MustKnow/GCDeuclid/README.md diff --git a/MustKnow/GCDeuclid/README.md b/MustKnow/GCDeuclid/README.md new file mode 100644 index 0000000..1f940c5 --- /dev/null +++ b/MustKnow/GCDeuclid/README.md @@ -0,0 +1,25 @@ +```java +public class GCDeuclid{ + public static void logLn(Object o){ + System.out.println(o); + } + + public static void main(String [] args){ + logLn(euclidgcd(1800,54)); + } + + public static int euclidgcd(int divid, int divis){ + //2526 56837 35 + /* + * if divisor i.e. divis completely divid i.e. dividend + * remain=0 i.e. therefore divis is the gcd + * */ + int remain = divid%divis; + if(remain==0){ + return divis; + } + + return euclidgcd(divis,remain); + } +} +``` \ No newline at end of file From 90e251396e4687110f9db46c3f37781ffd2501dc Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Sat, 11 Mar 2023 11:51:11 -0800 Subject: [PATCH 19/24] Backend Roadmap --- MustKnow/README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/MustKnow/README.md b/MustKnow/README.md index 4e38180..e9485c1 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -19,6 +19,27 @@ - Tree [Non-Linear and Non-Primitive] - Queue [Linear and Non-Primitive] +##### Backend Roadmap +```mermaid +graph TD; + START/FINISH-- Containerization --> Docker; + Docker -- CI/CD Tools --> Gitlab; + Gitlab -- VCS --> GitHub/BitBucket; + GitHub/BitBucket -- Frameworks --> Express/Flask/Laravel/RubyOnRails; + Express/Flask/Laravel/RubyOnRails -- Prog_Lang --> Java/Python/Ruby/C#/NodeJS/Rust/PHP; + Java/Python/Ruby/C#/NodeJS/Rust/PHP -- Archi Pattern --> Microservices/Monolithic/Serverless/SOA; + Microservices/Monolithic/Serverless/SOA -- APIs --> REST/JSON/SOAP; + REST/JSON/SOAP -- Caching--> Client/Server/CDN; + Client/Server/CDN -- Testing --> + Integration/Unit/Functional; + Integration/Unit/Functional -- Database -- SQL --> MYSQL/Postgres; + Integration/Unit/Functional -- Database -- NoSQL --> MongoDB; + MongoDB --> START/FINISH + MYSQL/Postgres --> START/FINISH + +``` + + ##### Things You Must Know To Understand Java - Abstract - Arrays And ArrayList @@ -62,6 +83,8 @@ - Used in the Average Case + + ##### DS Operations - Traverse: Visiting each item in the DS once AND ONLY ONCE From b7b35799fd1f6a075bbd934b89fcdd2e33a04c1d Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Thu, 1 Jun 2023 20:23:33 +0100 Subject: [PATCH 20/24] Graph Example 2526 56837 7652626 --- MustKnow/README.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/MustKnow/README.md b/MustKnow/README.md index e9485c1..a9b94ff 100644 --- a/MustKnow/README.md +++ b/MustKnow/README.md @@ -525,6 +525,66 @@ B(0) D(0) F(0) - Multi-graph: An edge can connect to the same pair of vertices - Google Maps Usage of Connecting Roads i.e. vertex therefore, I use an algo to determine the shortest path between vertex A & B + +```java +//basic example + +import java.util.*; + +class Graph { + private int V; // Number of vertices + private LinkedList[] adjList; // Array of adjacency lists + + // Constructor + public Graph(int V) { + this.V = V; + adjList = new LinkedList[V]; + + for (int i = 0; i < V; i++) { + adjList[i] = new LinkedList(); + } + } + + // Add an edge to the graph + public void addEdge(int src, int dest) { + adjList[src].add(dest); + adjList[dest].add(src); // Uncomment this line for undirected graph + } + + // Print the graph + public void printGraph() { + for (int i = 0; i < V; i++) { + System.out.print("Vertex " + i + " is connected to: "); + for (int neighbor : adjList[i]) { + System.out.print(neighbor + " "); + } + System.out.println(); + } + } +} + +public class Main { + public static void main(String[] args) { + // Create a graph with 5 vertices + Graph graph = new Graph(5); + + // Add edges + graph.addEdge(0, 1); + graph.addEdge(0, 4); + graph.addEdge(1, 2); + graph.addEdge(1, 3); + graph.addEdge(1, 4); + graph.addEdge(2, 3); + graph.addEdge(3, 4); + + // Print the graph + graph.printGraph(); + } +} + +``` + + ### Sorting - Bubble Sort - Bucket/Insertion Sort From 2405314b79c0a10c73e01b15e3cebb013ad92849 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 28 Aug 2023 00:15:57 +0100 Subject: [PATCH 21/24] More Must Know Stuff --- MustKnow/Array Algo/README.md | 88 +++++++++++++++++++++++++++++++++++ MustKnow/Design Pat/README.md | 8 ++++ 2 files changed, 96 insertions(+) create mode 100644 MustKnow/Array Algo/README.md create mode 100644 MustKnow/Design Pat/README.md diff --git a/MustKnow/Array Algo/README.md b/MustKnow/Array Algo/README.md new file mode 100644 index 0000000..fba5e6e --- /dev/null +++ b/MustKnow/Array Algo/README.md @@ -0,0 +1,88 @@ +### Array Algorithms + + +#### Floyd's Cycle Detection Algorithm +```java +class ListNode { + int val; + ListNode next; + + ListNode(int val) { + this.val = val; + this.next = null; + } +} + + public class FloydCycleDetection { + public static boolean hasCycle(ListNode head) { + if (head == null || head.next == null) { + return false; // No cycle if head is null or only one node exists + } + + ListNode slow = head; // Slow pointer moves one step at a time + ListNode fast = head; // Fast pointer moves two steps at a time + + while (fast != null && fast.next != null) { + slow = slow.next; // Move slow pointer one step + fast = fast.next.next; // Move fast pointer two steps + + if (slow == fast) { + return true; // Cycle detected if slow and fast pointers meet + } + } + + return false; // No cycle found + } + + public static void main(String[] args) { + // Create a linked list with a cycle + ListNode head = new ListNode(1); + ListNode node2 = new ListNode(2); + ListNode node3 = new ListNode(3); + ListNode node4 = new ListNode(4); + ListNode node5 = new ListNode(5); + + head.next = node2; + node2.next = node3; + node3.next = node4; + node4.next = node5; + node5.next = node2; // Cycle: node5 points back to node2 + + System.out.println("Does the linked list have a cycle? " + hasCycle(head)); + } + } +``` + +#### Kadane's Algorithm + +```java +public class KadanesAlgorithm { + public static int maxSubArraySum(int[] nums) { + int maxSum = nums[0]; // Initialize maxSum with the first element of the array + int currentSum = nums[0]; // Initialize currentSum with the first element of the array + + for (int i = 1; i < nums.length; i++) { + /** + Calc the currentSum for the current element by taking + the maximum of the current element itself or the sum + of the current element and the previous subarray sum + **/ + currentSum = Math.max(nums[i], currentSum + nums[i]); + + /**Update the maxSum with the maximum of the currentSum and the previous maxSum + * + * + **/ + maxSum = Math.max(maxSum, currentSum); + } + + return maxSum; // Return the maximum subarray sum + } + + public static void main(String[] args) { + int[] nums = {-2, 1, -3, 4, -1, 2, 1, -5, 4}; + int maxSum = maxSubArraySum(nums); + System.out.println("Maximum subarray sum: " + maxSum); + } +} +``` \ No newline at end of file diff --git a/MustKnow/Design Pat/README.md b/MustKnow/Design Pat/README.md new file mode 100644 index 0000000..d570b02 --- /dev/null +++ b/MustKnow/Design Pat/README.md @@ -0,0 +1,8 @@ +### Design Patterns + + +#### Adapter Design Pattern +- Convert An Interface of A Class into Another Interface that clients expect +- Enables us to make incompatible classes work with one another +- i.e. delegate logic to the Adapter +- ![example](https://www.baeldung.com/wp-content/uploads/2019/02/Adapter.png) \ No newline at end of file From 8ac63afcbff765a6169916fca6add68c78351a5e Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Sat, 28 Jun 2025 19:15:00 +0100 Subject: [PATCH 22/24] New APP --- .idea/.gitignore | 3 + .idea/Java.iml | 9 + .idea/misc.xml | 6 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + OOPClss/.idea/OOPClss.iml | 9 + OOPClss/.idea/misc.xml | 6 + OOPClss/.idea/modules.xml | 8 + OOPClss/.idea/vcs.xml | 6 + OOPClss/.idea/workspace.xml | 79 ++++++ OOPClss/Book.java | 22 ++ OOPClss/EcommerceOrderSystem/.gitignore | 29 ++ OOPClss/EcommerceOrderSystem/.idea/.gitignore | 3 + OOPClss/EcommerceOrderSystem/.idea/misc.xml | 6 + .../EcommerceOrderSystem/.idea/modules.xml | 8 + OOPClss/EcommerceOrderSystem/.idea/vcs.xml | 6 + .../EcommerceOrderSystem.iml | 11 + .../src/com/ecommerce/app/EcommerceApp.java | 11 + .../com/ecommerce/model/address/Address.java | 26 ++ .../src/com/ecommerce/model/cart/Cart.java | 26 ++ .../ecommerce/model/cartItem/CartItem.java | 25 ++ .../ecommerce/model/customer/Customer.java | 51 ++++ .../src/com/ecommerce/model/order/Order.java | 29 ++ .../ecommerce/model/orderitem/Orderitem.java | 23 ++ .../com/ecommerce/model/payment/Payment.java | 32 +++ .../model/paymentMethod/PaymentMethod.java | 7 + .../com/ecommerce/model/product/Product.java | 25 ++ .../ecommerce/model/shipment/Shipment.java | 32 +++ OOPClss/Eventful/.gitignore | 29 ++ OOPClss/Eventful/.idea/.gitignore | 3 + OOPClss/Eventful/.idea/misc.xml | 6 + OOPClss/Eventful/.idea/modules.xml | 8 + OOPClss/Eventful/.idea/vcs.xml | 6 + OOPClss/Eventful/Eventful.iml | 11 + .../Eventful/src/com/eventful/Eventful.java | 67 +++++ .../Eventful/src/com/eventful/app/Main.java | 7 + .../src/com/eventful/model/Category.java | 9 + .../src/com/eventful/model/Performer.java | 47 ++++ OOPClss/Exercises.class | Bin 0 -> 1560 bytes OOPClss/Exercises.java | 102 +++++++ OOPClss/ExercisesSummer2025/Enumeration.class | Bin 0 -> 701 bytes OOPClss/ExercisesSummer2025/Enumeration.java | 13 + .../ExercisesSummer2025/OneThrough50.class | Bin 0 -> 5552 bytes OOPClss/ExercisesSummer2025/OneThrough50.java | 253 ++++++++++++++++++ .../ProblemSets/BankAccount/BankAccount.class | Bin 0 -> 1329 bytes .../ProblemSets/BankAccount/BankAccount.java | 40 +++ .../ProblemSets/BankAccount/Main.class | Bin 0 -> 710 bytes .../ProblemSets/BankAccount/Main.java | 10 + .../ProblemSets/Book.class | Bin 0 -> 624 bytes .../ExercisesSummer2025/ProblemSets/Book.java | 18 ++ .../ProblemSets/Main.class | Bin 0 -> 561 bytes .../ExercisesSummer2025/ProblemSets/Main.java | 6 + .../ProblemSets/PersonInheritanc/Person.class | Bin 0 -> 1556 bytes .../ProblemSets/PersonInheritanc/Person.java | 36 +++ .../PersonInheritanc/Student.class | Bin 0 -> 272 bytes .../ProblemSets/PersonInheritanc/Student.java | 8 + .../PersonInheritanc/Teacher.class | Bin 0 -> 811 bytes .../ProblemSets/PersonInheritanc/Teacher.java | 23 ++ OOPClss/ExercisesSummer2025/daysOfWeek.class | Bin 0 -> 1140 bytes OOPClss/ExercisesSummer2025/daysOfWeek.java | 1 + OOPClss/GlovoApp/.idea/.gitignore | 3 + OOPClss/GlovoApp/.idea/misc.xml | 6 + OOPClss/GlovoApp/.idea/modules.xml | 8 + OOPClss/GlovoApp/.idea/vcs.xml | 6 + OOPClss/GlovoApp/GlovoApp.iml | 11 + .../GlovoApp/src/com/glovo/app/GlovoApp.java | 42 +++ .../src/com/glovo/model/Courrier.java | 77 ++++++ .../src/com/glovo/model/Customer.java | 43 +++ .../GlovoApp/src/com/glovo/model/Order.java | 69 +++++ .../src/com/glovo/model/OrderStatus.java | 8 + .../src/com/glovo/model/Restaurant.java | 41 +++ OOPClss/GlovoAppOmarBelkady.zip | Bin 0 -> 3650 bytes OOPClss/Library.java | 9 + OOPClss/LibraryApp/.gitignore | 29 ++ OOPClss/LibraryApp/.idea/.gitignore | 3 + OOPClss/LibraryApp/.idea/misc.xml | 6 + OOPClss/LibraryApp/.idea/modules.xml | 8 + OOPClss/LibraryApp/.idea/vcs.xml | 6 + OOPClss/LibraryApp/Library.iml | 11 + .../src/com/library/app/LibraryApp.class | Bin 0 -> 1526 bytes .../src/com/library/app/LibraryApp.java | 52 ++++ .../src/com/library/book/Book.class | Bin 0 -> 1546 bytes .../LibraryApp/src/com/library/book/Book.java | 57 ++++ .../src/com/library/librarian/Librarian.class | Bin 0 -> 920 bytes .../src/com/library/librarian/Librarian.java | 38 +++ .../src/com/library/loan/Loan.class | Bin 0 -> 2715 bytes .../LibraryApp/src/com/library/loan/Loan.java | 97 +++++++ .../com/library/loanstatus/LoanStatus.class | Bin 0 -> 1080 bytes .../com/library/loanstatus/LoanStatus.java | 5 + .../src/com/library/member/Member.class | Bin 0 -> 1366 bytes .../src/com/library/member/Member.java | 48 ++++ OOPClss/Member.java | 9 + OOPClss/PayrollApp/untitled/.gitignore | 29 ++ OOPClss/PayrollApp/untitled/.idea/.gitignore | 3 + OOPClss/PayrollApp/untitled/.idea/misc.xml | 6 + OOPClss/PayrollApp/untitled/.idea/modules.xml | 8 + OOPClss/PayrollApp/untitled/.idea/vcs.xml | 6 + OOPClss/PayrollApp/untitled/src/Main.class | Bin 0 -> 621 bytes OOPClss/PayrollApp/untitled/src/Main.java | 12 + .../src/com/payroll/employee/Employee.class | Bin 0 -> 1132 bytes .../src/com/payroll/employee/Employee.java | 23 ++ OOPClss/PayrollApp/untitled/untitled.iml | 11 + OOPClss/RideSharingApp/.gitignore | 29 ++ OOPClss/RideSharingApp/.idea/.gitignore | 3 + OOPClss/RideSharingApp/.idea/misc.xml | 6 + OOPClss/RideSharingApp/.idea/modules.xml | 8 + OOPClss/RideSharingApp/.idea/vcs.xml | 6 + OOPClss/RideSharingApp/RideSharingApp.iml | 11 + .../entities/driver/Driver.java | 53 ++++ .../ridesharingapp/entities/rider/Rider.java | 52 ++++ .../ridesharingapp/entities/trip/Trip.java | 93 +++++++ .../entities/tripstatus/TripStatus.java | 18 ++ .../entities/vehicle/Vehicle.java | 49 ++++ .../src/com/ridesharingapp/main/Menu.java | 112 ++++++++ .../ridesharingapp/main/RideSharingApp.java | 40 +++ .../SimpleOrderRegistry/.idea/workspace.xml | 124 +++++++++ OOPClss/StudentApp/StudentApp/pom.xml | 13 + .../students/studentapp/AcademicStatus.java | 10 + .../java/aui/students/studentapp/Address.java | 90 +++++++ .../java/aui/students/studentapp/Student.java | 100 +++++++ .../aui/students/studentapp/StudentApp.java | 105 ++++++++ StudentApp/untitled/.gitignore | 29 ++ StudentApp/untitled/.idea/.gitignore | 3 + StudentApp/untitled/.idea/misc.xml | 6 + StudentApp/untitled/.idea/modules.xml | 8 + StudentApp/untitled/.idea/vcs.xml | 6 + StudentApp/untitled/src/Main.java | 5 + .../untitled/src/aui/students/Students.java | 21 ++ StudentApp/untitled/untitled.iml | 11 + UML/Library/Book.java | 19 ++ UML/Library/Librarian.java | 8 + UML/Library/Loan.java | 14 + UML/Library/Member.java | 20 ++ UML/Library/User.java | 6 + 134 files changed, 3083 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/Java.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 OOPClss/.idea/OOPClss.iml create mode 100644 OOPClss/.idea/misc.xml create mode 100644 OOPClss/.idea/modules.xml create mode 100644 OOPClss/.idea/vcs.xml create mode 100644 OOPClss/.idea/workspace.xml create mode 100644 OOPClss/Book.java create mode 100644 OOPClss/EcommerceOrderSystem/.gitignore create mode 100644 OOPClss/EcommerceOrderSystem/.idea/.gitignore create mode 100644 OOPClss/EcommerceOrderSystem/.idea/misc.xml create mode 100644 OOPClss/EcommerceOrderSystem/.idea/modules.xml create mode 100644 OOPClss/EcommerceOrderSystem/.idea/vcs.xml create mode 100644 OOPClss/EcommerceOrderSystem/EcommerceOrderSystem.iml create mode 100644 OOPClss/EcommerceOrderSystem/src/com/ecommerce/app/EcommerceApp.java create mode 100644 OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/address/Address.java create mode 100644 OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/cart/Cart.java create mode 100644 OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/cartItem/CartItem.java create mode 100644 OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/customer/Customer.java create mode 100644 OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/order/Order.java create mode 100644 OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/orderitem/Orderitem.java create mode 100644 OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/payment/Payment.java create mode 100644 OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/paymentMethod/PaymentMethod.java create mode 100644 OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/product/Product.java create mode 100644 OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/shipment/Shipment.java create mode 100644 OOPClss/Eventful/.gitignore create mode 100644 OOPClss/Eventful/.idea/.gitignore create mode 100644 OOPClss/Eventful/.idea/misc.xml create mode 100644 OOPClss/Eventful/.idea/modules.xml create mode 100644 OOPClss/Eventful/.idea/vcs.xml create mode 100644 OOPClss/Eventful/Eventful.iml create mode 100644 OOPClss/Eventful/src/com/eventful/Eventful.java create mode 100644 OOPClss/Eventful/src/com/eventful/app/Main.java create mode 100644 OOPClss/Eventful/src/com/eventful/model/Category.java create mode 100644 OOPClss/Eventful/src/com/eventful/model/Performer.java create mode 100644 OOPClss/Exercises.class create mode 100644 OOPClss/Exercises.java create mode 100644 OOPClss/ExercisesSummer2025/Enumeration.class create mode 100644 OOPClss/ExercisesSummer2025/Enumeration.java create mode 100644 OOPClss/ExercisesSummer2025/OneThrough50.class create mode 100644 OOPClss/ExercisesSummer2025/OneThrough50.java create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/BankAccount.class create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/BankAccount.java create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/Main.class create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/Main.java create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/Book.class create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/Book.java create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/Main.class create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/Main.java create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Person.class create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Person.java create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Student.class create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Student.java create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Teacher.class create mode 100644 OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Teacher.java create mode 100644 OOPClss/ExercisesSummer2025/daysOfWeek.class create mode 100644 OOPClss/ExercisesSummer2025/daysOfWeek.java create mode 100644 OOPClss/GlovoApp/.idea/.gitignore create mode 100644 OOPClss/GlovoApp/.idea/misc.xml create mode 100644 OOPClss/GlovoApp/.idea/modules.xml create mode 100644 OOPClss/GlovoApp/.idea/vcs.xml create mode 100644 OOPClss/GlovoApp/GlovoApp.iml create mode 100644 OOPClss/GlovoApp/src/com/glovo/app/GlovoApp.java create mode 100644 OOPClss/GlovoApp/src/com/glovo/model/Courrier.java create mode 100644 OOPClss/GlovoApp/src/com/glovo/model/Customer.java create mode 100644 OOPClss/GlovoApp/src/com/glovo/model/Order.java create mode 100644 OOPClss/GlovoApp/src/com/glovo/model/OrderStatus.java create mode 100644 OOPClss/GlovoApp/src/com/glovo/model/Restaurant.java create mode 100644 OOPClss/GlovoAppOmarBelkady.zip create mode 100644 OOPClss/Library.java create mode 100644 OOPClss/LibraryApp/.gitignore create mode 100644 OOPClss/LibraryApp/.idea/.gitignore create mode 100644 OOPClss/LibraryApp/.idea/misc.xml create mode 100644 OOPClss/LibraryApp/.idea/modules.xml create mode 100644 OOPClss/LibraryApp/.idea/vcs.xml create mode 100644 OOPClss/LibraryApp/Library.iml create mode 100644 OOPClss/LibraryApp/src/com/library/app/LibraryApp.class create mode 100644 OOPClss/LibraryApp/src/com/library/app/LibraryApp.java create mode 100644 OOPClss/LibraryApp/src/com/library/book/Book.class create mode 100644 OOPClss/LibraryApp/src/com/library/book/Book.java create mode 100644 OOPClss/LibraryApp/src/com/library/librarian/Librarian.class create mode 100644 OOPClss/LibraryApp/src/com/library/librarian/Librarian.java create mode 100644 OOPClss/LibraryApp/src/com/library/loan/Loan.class create mode 100644 OOPClss/LibraryApp/src/com/library/loan/Loan.java create mode 100644 OOPClss/LibraryApp/src/com/library/loanstatus/LoanStatus.class create mode 100644 OOPClss/LibraryApp/src/com/library/loanstatus/LoanStatus.java create mode 100644 OOPClss/LibraryApp/src/com/library/member/Member.class create mode 100644 OOPClss/LibraryApp/src/com/library/member/Member.java create mode 100644 OOPClss/Member.java create mode 100644 OOPClss/PayrollApp/untitled/.gitignore create mode 100644 OOPClss/PayrollApp/untitled/.idea/.gitignore create mode 100644 OOPClss/PayrollApp/untitled/.idea/misc.xml create mode 100644 OOPClss/PayrollApp/untitled/.idea/modules.xml create mode 100644 OOPClss/PayrollApp/untitled/.idea/vcs.xml create mode 100644 OOPClss/PayrollApp/untitled/src/Main.class create mode 100644 OOPClss/PayrollApp/untitled/src/Main.java create mode 100644 OOPClss/PayrollApp/untitled/src/com/payroll/employee/Employee.class create mode 100644 OOPClss/PayrollApp/untitled/src/com/payroll/employee/Employee.java create mode 100644 OOPClss/PayrollApp/untitled/untitled.iml create mode 100644 OOPClss/RideSharingApp/.gitignore create mode 100644 OOPClss/RideSharingApp/.idea/.gitignore create mode 100644 OOPClss/RideSharingApp/.idea/misc.xml create mode 100644 OOPClss/RideSharingApp/.idea/modules.xml create mode 100644 OOPClss/RideSharingApp/.idea/vcs.xml create mode 100644 OOPClss/RideSharingApp/RideSharingApp.iml create mode 100644 OOPClss/RideSharingApp/src/com/ridesharingapp/entities/driver/Driver.java create mode 100644 OOPClss/RideSharingApp/src/com/ridesharingapp/entities/rider/Rider.java create mode 100644 OOPClss/RideSharingApp/src/com/ridesharingapp/entities/trip/Trip.java create mode 100644 OOPClss/RideSharingApp/src/com/ridesharingapp/entities/tripstatus/TripStatus.java create mode 100644 OOPClss/RideSharingApp/src/com/ridesharingapp/entities/vehicle/Vehicle.java create mode 100644 OOPClss/RideSharingApp/src/com/ridesharingapp/main/Menu.java create mode 100644 OOPClss/RideSharingApp/src/com/ridesharingapp/main/RideSharingApp.java create mode 100644 OOPClss/SimpleOrderRegistry/.idea/workspace.xml create mode 100644 OOPClss/StudentApp/StudentApp/pom.xml create mode 100644 OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/AcademicStatus.java create mode 100644 OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/Address.java create mode 100644 OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/Student.java create mode 100644 OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/StudentApp.java create mode 100644 StudentApp/untitled/.gitignore create mode 100644 StudentApp/untitled/.idea/.gitignore create mode 100644 StudentApp/untitled/.idea/misc.xml create mode 100644 StudentApp/untitled/.idea/modules.xml create mode 100644 StudentApp/untitled/.idea/vcs.xml create mode 100644 StudentApp/untitled/src/Main.java create mode 100644 StudentApp/untitled/src/aui/students/Students.java create mode 100644 StudentApp/untitled/untitled.iml create mode 100644 UML/Library/Book.java create mode 100644 UML/Library/Librarian.java create mode 100644 UML/Library/Loan.java create mode 100644 UML/Library/Member.java create mode 100644 UML/Library/User.java diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/Java.iml b/.idea/Java.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/Java.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..e9710cf --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..11e3c07 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/.idea/OOPClss.iml b/OOPClss/.idea/OOPClss.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/OOPClss/.idea/OOPClss.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/OOPClss/.idea/misc.xml b/OOPClss/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/OOPClss/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/.idea/modules.xml b/OOPClss/.idea/modules.xml new file mode 100644 index 0000000..0ef7a57 --- /dev/null +++ b/OOPClss/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/OOPClss/.idea/vcs.xml b/OOPClss/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/OOPClss/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/.idea/workspace.xml b/OOPClss/.idea/workspace.xml new file mode 100644 index 0000000..66bcd17 --- /dev/null +++ b/OOPClss/.idea/workspace.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1751049426267 + + + + \ No newline at end of file diff --git a/OOPClss/Book.java b/OOPClss/Book.java new file mode 100644 index 0000000..a7f5182 --- /dev/null +++ b/OOPClss/Book.java @@ -0,0 +1,22 @@ +import java.util.*; + + +public class Book{ + public String title; + public String author; + public String isbn; + + public Book(String title, String author, String isbn){ + this.title=title; + this.author=author; + this.isbn=isbn; + } + + public void getInfo(){ + System.out.println("The book has a title"+title+" and an author "+author+" with an ISBN number of: "+isbn) + } + + public String toString(){ + return "Book [Title: " + title + ", Author: " + author + " ,ISBN: " + "]"; + } +} \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/.gitignore b/OOPClss/EcommerceOrderSystem/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/.idea/.gitignore b/OOPClss/EcommerceOrderSystem/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/OOPClss/EcommerceOrderSystem/.idea/misc.xml b/OOPClss/EcommerceOrderSystem/.idea/misc.xml new file mode 100644 index 0000000..454992c --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/.idea/modules.xml b/OOPClss/EcommerceOrderSystem/.idea/modules.xml new file mode 100644 index 0000000..bb53f41 --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/.idea/vcs.xml b/OOPClss/EcommerceOrderSystem/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/EcommerceOrderSystem.iml b/OOPClss/EcommerceOrderSystem/EcommerceOrderSystem.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/EcommerceOrderSystem.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/src/com/ecommerce/app/EcommerceApp.java b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/app/EcommerceApp.java new file mode 100644 index 0000000..34eee62 --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/app/EcommerceApp.java @@ -0,0 +1,11 @@ +package com.ecommerce.app; + +import com.ecommerce.model.customer.Customer; +import com.ecommerce.model.address.Address; +import java.util.Scanner; + + + +public class EcommerceApp { + +} \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/address/Address.java b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/address/Address.java new file mode 100644 index 0000000..cf77ee4 --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/address/Address.java @@ -0,0 +1,26 @@ +package com.ecommerce.model.address; + + +public class Address{ + private String street; + private String city; + private String state; + private String zip; + + public Address(String street, String city, String state, String zip) { + this.street = street; + this.city = city; + this.state = state; + this.zip = zip; + } + + @Override + public String toString() { + return "Address{" + + "street='" + street + '\'' + + ", city='" + city + '\'' + + ", state='" + state + '\'' + + ", zip='" + zip + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/cart/Cart.java b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/cart/Cart.java new file mode 100644 index 0000000..e67857b --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/cart/Cart.java @@ -0,0 +1,26 @@ +package com.ecommerce.model.customer; +package com.ecommerce.model.cartItem; +package com.ecommerce.model.cart; + + +public class Cart{ + private Customer customer; + private CartItem items[]; + + public Cart(Customer customer){ + this.customer=customer; + } + + public void addItem(CartItem item){ + + } + @Override + public String toString() { + return "Cart{" + + "customer=" + customer + + ", items=" + java.util.Arrays.toString(items) + + '}'; + } + + +} \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/cartItem/CartItem.java b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/cartItem/CartItem.java new file mode 100644 index 0000000..e78c2fc --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/cartItem/CartItem.java @@ -0,0 +1,25 @@ +package com.ecommerce.model.address; +package com.ecommerce.model.cart; +package com.ecommerce.model.orderItem; +package com.ecommerce.model.product; +package com.ecommerce.model.cartItem; + + +public class CartItem{ + private Product product; + private int quantity; + + public CartItem(Product product, int quantity){ + this.product=product; + this.quantity=quantity; + } + + @Override + public String toString() { + return "CartItem{" + + "product=" + product + + ", quantity=" + quantity + + '}'; + } + +} \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/customer/Customer.java b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/customer/Customer.java new file mode 100644 index 0000000..30f61fc --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/customer/Customer.java @@ -0,0 +1,51 @@ +package com.ecommerce.model.address; +package com.ecommerce.model.customer; + + +public class Customer{ + int id; + String name; + String email; + Address billingAddress; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Address getBillingAddress() { + return billingAddress; + } + + public void setBillingAddress(Address billingAddress) { + this.billingAddress = billingAddress; + } + + public Customer(int id, String name, String email, Address billingAddress) { + this.id = id; + this.name = name; + this.email = email; + this.billingAddress = billingAddress; + } + + +} \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/order/Order.java b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/order/Order.java new file mode 100644 index 0000000..8cdf5c5 --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/order/Order.java @@ -0,0 +1,29 @@ +package com.ecommerce.model.order; +package com.ecommerce.model.customer; +package com.ecommerce.model.orderitem; + +public class Order{ + private int orderId; + private LocalDate date; + private Customer customer; + private Orderitem orderitem[]; + + + public Order(int orderId, Customer customer, Orderitem orderitem){ + this.orderId=orderId; + this.customer=customer; + this.orderitem=orderitem; + } + + @Override + public String toString() { + return "Order{" + + "orderId=" + orderId + + ", date=" + date + + ", customer=" + customer + + ", orderitem=" + java.util.Arrays.toString(orderitem) + + '}'; + } + + +} \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/orderitem/Orderitem.java b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/orderitem/Orderitem.java new file mode 100644 index 0000000..a918157 --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/orderitem/Orderitem.java @@ -0,0 +1,23 @@ +package com.ecommerce.model.orderitem; + +public class Orderitem{ + private Product product; + private int quantity; + private double lineTotal; + + public Orderitem(Product product, int quantity){ + this.product=product; + this.quantity=quantity + } + + @Override + public String toString() { + return "Orderitem{" + + "product=" + product + + ", quantity=" + quantity + + ", lineTotal=" + lineTotal + + '}'; + } + + +} \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/payment/Payment.java b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/payment/Payment.java new file mode 100644 index 0000000..880206f --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/payment/Payment.java @@ -0,0 +1,32 @@ + +package com.ecommerce.model.payment; + +import java.time.LocalDate; +import com.ecommerce.model.paymentMethod.PaymentMethod; + + + +public class Payment{ + private int paymentId; + private double amount; + private LocalDate date; + private PaymentMethod method; + + public Payment(int paymentId, double amount, LocalDate date, PaymentMethod method){ + this.paymentId=paymentId; + this.amount=amount; + this.date=date; + this.method=method; + } + + @Override + public String toString() { + return "Payment{" + + "paymentId=" + paymentId + + ", amount=" + amount + + ", date=" + date + + ", method=" + method + + '}'; + } + +} \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/paymentMethod/PaymentMethod.java b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/paymentMethod/PaymentMethod.java new file mode 100644 index 0000000..a5470c3 --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/paymentMethod/PaymentMethod.java @@ -0,0 +1,7 @@ +package com.ecommerce.model.paymentMethod; + +public enum PaymentMethod{ + CASH, + CREDIT_CARD, + PAYPAL +} \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/product/Product.java b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/product/Product.java new file mode 100644 index 0000000..fd1abb4 --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/product/Product.java @@ -0,0 +1,25 @@ +package com.ecommerce.model.product; + +public class Product{ + private String sku; + private String name; + private double price; + private int quantityInStock; + + public Product(String sku, String name, double price, int quantityInStock){ + this.sku=sku; + this.name=name; + this.price=price; + this.quantityInStock=quantityInStock; + } + + @Override + public String toString(){ + return "Product{" + + "sku='" + sku + '\'' + + ", name='" + name + '\'' + + ", price=" + price + + ", quantityInStock=" + quantityInStock + + '}'; + } +} \ No newline at end of file diff --git a/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/shipment/Shipment.java b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/shipment/Shipment.java new file mode 100644 index 0000000..d53ae56 --- /dev/null +++ b/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/shipment/Shipment.java @@ -0,0 +1,32 @@ +package com.ecommerce.model.shipment; + +import java.time.LocalDate; +import com.ecommerce.model.order.Order; + + +public class Shipment{ + private int shipmentId; + private Order order; + private LocalDate shipDate; + private String carrier; + + + public Shipment(int shipmentId, Order order, LocalDate shipDate, String carrier){ + this.shipmentId=shipmentId; + this.order=order; + this.shipDate=shipDate; + this.carrier=carrier; + } + + @Override + public String toString() { + return "Shipment{" + + "shipmentId=" + shipmentId + + ", order=" + order + + ", shipDate=" + shipDate + + ", carrier='" + carrier + '\'' + + '}'; + } + + +} \ No newline at end of file diff --git a/OOPClss/Eventful/.gitignore b/OOPClss/Eventful/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/OOPClss/Eventful/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/OOPClss/Eventful/.idea/.gitignore b/OOPClss/Eventful/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/OOPClss/Eventful/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/OOPClss/Eventful/.idea/misc.xml b/OOPClss/Eventful/.idea/misc.xml new file mode 100644 index 0000000..454992c --- /dev/null +++ b/OOPClss/Eventful/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/Eventful/.idea/modules.xml b/OOPClss/Eventful/.idea/modules.xml new file mode 100644 index 0000000..ee6c8eb --- /dev/null +++ b/OOPClss/Eventful/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/OOPClss/Eventful/.idea/vcs.xml b/OOPClss/Eventful/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/OOPClss/Eventful/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/Eventful/Eventful.iml b/OOPClss/Eventful/Eventful.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/OOPClss/Eventful/Eventful.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/OOPClss/Eventful/src/com/eventful/Eventful.java b/OOPClss/Eventful/src/com/eventful/Eventful.java new file mode 100644 index 0000000..bb7dfb0 --- /dev/null +++ b/OOPClss/Eventful/src/com/eventful/Eventful.java @@ -0,0 +1,67 @@ +package com.eventful; + +import java.util.GregorianCalendar; +import java.text.SimpleDateFormat; + + + +public class Eventful { + private String title; + private Category category; + private GregorianCalendar time; + private Performer performer; + + public Eventful(String title, Category category, GregorianCalendar time, Performer performer){ + this.title=title; + this.category=category; + this.time=time; + this.performer=performer; + } + + public Event(String title, Category category, Performer performer){ + this(title,category, new GregorianCalendar(),performer); + } + + public getTitle(){ + return title; + } + + public void setTitle(String title) { + this.title=title; + } + + + public Category getCategory(){ + return category; + } + + public void setCategory(Category category){ + this.category=category; + } + + + public GregorianCalendar getTime() { + return time; + } + + public void setTime(GregorianCalendar time){ + this.time=time; + } + + public Performer getPerformer() { + return performer; + } + + public void setPerformer(Performer performer){ + this.performer=performer; + } + + @Override + public String toString(){ + SimpleDateFormat fmt= new SimpleDateFormat("dd/mm/yyyy"); + String dateStr = fmt.format(time.getTime()); + + return String.format("Event[title=%s, category=%s, date=%s, performance=%s]",title,categoryy,date,performance); + + } +} \ No newline at end of file diff --git a/OOPClss/Eventful/src/com/eventful/app/Main.java b/OOPClss/Eventful/src/com/eventful/app/Main.java new file mode 100644 index 0000000..00ab79e --- /dev/null +++ b/OOPClss/Eventful/src/com/eventful/app/Main.java @@ -0,0 +1,7 @@ +package com.eventful.app; +public class Main { + public static void main(String[] args) + { + System.out.println("Hello, World!"); + } +} \ No newline at end of file diff --git a/OOPClss/Eventful/src/com/eventful/model/Category.java b/OOPClss/Eventful/src/com/eventful/model/Category.java new file mode 100644 index 0000000..d91df2c --- /dev/null +++ b/OOPClss/Eventful/src/com/eventful/model/Category.java @@ -0,0 +1,9 @@ +package com.eventful.model.category; + +public enum Category{ + MUSIC, + THEATER, + SPORTS, + CONFERENCE, + OTHER +} \ No newline at end of file diff --git a/OOPClss/Eventful/src/com/eventful/model/Performer.java b/OOPClss/Eventful/src/com/eventful/model/Performer.java new file mode 100644 index 0000000..e87b72a --- /dev/null +++ b/OOPClss/Eventful/src/com/eventful/model/Performer.java @@ -0,0 +1,47 @@ +package com.eventful.model.Performer; + +public class Performer { + private String name; + private char gender; + private int num_performances; + private int age; + private List performances; + + public Performer(String name, char gender, int num_performances, int age, List performances){ + this.name=name; + this.gender=gender; + this.num_performances=num_performances; + this.age=age; + this.performances=performances; + } + + public String getName(){ + return name; + } + + public void setName(String name){ + this.name=name; + } + + public char getGender(){ + return gender; + } + + public void setGender(char gender){ + this.gender=gender + } + + public int getNum_performances(){ + return num_performances; + } + + public void setPerformances(List performances){ + this.performance=performances; + } + + + @Override + public String toString(){ + return("Performer{name=%s, gender=%c, age=%d, performances=%d", name,gender,age,performances); + } +} \ No newline at end of file diff --git a/OOPClss/Exercises.class b/OOPClss/Exercises.class new file mode 100644 index 0000000000000000000000000000000000000000..c77dc5724c8d0f3c25e1c2e9ec6afdf72b14caea GIT binary patch literal 1560 zcmZuwT~ixX7=BKY%_d<9TS(FxK3Y&}2wy^NS_G<;Ld6nN4K2-Z(#;1?1;TT#=hkls1T!P|qlh4CB4(ij)_>fKNBebIrB|)N zpya9sa%+=!eb=iO>%MfVvoXZcWx}>_4&4GhZ}AZ@pQwn6ClJc4jNFePAzo9bwxvMV zs_V&Cx^-u(LJbK`kw&rZl=t$^6RkCIOCYeh!mz62auBJ^=G(f>bAZ*YCx{;?2zpF%u8{Y}LNbZm<7K#;c(lNsnDLXt=~sWlP!69Li9E5|`N#o=}vxF&kH1F1Z8Iu~_S;3SYu=18 && age<=65){ + System.out.println("Adult"); + } + else{ + System.out.println("Senior Citizen"); + } + } + public static void findNumber(int myArr[], int toSearch){ + for(int i=0;ij%fu z3Oy9#G|$99j?zq9B@X3Sqyu4(mH4RChnF6znB$oDv4BN}g&X)7_^D%$4G9Ln6(_Be zoHj?zu**?rn46U5R>x7NFO5-|bJ6f|7xx$n+ExE+_q93A|F-L)h6nCqmKYj;_{q^# zNZ56thdu;W7|KR{vMp^C!(tF#Z^*+c);J#fSjQ6vk30|Cg9EZlRz@<;ReQi7ZnDz4 z#5OrXhM89;PgEwYPRT%NCp{$9Stq`iCq0$z%U(>GQX-wfdhq^wJ7Jf4=+G4UYF9gO z^$O>FS=)-Y5)KL literal 0 HcmV?d00001 diff --git a/OOPClss/ExercisesSummer2025/Enumeration.java b/OOPClss/ExercisesSummer2025/Enumeration.java new file mode 100644 index 0000000..175694c --- /dev/null +++ b/OOPClss/ExercisesSummer2025/Enumeration.java @@ -0,0 +1,13 @@ +import java.util.*; + + + +public class Enumeration{ + public static void main(String [] args){ + System.out.println("What is your favorite day of the week?"); + Scanner sc=new Scanner(System.in); + String dayst = sc.nextLine(); + daysOfWeek day = daysOfWeek.valueOf(dayst); + + } +} \ No newline at end of file diff --git a/OOPClss/ExercisesSummer2025/OneThrough50.class b/OOPClss/ExercisesSummer2025/OneThrough50.class new file mode 100644 index 0000000000000000000000000000000000000000..6a488eb4a85caefb98754c141174306826bab58b GIT binary patch literal 5552 zcma)A33wFc8Ga|(E6b2$3D<1E1pyO4!CMT(01*iSL6ZUrDonByc4f1Z?oI;nsd^grXqAItD=B z54^D_>sTFxvb%^hc&;Lpv?nddB-2i#ld;T>>LL`QB#2TSWr%3d8`4%&B4c+gPaHp) zm~nf#25m-!l9lTij3F9^c9<)ynRdF(bQUF@1Xo$dOg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mV?d00001 diff --git a/OOPClss/ExercisesSummer2025/OneThrough50.java b/OOPClss/ExercisesSummer2025/OneThrough50.java new file mode 100644 index 0000000..bfba363 --- /dev/null +++ b/OOPClss/ExercisesSummer2025/OneThrough50.java @@ -0,0 +1,253 @@ +//exercise 1 +import java.util.*; + + +public class OneThrough50{ + byte dog; + short alpha; + int a; + long b; + float c; + double d; + char f; + boolean g; + public void printDefault(){ + System.out.println("byte default: "+dog); + System.out.println("short default: "+alpha); + System.out.println("int default: "+a); + System.out.println("long default: "+b); + System.out.println("float default: "+c); + System.out.println("double default: "+d); + System.out.println("char default: "+f); + System.out.println("boolean default: "+g); + } + public static void intToDouble(){ + int x; + System.out.println("What is your desired number i will convert it to a double"); + Scanner sc = new Scanner(System.in); + x=sc.nextInt(); + double y=(double)x; + System.out.println("The value of x is now: "+y); + } + static String name="Omar Belkady"; + public static void swap(int a, int b){ + System.out.println("A is "+a+ " B is: "+b); + int temp = a; + a=b; + b=temp; + System.out.println("Now A is "+a+ " B is: "+b); + } + public static void swap2vars(int x,int y){ + System.out.println("X is "+x+" y is: "+y); + x=x+y; + y=x-y; + x=x-y; + System.out.println("X is now: "+x+" and y is now: "+y); + } + public static int sum(int a, int b){ + return a+b; + } + + public static double area(int radius){ + return (Math.PI)*(Math.pow(radius,2)); + } + + public static double celsiToFahrenheight(double cels){ + double toReturn = (1.8*cels)+32; + return toReturn; + } + + public static double secToHoursMinutesSecond(double seconds, int option){ + if(option == 1){ + System.out.println("You are trying to convert seconds to hours"); + return(seconds/(60*60)); + } + else if(option == 2){ + System.out.println("You are trying to convert seconds to minutes"); + return(seconds/(60)); + } + else{ + System.out.println("You are trying to convert seconds to seconds"); + return seconds; + } + + } + + public static boolean areEqual(int num1, int num2){ + if(num1==num2){ + return true; + } + else{ + return false; + } + } + + public static int largestAmongThree(int a, int b, int c){ + int largest = a; + if(a>b && a>c){ + largest=a; + } + if(b>a && b>c){ + largest=b; + } + else{ + largest=c; + } + return largest; + } + + public static int factorial(int num){ + if(num==0){ + return 1; + } + else{ + return num*factorial(num-1); + } + } + + public static int evenOdd(int num){ + if((num%2)==0) + { + return 1; //even + } + else{ + return 2; //odd + } + } + + public static boolean leapYear(int year){ + if((year % 400)==0){ + return true; + } + else if((year % 100)==0){ + return false; + } + else if((year % 4)==0){ + return true; + } + return false; + } + + public static void posnegzero(int num){ + if(num<0){ + System.out.println("negative"); + } + else if(num>0){ + System.out.println("Positive"); + } + else{ + System.out.println("Zero"); + } + } + + public static int absofNum(int num){ + if(num<0){ + return (-1)*num; + } + else{ + return num; + } + } + public static int minoftwonums(int a, int b){ + int toReturn = (ay5HT@;sKCgs z+?Pu==~b7WmUopC2t@C=o*Ud12xqcegNR|!K-|O-Oo5?w={;X_9KYo;GUCa)5=d>H zfE0s<>s42DTGGTYMg)wqB)-Eyk=Oo|i8C6@kd;b9HJjQuW?~#?S+c2KFfONk6DB5+ zrcYLNZbAE|OkBXv0&&^x;rCXZzcvg^3(TB!QK;2aRo2!T)mB}3!Gjl$+6!FYi{YZc zxxCu*n{Hs$Tg|{KE35P6?yEQ~%xYfd1jaHy4wc=CAtP|L`0GB@yk;$t(T13k^3qJTVPo;XRSHDrtVMwz*CLY+2(@PBWHDX@%r|Hbuw02 z|F67?V*ytTESgxt)o-pV@3+b|5@YPkT1!3M);;I5eO-40R^qsh8wP&S2sZ_iCoFCH zURB^sW}`n#JDKw+7Pcs+Il{J&g#=pOTyJ z%k2f`3LDuisx9YNIPdVL>nYwl3Hn2J8K`tGlp&ddj!YB-={$cT_j&=b<7=XDsw!AN z)*}U;7l;M^@l>OkQ~Qh;{Z_+K4_(doNZ$%9YBDiRVTQO}QCe;Z-$GjXos&xMoK$z` zq@p_~Rm^h$g3le=Ren7~7=t`7+aDn8`8EtY(?-Ich_vyOJvPwBs67^K9qbfQ!G(-CgdviITmK*QNe|RYAKJuu{Z|kAavyZ{6zEAd zohJAc8M$x_Jxb^t^1Xhi*o$Dz0S){&U%F#QJI-m^2Y5)UIb7u}=+N0zHu?`jr7%;B gVkx3Ck1$^>X^itnxK=#E^4ssA=9v13z7QV&2Ni-AssI20 literal 0 HcmV?d00001 diff --git a/OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/BankAccount.java b/OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/BankAccount.java new file mode 100644 index 0000000..56a3c5e --- /dev/null +++ b/OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/BankAccount.java @@ -0,0 +1,40 @@ +public class BankAccount{ + private String name; + private double balance; + private String address; + private char sex; + private int age; + private long accountNum; + + public BankAccount(String name, double balance, String address, char sex, int age, long accountNum){ + this.name=name; + this.balance=balance; + this.address=address; + this.sex=sex; + this.age=age; + this.accountNum=accountNum; + } + + public void deposit(int amount){ + if(amount<=0){ + throw new IllegalArgumentException("Deposit must be positive"); + } + this.balance+=amount; + } + + public void withdraw(int amount){ + if(amount>this.balance){ + throw new IllegalArgumentException("You cannot withdraw more than the money you have"); + } + this.balance-=amount; + } + + public double getBalance(){ + return balance; + } + + @Override + public String toString(){ + return String.format("Bank Acoount{owner=%s, balance=%.2f, accountNumber=%d}",name, balance,accountNum); + } +} \ No newline at end of file diff --git a/OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/Main.class b/OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..5671236a6d99e5d29543d182f8efaa1749065084 GIT binary patch literal 710 zcmZWn-A)rx5dKd8c3W0xOR4w+EQ-3z)|P^ZNx=whNH9fB+B6ccw%fIw+TCs1U5U58 zhgZIUdQlQdcmQ9(chGk*&gq&U;ar?KXXcyvzM0IAKi|&*RPi{42%-{V3gSpGq z`~9i6Gx+>d#x%oHd3{4YG`Xub{9-}f4Msk93u^OqLEU|LX1hE>;RQp>-sb|G6vc|7RV<@OD)0SGpbo?q0Xt`qjV}AlGV4| zV+LO~R}Uh9pbSOD98?CeY}+>se%ErlCPTFPSFXE`)o&Mh!MutvXG_Mwy|x_=EvSfk z0;hVp7C@Xq<5GvIdr#^pvwfS%r$+qofiu1BgMtK>WGt&#!Ro)6M@^~ImF@Hl8vY2Hn=gSG$w literal 0 HcmV?d00001 diff --git a/OOPClss/ExercisesSummer2025/ProblemSets/Book.java b/OOPClss/ExercisesSummer2025/ProblemSets/Book.java new file mode 100644 index 0000000..7ab83c8 --- /dev/null +++ b/OOPClss/ExercisesSummer2025/ProblemSets/Book.java @@ -0,0 +1,18 @@ +import java.util.*; + +public class Book { + private String title; + private String author; + private String ISBN; + + public Book(String title, String author, String ISBN) { + this.title = title; + this.author = author; + this.ISBN = ISBN; + } + + @Override + public String toString(){ + return String.format("Book: {title='%s', author='%s', ISBN='%s'}",title, author,ISBN); + } +} \ No newline at end of file diff --git a/OOPClss/ExercisesSummer2025/ProblemSets/Main.class b/OOPClss/ExercisesSummer2025/ProblemSets/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..a767600f42cec8c75afb03ce231b1f8744dfef8c GIT binary patch literal 561 zcma)3$xZ@65Pc1U10x~~g1h1x&>-Oeaf0z6E*G~1Lt;EN*uiF*A;Vzwv-BW|CVqe) zWvs@75-;|lYw1_7UR8g5zPV+T3pBE^19t_ZY_Zq%FOD z27fwJ)e&US4jiWygu!5*xPp7BqlYd*xhEaF7ett0vV6zgw&KtRR(x*SYE1oOuM(ID9Of`f!rgS92NMd?qgvw*j6CG0S^l6a9 zH=T5Hm&EQ-55YSn1GAXZF(1YP78&A05u+Fey{jtPHj(_6`Msi&TFWx6<%~;0Xl3VC z&YM0J zQM5>wkqvAOz@Erq1jX=K`5~-gjckf?MJiJi$v5cNX2={jCkCYO8Rqs2W`1fT@Ds|9 P2s9+9hGCszA2z-KLVS4W literal 0 HcmV?d00001 diff --git a/OOPClss/ExercisesSummer2025/ProblemSets/Main.java b/OOPClss/ExercisesSummer2025/ProblemSets/Main.java new file mode 100644 index 0000000..307b90e --- /dev/null +++ b/OOPClss/ExercisesSummer2025/ProblemSets/Main.java @@ -0,0 +1,6 @@ +public class Main{ + public static void main(String [] args){ + Book myBook = new Book("Great Expectations", "Charles Dickens", "111-9598-98569-95"); + System.out.println(myBook); + } +} \ No newline at end of file diff --git a/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Person.class b/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Person.class new file mode 100644 index 0000000000000000000000000000000000000000..5abc541a174bab3a15262612b608adb6cf0e09d2 GIT binary patch literal 1556 zcmZ`(+j84f6kW%+qbN$^sJS%FrAe9)U(y;T+!{A+-IRjCaRLr5Zn+&hCyrWK>d113 z48w=;1-$Ukb|`7dl;MFVet|dM;1hVDY{_z>lrow*vd`IT?RD1PTfhDD)6W3bv8y72 zC`U{~90`Wx9dTdeOkp*1oAo=g;W8vH8J6K*W{9TJ)jlZb<4`s9L!+}T>9lQ&A!dn| zWY9~;_=@WoRx|G*1~m*JNerS%L9D1iXE@!(e(fRGmKNJf%XGT7xbuyQ5sY$-X&A?8 zhT&t%qUFk_bQt)3VRq!^F2h)=m<}ZkBJwKEV3K1>!!%}2T&pXKr0?2JOVIr;rb75Y z^zG1A*N1#KOAw`CmO(3+Mnlft6sBuiDqVKov+|s$EJP9@is>rHBI&QVogHbp3YN%~ zYj$150@5BZ!!Z6bppRT8qNU`w8^@~)c+ghBfPMD zKh|)WC@>8A^*lOePz+Z(!nLWcW2wMq|F{_J6T>>LbG)PB2HvGEJ7(yGkTH9r zU6x;wD(cf)9-^q>eSF~croTPX;|_H{}k9Ge=p@L}(=en4fv?aCIh*&X5>?OJ8n zxh?8ym&z$ci@L0WZH|vMRB@Bxl&|Y#3<-G-K#ZbwxWVzF- zOJ`fuP1@m2>6ZP$Iw?NrCaMGl6ugXG<8Aa_mHf0$iGM4pdyxxVs_l z`KdS>BtKltqZDez?l=v3!|(+4cW3s3cTvnyvqz}SBJ|ML!2d;KPVYFVH*t>EPw3x@ z_lcqRQ04$ElYI=HnR<+YhqT2|qg6+YR)y9+dQ=P&9m6f$4hW{{%_t(C`2qaF5iH?v z4$}H5KBLvk6%HNv{)JGTf<8ZDUGZfCllpM{86vf)$6l$$=r!;Jrz%e{@nWuVlJ^C^ z408PnP7h!nLaFIzlhX&7D;;8?roWOL8IJyWfYinzvNipDGNb24@Y(@Z%86$b9L-Xm zkc#U+N-_(c3Et}%RzGv2TF7=D4Wns|iLMC?a=^xgA6Jkuh+Y4c indivs = Arrays.asList(p,s,t); + for(Person person: indivs){ + System.out.println(indivs); + } + } +} \ No newline at end of file diff --git a/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Student.class b/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Student.class new file mode 100644 index 0000000000000000000000000000000000000000..759b1ff93217a2566934f2fd1def193d6031271d GIT binary patch literal 272 zcmZur!AiqW5S&e8(xk7c_MjJg@TOJF2UNTSgg_~Ui1)O4lqdBC(wF|12N68<1Nu?o zw0iV1JF~m9JNxgi9e@nO7#=zye1#JPf?%$jO>IdYj5Y32aDF{~Ew^R5F6}BUTx0BN zlHa^U=pqUcEA*fQVd2_JTPKJ%zbvl=k_#^W^Yehf&+1AG22*48tbJSP=DA#~*@=s~ zZI=4U9EAG2e1AxRE57xZT!?&pWWwlub`q*Pbl|h9@$Ka&WIXyn_x KC^)6|aP|X7<0J}c^C}2~^fkkh zy>~25#nwoK!!19JgK*f{b&kp?p=`k9xCPE&97@suAYhrnWKq^m$bYn>y0F(a4JTb+#fL1ZEsd#0_d1n!K#5Zj>mX%NnvWN z52E-)Pz_$(P`!6EF-^kn%$npiW^iuc?#^&?pywPhXgkq+ihO=A2<6-Cq$lG;G0w#t z%G95Bq^u5k)r+>{F_?ao#eMlEP;tuY847ockTd*MBs9 ze938c;L@z@niS3yTKRGXTBRrY1Ud92`6=jHZ9)HuJKdstj=JB~l!@O}UX=^n^Dpq| Ns%4#c>%=Ue{TJror<4Ey literal 0 HcmV?d00001 diff --git a/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Teacher.java b/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Teacher.java new file mode 100644 index 0000000..b4d6cc2 --- /dev/null +++ b/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Teacher.java @@ -0,0 +1,23 @@ +public class Teacher extends Person{ + private String subject; + private double salary; + + public Teacher(String name, int age, String subject, double salary){ + super(name, age); + this.subject=subject; + this.salary=salary; + } + + public String getSubject(){ + return subject; + } + + public double getSalary(){ + return salary; + } + + @Override + public String toString(){ + return String.format("Teacher{%s, subject='%s',salary=%.2f}",super.toString(), subject,salary); + } +} \ No newline at end of file diff --git a/OOPClss/ExercisesSummer2025/daysOfWeek.class b/OOPClss/ExercisesSummer2025/daysOfWeek.class new file mode 100644 index 0000000000000000000000000000000000000000..d873d4c3e5853ebe492b05cc0fc7f3db8f7a744c GIT binary patch literal 1140 zcmZuvZBNrs6n^fuu3f#bI$i`sKtNqVK~zND9LxccWH3WFNaLq63Jyn??1jYm#h;`l z5u(xX*&k&*_gbU`o3y9TbI*Cs%RRq-fBOlbfP#t$gTCv0XqEQ1UH5$g3^5J`afY~6 z*;vlo47_;ZkP#jlM?!k6mxPC)u5oZdspZOw6>!}gNx>zySC%*avDZ0Lg4N2eE1T!8 zy&Qc~admSoh`zxwApNX-xw09MLmW3TOlc;!@pdh+aL}lnG z*(e>UQ`5sINPnT<%XvgxB0{B-rS~P72y%ulZj@X_xoe2g7nn2DA7FOWN7S-oK2*zA zd>Wx0_t9n9st?1mH6J~eZ4lLOU9D2XB65N3$3V9FokUajqbGQ9jHm=NF$q)&W)%r^ r2_D8J=#pSgmB5hTktRWp1dolse*LF-a*V;NZAXGmmyoB + + + + + \ No newline at end of file diff --git a/OOPClss/GlovoApp/.idea/modules.xml b/OOPClss/GlovoApp/.idea/modules.xml new file mode 100644 index 0000000..832b34d --- /dev/null +++ b/OOPClss/GlovoApp/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/OOPClss/GlovoApp/.idea/vcs.xml b/OOPClss/GlovoApp/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/OOPClss/GlovoApp/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/GlovoApp/GlovoApp.iml b/OOPClss/GlovoApp/GlovoApp.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/OOPClss/GlovoApp/GlovoApp.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/OOPClss/GlovoApp/src/com/glovo/app/GlovoApp.java b/OOPClss/GlovoApp/src/com/glovo/app/GlovoApp.java new file mode 100644 index 0000000..cce7081 --- /dev/null +++ b/OOPClss/GlovoApp/src/com/glovo/app/GlovoApp.java @@ -0,0 +1,42 @@ +package com.glovo.app; +import com.glovo.model.Courrier; +import com.glovo.model.Customer; +import com.glovo.model.Order; +import com.glovo.model.OrderStatus; +import com.glovo.model.Restaurant; + + + +import java.util.*; + +public class GlovoApp { + public static void main(String [] args){ + Scanner sc = new Scanner(System.in); + System.out.println("Customer Name"); + String custName = sc.nextLine(); + + System.out.println("Customer Phone Number"); + String custPhone = sc.nextLine(); + + System.out.println("Customer Address"); + String custAddress = sc.nextLine(); + Customer customer = new Customer(custName,custPhone,custAddress); + + System.out.println("Restaurant Name"); + String restName = sc.nextLine(); + + System.out.println("Restaurant Address"); + String restAddress = sc.nextLine(); + + System.out.println("Restaurant Rating"); + double rating = Double.parseDouble(sc.nextLine()); + + Restaurant restaurant = new Restaurant(restName,restAddress,rating); + + Courrier cour1 = new Courrier("Mustapha", "061752525", "Van"); + + + + + } +} \ No newline at end of file diff --git a/OOPClss/GlovoApp/src/com/glovo/model/Courrier.java b/OOPClss/GlovoApp/src/com/glovo/model/Courrier.java new file mode 100644 index 0000000..a5db79b --- /dev/null +++ b/OOPClss/GlovoApp/src/com/glovo/model/Courrier.java @@ -0,0 +1,77 @@ +package com.glovo.model; +import java.time.LocalDate; + +//for getter setter select the field right click===> refactor==>encapsulate fields==>select fields + +public class Courrier{ + private String name; + private String phoneNumber; + private String vehicleType; + private boolean availability; + private LocalDate deliveryTime; + + public Courrier(String name, String phoneNumber, String vehicleType, boolean availability, LocalDate deliveryTime){ + this.name=name; + this.phoneNumber=phoneNumber; + this.vehicleType=vehicleType; + this.availability=availability; + this.setDeliveryTime(deliveryTime); + } + + public Courrier(String name, String phoneNumber, String vehicleType) + { + this(name,phoneNumber,vehicleType,true,LocalDate.now()); + } + + public void setName(String name){ + this.name=name; + } + + public String getName() + { + return name; + } + + public String getPhoneNumber() + { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber){ + this.phoneNumber=phoneNumber; + } + + public LocalDate getDeliveryTime() { + return deliveryTime; + } + + public void setDeliveryTime(LocalDate deliveryTime) { + this.deliveryTime = deliveryTime; + } + + public String getVehicleType(){ + return vehicleType; + } + + public void setVehicleType(String vehicleType){ + this.vehicleType=vehicleType; + } + + public boolean isAvailable(){ + return availability; + } + + public void setAvailability(boolean availability) + { + this.availability=availability; + } + + + + @Override + public String toString(){ + return String.format("The courrier assigned to this order is:%s and his phone number is: %s and is driving a %s and he/she is currently(not/is) %s available: and will be delivering the order at %s", name, phoneNumber, vehicleType, availability, deliveryTime); + } + + +} \ No newline at end of file diff --git a/OOPClss/GlovoApp/src/com/glovo/model/Customer.java b/OOPClss/GlovoApp/src/com/glovo/model/Customer.java new file mode 100644 index 0000000..4ed5d3b --- /dev/null +++ b/OOPClss/GlovoApp/src/com/glovo/model/Customer.java @@ -0,0 +1,43 @@ +package com.glovo.model; + +public class Customer { + private String name; + private String phoneNumber; + private String address; + + + public Customer(String name, String phoneNumber, String address) { + this.name = name; + this.phoneNumber = phoneNumber; + this.address = address; + } + + public String getName() { + return name; + } + + public String getPhoneNum() { + return phoneNumber; + } + + public void setPhoneNum(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public String toString() { + return String.format( + "Customer Name: %s, Phone Number: %s, Address: %s", + name, phoneNumber, address + ); + + } +} \ No newline at end of file diff --git a/OOPClss/GlovoApp/src/com/glovo/model/Order.java b/OOPClss/GlovoApp/src/com/glovo/model/Order.java new file mode 100644 index 0000000..b1afd2d --- /dev/null +++ b/OOPClss/GlovoApp/src/com/glovo/model/Order.java @@ -0,0 +1,69 @@ +package com.glovo.model; + +import java.time.LocalDate; + + +public class Order{ + private int orderId; + private LocalDate orderDate; + private String deliveryAddress; + private OrderStatus status; + private Customer customer; + private Courrier courrier; + private Restaurant restaurant; + + public Order(int orderId, String deliveryAddress, Customer customer, Courrier courrier, Restaurant restaurant) { + this(orderId, LocalDate.now(), deliveryAddress, OrderStatus.PENDING, customer, courrier, restaurant); + } + + public Order(int orderId, String deliveryAddress, Customer customer, Courrier courrier, Restaurant restaurant) { + this(orderId, LocalDate.now(), deliveryAddress, OrderStatus.PENDING, customer, courrier, restaurant); + } + + public Order(int orderId, LocalDate orderDate, String deliveryAddress, OrderStatus status, Customer customer, Courrier courrier, Restaurant restaurant) + { + this.orderId = orderId; + this.orderDate = orderDate; + this.deliveryAddress = deliveryAddress; + this.status = status; + this.customer = customer; + this.courrier = courrier; + this.restaurant = restaurant; + } + public int getOrderId(){ + return orderId; + } + + public LocalDate getOrderDate() { + return orderDate; + } + + public String getDeliveryAddress(){ + return deliveryAddress; + } + + public OrderStatus getStatus(){ + return status; + } + + public void setStatus(OrderStatus status){ + this.status=status; + } + + public Customer getCustomer(){ + return customer; + } + + public Courrier getCourrier(){ + return courrier; + } + + public Restaurant getRestaurant() { + return restaurant; + } + + @Override + public String toString(){ + return String.format("Order id: %d, Date: %s, Status: %s, Delivery Address: %s, Customer: %s, Courrier: %s, Restaurant: %s",orderId, orderDate,status,deliveryAddress,customer,courrier,restaurant); + } +} \ No newline at end of file diff --git a/OOPClss/GlovoApp/src/com/glovo/model/OrderStatus.java b/OOPClss/GlovoApp/src/com/glovo/model/OrderStatus.java new file mode 100644 index 0000000..42956fc --- /dev/null +++ b/OOPClss/GlovoApp/src/com/glovo/model/OrderStatus.java @@ -0,0 +1,8 @@ +package com.glovo.model; + + +public enum OrderStatus{ + PENDING, + DISPATCHED, + DELIVERED +} \ No newline at end of file diff --git a/OOPClss/GlovoApp/src/com/glovo/model/Restaurant.java b/OOPClss/GlovoApp/src/com/glovo/model/Restaurant.java new file mode 100644 index 0000000..de3145a --- /dev/null +++ b/OOPClss/GlovoApp/src/com/glovo/model/Restaurant.java @@ -0,0 +1,41 @@ +package com.glovo.model; + +public class Restaurant{ + private String name; + private String address; + private double rating; + + public Restaurant(String name, String address, double rating){ + this.name=name; + this.address=address; + this.rating=rating; + } + + public String getName(){ + return name; + } + + public String getAddress(){ + return address; + } + + public double getRating(){ + return rating; + } + + public void setRating(double rating){ + this.rating=rating; + } + + @Override + public String toString() { + return String.format( + "Restaurant: %s, Address: %s, Rating: %.1f", + name, + address, + rating + ); + } + + +} \ No newline at end of file diff --git a/OOPClss/GlovoAppOmarBelkady.zip b/OOPClss/GlovoAppOmarBelkady.zip new file mode 100644 index 0000000000000000000000000000000000000000..b448893604a37a49995f5d267745930d7f535961 GIT binary patch literal 3650 zcma)82{@E%8=hzwyO<<&vi;d9O<9gz+2+^@W5znf3wT>v;*iu^T z`;zU5tYu4<5%CWlXLNoY|2xuxKd_xDydzkwgN9{cB3Ta5F*?fLdUGM_kT`_-MF+6OAY{RraxImnt6 z;9hVbzz*>8-EN}&5ddJD5&#hVci`R;#ZlH?)@gCtP|9=6VGE&KHwtr%ezyXy=*cC} zS`=&0S-h%)aF%woP-~V7k6rUFbsRvrmOx}?k@l;;@lr*#BkAA}&ex5NPV|&$fw~~0 z-tu-W5yS9^G;2r8fKY})+4_XimHfEWMcOI>?-ol#bVHx3lIv`Qf>LeUn|i!pOp17L zdRj6G@!iA`j`)g?b42l1~pr>qPU z73g2@A%0z=xcbb8BJHw4D#Is#Y2wzAy;=bP3xPit`P9#A<%~hvIqfSmgj8muqzbqU z1&M|l01!S5s*3S+cXzaN-!1eX#@gsXCFW|*&C_8@$`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bwn+h-!R#5=RQ33ucR zZw`nb)ge$TJ=qq82wzs}s&-J+o9O3yMXd~lrREKcW=?u&Jcv*Yb4JDL@C4Hj7`vne zdnZcxscfbr8%^$If`MJLrDL$j2RlZCx}n$|r*f5aiTz&9xxj?)MUb3&t2mJ?Ot!g|^ zXh~fzN)i##!-6!h!+KbIx?8(=?8b;Q7~GK&+=%{Xv9?abYIQn?gEvmQxX7 zTVvtxLbnKQ{kb$|Um0 myBooks; + List membersOfLib; + + public Library(){ + myBooks = new ArrayList<>(); + membersOfLib = new ArrayList<>(); + } +} \ No newline at end of file diff --git a/OOPClss/LibraryApp/.gitignore b/OOPClss/LibraryApp/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/OOPClss/LibraryApp/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/OOPClss/LibraryApp/.idea/.gitignore b/OOPClss/LibraryApp/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/OOPClss/LibraryApp/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/OOPClss/LibraryApp/.idea/misc.xml b/OOPClss/LibraryApp/.idea/misc.xml new file mode 100644 index 0000000..454992c --- /dev/null +++ b/OOPClss/LibraryApp/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/LibraryApp/.idea/modules.xml b/OOPClss/LibraryApp/.idea/modules.xml new file mode 100644 index 0000000..26f9df2 --- /dev/null +++ b/OOPClss/LibraryApp/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/OOPClss/LibraryApp/.idea/vcs.xml b/OOPClss/LibraryApp/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/OOPClss/LibraryApp/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/LibraryApp/Library.iml b/OOPClss/LibraryApp/Library.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/OOPClss/LibraryApp/Library.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/OOPClss/LibraryApp/src/com/library/app/LibraryApp.class b/OOPClss/LibraryApp/src/com/library/app/LibraryApp.class new file mode 100644 index 0000000000000000000000000000000000000000..b19c075d81ab4253897f057b08b8b7f27fa436f1 GIT binary patch literal 1526 zcmZ`(OLNjt6#i}tB!slu*4D9}&~QkVV-$8!Q$YAej-^ z>zQSgEqBqlQFvk(1A*9S$900U0=>ypPJ%2j5IWTZr)*@4mh0Mn910Q=R26;bUzH`h zR155iK#$`J49|y=j%TFZYCXsXzHL>e6-d~~^#=q-lk2*qa$I3Z#U>0B5U)aTljkIR-ec zLdOmP*|nbs^Nwo^Y)YnDV7t8)OkkIU-75BAZ-=VTA?*hCqU}?Ps^!;gQvXvgEhDwk zgKJf68T$qL+f7-el5f{)+}EUvgWQx9!Y{iL4hd*QuVR#)f^YdtMkOS|XoV^;aD<6I zDv(U3*MeVrlFG?APGDv{@2Q^7&SXqo#t8u>JXmmoGJ!kQaj@#aW6zf`O`Ub4C{VP) z5eiJ4VFWZzr`F+mEr7Kr4Cy@4F(0<*SgxMF$f#y$?pDq+M4PEgxF|5*4W&g4MHzp6 z721P226b6rWF1gx9{cn^EtNe^K@SC2aE+tq1*VA9?qaLhpI&A9O9{=Fj0{b_qWgBy z^Gh||d!z@CZM_9`i9hsB{?NDnnU~grQoMw$z?Sa9R<+vhZ|Op{DiE3VN;I(>cyKdy z-i-yTP^Obe#p1;rNj_MQX!_1sukIJ^IftDoJe(>@d63r#J8+w>5B~LlmIyI=E|9j3 zq#zmH*MN9OF9LVy$!0)B968*jcXAaLh4s_v&nBe&d&C=5vc2+>h&Q12Z1zo=>Px# literal 0 HcmV?d00001 diff --git a/OOPClss/LibraryApp/src/com/library/app/LibraryApp.java b/OOPClss/LibraryApp/src/com/library/app/LibraryApp.java new file mode 100644 index 0000000..56dac18 --- /dev/null +++ b/OOPClss/LibraryApp/src/com/library/app/LibraryApp.java @@ -0,0 +1,52 @@ +package com.library.app; +import com.library.librarian.Librarian; +import com.library.member.Member; +import com.library.loan.Loan; +import com.library.book.Book; +import com.library.loanstatus.LoanStatus; +import java.time.LocalDate; +import java.util.*; + + + +public class LibraryApp { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + + //Member; + System.out.print("Member id: "); + int mid = Integer.parseInt(sc.nextLine()); + System.out.print("Member name"); + String mname = sc.nextLine(); + System.out.println("Member address"); + String maddress = sc.nextLine(); + Member member = new Member(mid,mname,maddress); + + //Book + System.out.println("Book ISBN: "); + String isbn = sc.nextLine(); + System.out.println("Book Title"); + String title = sc.nextLine(); + System.out.println("Book author"); + String author = sc.nextLine(); + Book book = new Book(isbn,title,author); + + + //Librarian + System.out.println("Librarian ID: "); + int lid = Integer.parseInt(sc.nextLine()); + System.out.println("Librarian Name: "); + String lname = sc.nextLine(); + Librarian librarian = new Librarian(lname, lid); + + + Loan loan = new Loan(1001,member, book); + System.out.println("\n records of the library"); + System.out.println(member); + System.out.println(book); + System.out.println(librarian); + System.out.println(loan); + + } +} \ No newline at end of file diff --git a/OOPClss/LibraryApp/src/com/library/book/Book.class b/OOPClss/LibraryApp/src/com/library/book/Book.class new file mode 100644 index 0000000000000000000000000000000000000000..5aea8b84a3ea66799da9dad73b0f52ad4e8ee472 GIT binary patch literal 1546 zcmbVMZBNrs6n^g5)@^h!7%w7%h`ekAHpN#QnBWp35%mKElliF|4HQaC+Kz-6|A#-q z51P1`@WCJ8k1{^D9c*rmF@Ct`o}NDUIp;p7r$2vP{s2(HdI}NrDTu0wAufc!!vam8B#GUBXOL)0*z=1y@lHb#L1jX(Sh#RdKHXqapbvcY+jqQbD=|x7;M7o4$(Fj^Qi6-*7kE zO0t(#0ad&`OlEA7& ze2~50SQLxPGk$*qH)w3jze>3wJ`TolKZR91Q1DRp^^w3_`=c?ebNfUu1?2>--qPxx z?OX_a>XfAg42pTFSqG->&h4<8##y%AGB1QB*Y3+%-JC zOkKAvOLr=!=DND8;HkiT&z-_bRq#w;`tMKifc?jwco5QU{Cl)`co>B34AnXilsOwo?<1dt>$Mca=7GG>wH+iBcx zF->t7M8yiwvu$@N!f51tPF`>Y0D0RAM2rB6F(P9o$02Q_0ES=cZd^IJx}Td;uo+;E2ZreB>TBbkUT*-NGqXjK_;8Xc2~VZ z>LQVa>#B?Fgw%RWYR#4A%5Y^bF%EQJV-^-g`9`i|l4^Oa$GA4cl D$&W;8 literal 0 HcmV?d00001 diff --git a/OOPClss/LibraryApp/src/com/library/book/Book.java b/OOPClss/LibraryApp/src/com/library/book/Book.java new file mode 100644 index 0000000..0d7d0e4 --- /dev/null +++ b/OOPClss/LibraryApp/src/com/library/book/Book.java @@ -0,0 +1,57 @@ +package com.library.book; + +public class Book{ + private String isbn; + private String title; + private String author; + private boolean available; + + public Book(String isbn, String title, String author) { + this.isbn = isbn; + this.title = title; + this.author = author; + } + + + public String getIsbn() { + return isbn; + } + + public void setIsbn(String isbn) { + this.isbn = isbn; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public boolean isAvailable() { + return available; + } + + public void setAvailable(boolean available) { + this.available = available; + } + + @Override + public String toString() { + return "Book{" + + "isbn='" + isbn + '\'' + + ", title='" + title + '\'' + + ", author='" + author + '\'' + + ", available=" + available + + '}'; + } +} \ No newline at end of file diff --git a/OOPClss/LibraryApp/src/com/library/librarian/Librarian.class b/OOPClss/LibraryApp/src/com/library/librarian/Librarian.class new file mode 100644 index 0000000000000000000000000000000000000000..60b64082174ee9501a25091fd11d35954b11ff0c GIT binary patch literal 920 zcmZuvT~E_s7(MU4I%>DE$5esTS4DXp=9u=1z~)D|qK&Un8y-fJqV{nq7~jx|&@tQ&ZO zrvl|AwdI9!A_D>K%64b+=v-jkwAzW{F`}nq19c6X2DZ?+*Y{i=`#$%BsZ9gknTh;Z z{AnUIH>#Jc5~Ec01TcF{~P5mp7FU-oS76qzFBnQ z3~5B=G0Z*OtfR@ zlDd9R{hYc+>J1`03)MYFl)!qWoc)c|Nt)^lw|G1_$*4XCx2P?9DMk)8=w6c}++gA^ IQ&ZUc4>J9-EC2ui literal 0 HcmV?d00001 diff --git a/OOPClss/LibraryApp/src/com/library/librarian/Librarian.java b/OOPClss/LibraryApp/src/com/library/librarian/Librarian.java new file mode 100644 index 0000000..5d31ea9 --- /dev/null +++ b/OOPClss/LibraryApp/src/com/library/librarian/Librarian.java @@ -0,0 +1,38 @@ +package com.library.librarian; + +public class Librarian { + private int employeeId; + private String name; + + public Librarian(String name, int employeeId) { + this.name = name; + this.employeeId = employeeId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getEmployeeId() { + return employeeId; + } + + public void setEmployeeId(int employeeId) { + this.employeeId = employeeId; + } + + @Override + public String toString() { + return String.format( + "Librarian[id=%d, name=%s]", + employeeId, name + ); + } + + + +} diff --git a/OOPClss/LibraryApp/src/com/library/loan/Loan.class b/OOPClss/LibraryApp/src/com/library/loan/Loan.class new file mode 100644 index 0000000000000000000000000000000000000000..95318fc925faf2724ed1eb92092b4e7b3b299f5c GIT binary patch literal 2715 zcmbVOYg5}+5Ir}5g^e20@H7Mxp0SOIX=#(R4tZcgaBAWdQ)rXEWLp6TBQds2hw1cF z|3rU8KeU~?$>c+SKz~%H=jw{u78=s2v9(vLv*+&a-Cgn5-*5f|kU=Ga3+U3&t)mAa zfq|FCv5|5rhh{2gmyGI~;g|wlmi?W;NGzTUc%1Gbll)weToE08&;`Or)kb~SG!NaM+0OWz?r`zYJS>{E)TS#s z9~Eu;AhpU%I=&OZ7{)bRkv>ldTyk?>HLSf8JLdSwUkdO*Usup$JK#D3AguwVYp-F@H zbi9vcfo>TZi>CwL3O9leaZ|%B9k=mON3aE_RfWI9GDr~DjCjh#o6bIAz2QK(mp-ucGEU~kL>?x0=yEq$sOA(=0BDL zQ<$;K?85$B#WJ5XWDRW_#VR%7J=2lRA&;Ilk)@{I(sakN@g0Fa52OmA&jYBtQ7@yN z4bK`Bh|p|Jl>~2S_3w?`wcxem9A`p%OtRus(X@4KTKRQq!()8AiF843q?$!w!naXp z^3(>W*vZZfI-!zSBe85YfvAtRRhUFEXoVWQ2o#+BBVgyIk+ZmjVwY;(M9NYF1hxaR4!GT?UN%j0RFsZ-|$Xy@f8Ms^n5OBHbT;I=)7nynaGn1_#E5*z+$nrJ_4F@3 z>IH(<@#qZo0)zBZr%1g-O{aVbg=Q z5<;)ze(HOqzE9*65-{AnLZtQOB4k z^;05uu?QeE{5?mB NcM-12c!7OH{{fi1cS-;N literal 0 HcmV?d00001 diff --git a/OOPClss/LibraryApp/src/com/library/loan/Loan.java b/OOPClss/LibraryApp/src/com/library/loan/Loan.java new file mode 100644 index 0000000..584403f --- /dev/null +++ b/OOPClss/LibraryApp/src/com/library/loan/Loan.java @@ -0,0 +1,97 @@ +package com.library.loan; + +import com.library.book.Book; +import com.library.loanstatus.LoanStatus; +import com.library.member.Member; + +import java.time.LocalDate; + +public class Loan { + private int loanId; + private LocalDate loanDate; + private LocalDate dueDate; + private LoanStatus status; + private Member member; + private Book book; + + public Loan(int loanId, Member member, Book book) { + this(loanId,LocalDate.now(),LocalDate.now().plusWeeks(2),LoanStatus.BORROWED,member,book); + } + + public Loan(int loanId,LocalDate loanDate, LocalDate dueDate, LoanStatus status, Member member, Book book){ + this.loanId=loanId; + this.loanDate=loanDate; + this.dueDate=dueDate; + this.status=status; + this.member=member; + this.book=book; + } + + + + + + public int getLoanId() { + return loanId; + } + + public void setLoanId(int loanId) { + this.loanId = loanId; + } + + public LocalDate getLoanDate() { + return loanDate; + } + + public void setLoanDate(LocalDate loanDate) { + this.loanDate = loanDate; + } + + public LocalDate getDueDate() { + return dueDate; + } + + public void setDueDate(LocalDate dueDate) { + this.dueDate = dueDate; + } + + public LoanStatus getStatus() { + return status; + } + + public void setStatus(LoanStatus status) { + this.status = status; + } + + public Member getMember() { + return member; + } + + public void setMember(Member member) { + this.member = member; + } + + public Book getBook() { + return book; + } + + public void setBook(Book book) { + this.book = book; + } + + @Override + public String toString() { + return "Loan{" + + "loanId=" + loanId + + ", loanDate=" + loanDate + + ", dueDate=" + dueDate + + ", status=" + status + + ", member=" + member + + ", book=" + book + + '}'; + } + + + + +} diff --git a/OOPClss/LibraryApp/src/com/library/loanstatus/LoanStatus.class b/OOPClss/LibraryApp/src/com/library/loanstatus/LoanStatus.class new file mode 100644 index 0000000000000000000000000000000000000000..d6e0c8d88879847bca6dd4e53d01fc5eb1cead0f GIT binary patch literal 1080 zcma)4?{Csj6g{s$DAZ06=Ww{G+i(M>;53ULAj_0>i3W$E14H~&Sj8@-B&96zn}3qB z#4Q@lKKn-*?|Wjv%tV^B_ukWc?mh3m`{U=A?*J-ztU+Q}>GXR=&us^G@V@BvZGRBj z;c!r_l4}V!1_s4|iU>pWS*>2Ly*Bq4)~f$ymN+$PASS4F^RQ7rF!wlk#el&gaJZ>Mt9( zjXMmHvg^Cy4#UE9sWJ0;t{H`@)2WxEh(%#=_nv`uZ14dH83Ts(Y;KkjP_sV_rP4p5 z)5oi>?;H$!Z6`Ri+a4iL{-Gi_!+04IFP-pR|LBz+*gYq70@4+;+^$b+5>R0|n`_c7 zmpk70yxUWQ;!`Ql&}FB@pj-W6&~f%%E;l~ezXHFd-7OkWiuP97UF53>kfps6mR1Q! zr1|<#hDvxA8Egi$&{bQCZut`Bv3uc^53u*(LLs5^Yo}B$w+My4Kq~SL ztR;^iTP2a{Ze4S&hHN)i6INAG=`BDn5lcMQq!sV(myY?RI8@^(sp|hNQUQX zLqJrG-;Fdf7!`=SvZVyFTi3C6wePqGWrND5F>X+nY&3io1X=2wOk)bu0@E#dtSX*c zm-?Nf54j7pbaf!`!mjqx^;+`1CIS0DefKH7;x#Bev*oyI=hURTCu>bwh7Xhu6F2#? zQdQc5s4Z?+^JK6H+-c`OVfR&I(JKT@+P!KGMT!)!!s75i_|+k)y|9wB?|P?xU2QsT zb)mF1Q*ie9wdd(T`|@O4=|is(BvBB^hnNq4y0#&T3#L&U%VN2>&}oJ_e9R#}Jn#7Qq}-c$#PXNp z-ua2@1AiaEhZngVt#*f^BAd-!N2{_xy6U>huQX*4sKCNwfu)|D`bo9$RABz!P`;rs zFD&wc$9SO!IP(E<7c+07z4F#`O+xS`-sC*P(>lM$xlRhdiaYdxR%=hMC`<9VSu$ literal 0 HcmV?d00001 diff --git a/OOPClss/LibraryApp/src/com/library/member/Member.java b/OOPClss/LibraryApp/src/com/library/member/Member.java new file mode 100644 index 0000000..ef4bceb --- /dev/null +++ b/OOPClss/LibraryApp/src/com/library/member/Member.java @@ -0,0 +1,48 @@ +package com.library.member; + +public class Member { + private int memberId; + private String name; + private String address; + + public Member(int memberId, String name, String address) { + this.memberId = memberId; + this.name = name; + this.address = address; + } + + public int getMemberId() { + return memberId; + } + + public void setMemberId(int memberId) { + this.memberId = memberId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public String toString() { + return "Member{" + + "memberId=" + memberId + + ", name='" + name + '\'' + + ", address='" + address + '\'' + + '}'; + } + +} diff --git a/OOPClss/Member.java b/OOPClss/Member.java new file mode 100644 index 0000000..b4e825f --- /dev/null +++ b/OOPClss/Member.java @@ -0,0 +1,9 @@ +public class Member{ + public String name; + public int member_id; + + public void borrow(Book book){ + System.out.println("You borrowed the following: "+book+" today!"); + } + +} \ No newline at end of file diff --git a/OOPClss/PayrollApp/untitled/.gitignore b/OOPClss/PayrollApp/untitled/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/OOPClss/PayrollApp/untitled/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/OOPClss/PayrollApp/untitled/.idea/.gitignore b/OOPClss/PayrollApp/untitled/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/OOPClss/PayrollApp/untitled/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/OOPClss/PayrollApp/untitled/.idea/misc.xml b/OOPClss/PayrollApp/untitled/.idea/misc.xml new file mode 100644 index 0000000..454992c --- /dev/null +++ b/OOPClss/PayrollApp/untitled/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/PayrollApp/untitled/.idea/modules.xml b/OOPClss/PayrollApp/untitled/.idea/modules.xml new file mode 100644 index 0000000..3007dae --- /dev/null +++ b/OOPClss/PayrollApp/untitled/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/OOPClss/PayrollApp/untitled/.idea/vcs.xml b/OOPClss/PayrollApp/untitled/.idea/vcs.xml new file mode 100644 index 0000000..c2365ab --- /dev/null +++ b/OOPClss/PayrollApp/untitled/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/PayrollApp/untitled/src/Main.class b/OOPClss/PayrollApp/untitled/src/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..c588c17b62a0dcafc524d972807dfc332ff5e07a GIT binary patch literal 621 zcmZuvTTc@~6#h0T&;3q`zCDR}7?a36fc7!$ma6fr5OF+NS(5r@pqH0#!+KMNm9 zqKQAipW_cOo+&0q;XIrEA2%H5e0~Am`Cj&_wM9VDRcI+V-Bi!WD1 zw%hA(ZJ~$F7)!VsAgN&)D}?1s!U)00foQ|Ht#ja6g^a4q@ow4+uu5nQY@Ut8q_A3N zG9PI>kurP!M+mV-2oLN>k>_&gA@oMor_-O09EE5Qq7TXlGf+Z%IBJ_1b*#IgGzslX zlI}mdSjc|bbM0)pUhe)^>-jWiwcaQA2SRZ-{+=C5!eU1m`Ffo9WpO0>nl*ktv#++^ zU(AyB2yxeri-CNhoO9&B9=gGyiF>?HM-`CUDDwyWYw%0_&b7}#rz{X!%$=E)h>)Vq zvU7dO8+H(zUl1e?(3TX>t4#tsTm^l$=!V82t z_TC+x$f{w;yzrH8UNWTfg~JJCF=4@Wa19Q_N>w+#mS~4M2t3(r1-dPz_qy*ej49ES z46}Pzv=tNj>bMvaO*xpx3{{}aPkxPom1B6;!41q29Em`LZGv}V_@;w}xTal`EfJcg zR3?UV4whn)bfvOCOEWDySivg8LQ^zkNvof|W{PHCDIZe*}+H=kbuJO8{-#n3(>(71kT!)Q_`-+>oB$&RY!YS4ZosGu@D0GFT%0uBaLvpW&B5+4_M=?{BEHKt}6( zS~pHx#bM0{kiQZS+ATRE{Nq4;vcttef%_CC5d; + + + + + + + + + + \ No newline at end of file diff --git a/OOPClss/RideSharingApp/.gitignore b/OOPClss/RideSharingApp/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/OOPClss/RideSharingApp/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/OOPClss/RideSharingApp/.idea/.gitignore b/OOPClss/RideSharingApp/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/OOPClss/RideSharingApp/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/OOPClss/RideSharingApp/.idea/misc.xml b/OOPClss/RideSharingApp/.idea/misc.xml new file mode 100644 index 0000000..454992c --- /dev/null +++ b/OOPClss/RideSharingApp/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/RideSharingApp/.idea/modules.xml b/OOPClss/RideSharingApp/.idea/modules.xml new file mode 100644 index 0000000..7471a67 --- /dev/null +++ b/OOPClss/RideSharingApp/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/OOPClss/RideSharingApp/.idea/vcs.xml b/OOPClss/RideSharingApp/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/OOPClss/RideSharingApp/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/RideSharingApp/RideSharingApp.iml b/OOPClss/RideSharingApp/RideSharingApp.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/OOPClss/RideSharingApp/RideSharingApp.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/driver/Driver.java b/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/driver/Driver.java new file mode 100644 index 0000000..1a3c81f --- /dev/null +++ b/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/driver/Driver.java @@ -0,0 +1,53 @@ +package com.ridesharingapp.entities.driver; + +public class Driver { + private String name; + private String phoneNum; + private Boolean isAvailable; + + public Driver(String name, String phoneNum, Boolean isAvailable){ + this.name=name; + this.phoneNum=phoneNum; + this.isAvailable=isAvailable; + } + + public Driver(String name,String phoneNum){ + this.name=name; + this.phoneNum=phoneNum; + this.isAvailable=false; + } + + public String getName(){ + return name; + } + + public void setName(String name){ + this.name= name; + } + + public String getPhoneNum(){ + return phoneNum; + } + + public void setPhoneNum(String phoneNum){ + this.phoneNum=phoneNum; + } + + public void setAvailable(Boolean available) { + isAvailable = available; + } + + public Boolean getIsAvailable(){ + return isAvailable; + } + @Override + public String toString() { + return "Driver{" + + "name='" + name + '\'' + + ", phoneNum='" + phoneNum + '\'' + + ", isAvailable=" + isAvailable + + '}'; + } + + +} diff --git a/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/rider/Rider.java b/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/rider/Rider.java new file mode 100644 index 0000000..9e2fa2f --- /dev/null +++ b/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/rider/Rider.java @@ -0,0 +1,52 @@ +package com.ridesharingapp.entities.rider; + +public class Rider { + private String name; + private String location; + private String email; + private String phoneNum; + + + public Rider(String name, String location, String email){ + this.name=name; + this.location=location; + this.phoneNum="N/A"; + this.email=email; + } + + public Rider(String name,String location,String email,String phoneNum){ + this.name=name; + this.location=location; + this.email=email; + this.phoneNum=phoneNum; + } + + public String getName(){ + return name; + } + + public void setName(String name){ + this.name=name; + } + + public String getLocation(){ + return location; + } + + public void setLocation(String location){ + this.location=location; + } + + public String getPhoneNum(){ + return phoneNum; + } + + public void setPhoneNum(String phoneNum){ + this.phoneNum=phoneNum; + } + + @Override + public String toString(){ + return("A new Rider has been created who's name is: "+this.name+" and lives at "+this.location+" and can be reached at: "+this.phoneNum+" and his email is: "+this.email); + } +} diff --git a/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/trip/Trip.java b/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/trip/Trip.java new file mode 100644 index 0000000..5d20307 --- /dev/null +++ b/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/trip/Trip.java @@ -0,0 +1,93 @@ +package com.ridesharingapp.entities.trip; + +import com.ridesharingapp.entities.driver.Driver; +import com.ridesharingapp.entities.rider.Rider; +import com.ridesharingapp.entities.vehicle.Vehicle; +import com.ridesharingapp.entities.tripstatus.TripStatus; +import java.time.LocalDateTime; + +public class Trip { + private int tripId; + private Rider rider; + private Driver driver; + private Vehicle vehicle; + private LocalDateTime startTime; + private TripStatus status; + + public Trip(int tripId, Rider rider, Driver driver, Vehicle vehicle, LocalDateTime startTime, TripStatus status) { + this.tripId = tripId; + this.rider = rider; + this.driver = driver; + this.vehicle = vehicle; + this.startTime = startTime; + this.status = status; + } + + // Unassigned trip + public Trip(int tripId, Rider rider, LocalDateTime startTime, TripStatus status) { + this.tripId = tripId; + this.rider = rider; + this.driver = null; + this.vehicle = null; + this.startTime = startTime; + this.status = status; + } + + public int getTripId() { + return tripId; + } + + public void setTripId(int tripId) { + this.tripId = tripId; + } + + public Rider getRider() { + return rider; + } + + public void setRider(Rider rider) { + this.rider = rider; + } + + public Driver getDriver() { + return driver; + } + + public void setDriver(Driver driver) { + this.driver = driver; + } + + public Vehicle getVehicle() { + return vehicle; + } + + public void setVehicle(Vehicle vehicle) { + this.vehicle = vehicle; + } + + public LocalDateTime getStartTime() { + return startTime; + } + + public void setStartTime(LocalDateTime startTime) { + this.startTime = startTime; + } + + public TripStatus getStatus() { + return status; + } + + public void setStatus(TripStatus status) { + this.status = status; + } + + @Override + public String toString() { + return "Trip{tripId=" + tripId + + ", rider=" + (rider != null ? rider.getName() : "None") + + ", driver=" + (driver != null ? driver.getName() : "None") + + ", vehicle=" + (vehicle != null ? vehicle.getModel() : "None") + + ", startTime=" + startTime + + ", status=" + status + "}"; + } +} \ No newline at end of file diff --git a/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/tripstatus/TripStatus.java b/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/tripstatus/TripStatus.java new file mode 100644 index 0000000..49ab1df --- /dev/null +++ b/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/tripstatus/TripStatus.java @@ -0,0 +1,18 @@ +package com.ridesharingapp.entities.tripstatus; + +public enum TripStatus { + REQUESTED("Trip requested by driver"), + ASSIGNED("Trip assigned to driver"), + IN_PROGRESS("Trip in progress"), + COMPLETED("Trip completed"); + + public final String description; + + TripStatus(String description){ + this.description=description; + } + + public String getDescription(){ + return description; + } +} diff --git a/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/vehicle/Vehicle.java b/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/vehicle/Vehicle.java new file mode 100644 index 0000000..13d3ba3 --- /dev/null +++ b/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/vehicle/Vehicle.java @@ -0,0 +1,49 @@ +package com.ridesharingapp.entities.vehicle; + +public class Vehicle { + private String model; + private String licensePlate; + private String color; + + public Vehicle(String model, String licensePlate, String color) + { + this.model=model; + this.licensePlate=licensePlate; + this.color=color; + } + + @Override + public String toString() { + return "Vehicle{" + + "model='" + model + '\'' + + ", licensePlate='" + licensePlate + '\'' + + ", color='" + color + '\'' + + '}'; + } + + public void setModel(String model){ + this.model=model; + } + + public String getModel(){ + return model; + } + + public String getLicensePlate(){ + return licensePlate; + } + + public void setLicensePlate(String licensePlate){ + this.licensePlate=licensePlate; + } + + public String getColor(){ + return color; + } + + public void setColor(String color){ + this.color=color; + } + + +} diff --git a/OOPClss/RideSharingApp/src/com/ridesharingapp/main/Menu.java b/OOPClss/RideSharingApp/src/com/ridesharingapp/main/Menu.java new file mode 100644 index 0000000..e1ec62f --- /dev/null +++ b/OOPClss/RideSharingApp/src/com/ridesharingapp/main/Menu.java @@ -0,0 +1,112 @@ +package com.ridesharingapp.main; + + +import com.ridesharingapp.entities.rider.Rider; +import com.ridesharingapp.entities.driver.Driver; +import com.ridesharingapp.entities.vehicle.Vehicle; +import com.ridesharingapp.entities.trip.Trip; +import com.ridesharingapp.entities.tripstatus.TripStatus; +import java.util.Scanner; +import java.time.LocalDateTime; + +public class Menu { + private Trip currentTrip; + private Scanner scanner; + + public Menu(Trip initialTrip) { + this.currentTrip = initialTrip; + this.scanner = new Scanner(System.in); + } + + public void run() { + while (true) { + System.out.println("\nRideSharingApp Menu:"); + System.out.println("1. Create a new trip"); + System.out.println("2. Assign a driver and vehicle to a trip"); + System.out.println("3. Update trip status"); + System.out.println("4. Exit"); + System.out.print("Choose an option: "); + + int choice; + try { + choice = scanner.nextInt(); + scanner.nextLine(); // Consume newline + } catch (Exception e) { + System.out.println("Invalid input. Please enter a number."); + scanner.nextLine(); + continue; + } + + if (choice == 1) { + System.out.print("Enter trip ID: "); + int tripId; + try { + tripId = scanner.nextInt(); + scanner.nextLine(); + } catch (Exception e) { + System.out.println("Invalid trip ID. Please enter a number."); + scanner.nextLine(); + continue; + } + System.out.print("Enter rider name: "); + String riderName = scanner.nextLine(); + System.out.print("Enter rider location: "); + String riderLocation = scanner.nextLine(); + System.out.print("Enter rider email: "); + String riderEmail = scanner.nextLine(); + + Rider newRider = new Rider(riderName, riderLocation, riderEmail); + currentTrip = new Trip(tripId, newRider, null, null, LocalDateTime.now(), TripStatus.REQUESTED); + System.out.println("New trip created: " + currentTrip.toString()); + + } else if (choice == 2) { + System.out.print("Enter driver name: "); + String driverName = scanner.nextLine(); + System.out.print("Enter driver phone: "); + String driverPhone = scanner.nextLine(); + System.out.print("Is driver available (true/false): "); + boolean isAvailable; + try { + isAvailable = scanner.nextBoolean(); + scanner.nextLine(); + } catch (Exception e) { + System.out.println("Invalid input. Please enter true or false."); + scanner.nextLine(); + continue; + } + System.out.print("Enter vehicle model: "); + String vehicleModel = scanner.nextLine(); + System.out.print("Enter vehicle license plate: "); + String licensePlate = scanner.nextLine(); + System.out.print("Enter vehicle color: "); + String vehicleColor = scanner.nextLine(); + + Driver newDriver = new Driver(driverName, driverPhone, isAvailable); + Vehicle newVehicle = new Vehicle(vehicleModel, licensePlate, vehicleColor); + currentTrip.setDriver(newDriver); + currentTrip.setVehicle(newVehicle); + currentTrip.setStatus(TripStatus.ASSIGNED); + System.out.println("Driver and vehicle assigned to trip: " + currentTrip.toString()); + + } else if (choice == 3) { + System.out.println("Available statuses: REQUESTED, ASSIGNED, IN_PROGRESS, COMPLETED"); + System.out.print("Enter new status for the current trip: "); + String statusInput = scanner.nextLine().toUpperCase(); + try { + TripStatus newStatus = TripStatus.valueOf(statusInput); + currentTrip.setStatus(newStatus); + System.out.println("Updated trip: " + currentTrip.toString()); + } catch (IllegalArgumentException e) { + System.out.println("Invalid status entered. Please use REQUESTED, ASSIGNED, IN_PROGRESS, or COMPLETED."); + } + + } else if (choice == 4) { + System.out.println("Exiting RideSharingApp."); + scanner.close(); + break; + } else { + System.out.println("Invalid option. Please try again."); + } + } + } +} \ No newline at end of file diff --git a/OOPClss/RideSharingApp/src/com/ridesharingapp/main/RideSharingApp.java b/OOPClss/RideSharingApp/src/com/ridesharingapp/main/RideSharingApp.java new file mode 100644 index 0000000..953867c --- /dev/null +++ b/OOPClss/RideSharingApp/src/com/ridesharingapp/main/RideSharingApp.java @@ -0,0 +1,40 @@ +package com.ridesharingapp.main; + +import com.ridesharingapp.entities.rider.Rider; +import com.ridesharingapp.entities.driver.Driver; +import com.ridesharingapp.entities.vehicle.Vehicle; +import com.ridesharingapp.entities.trip.Trip; +import com.ridesharingapp.entities.tripstatus.TripStatus; + +import java.awt.*; +import java.time.LocalDateTime; + +public class RideSharingApp { + public static void main(String[] args) { + // Create sample objects + Rider rider1 = new Rider("Alice Brown", "123 Elm St", "alice@example.com"); + Rider rider2 = new Rider("Bob Wilson", "456 Pine Rd", "bob@example.com", "555-1234"); + + Driver driver1 = new Driver("Charlie Davis", "555-5678", true); + Driver driver2 = new Driver("Diana Evans", "555-9012"); + + Vehicle vehicle1 = new Vehicle("Toyota Camry", "XYZ-123", "Blue"); + Vehicle vehicle2 = new Vehicle("Honda Accord", "ABC-456", "Blue"); + + Trip trip1 = new Trip(1, rider1, null, null, LocalDateTime.now(), TripStatus.REQUESTED); + + // Display initial object states + System.out.println("\nInitial Object States:"); + System.out.println(rider1.toString()); + System.out.println(rider2.toString()); + System.out.println(driver1.toString()); + System.out.println(driver2.toString()); + System.out.println(vehicle1.toString()); + System.out.println(vehicle2.toString()); + System.out.println(trip1.toString()); + + // Start the menu + Menu menu = new Menu(trip1); + menu.run(); + } +} \ No newline at end of file diff --git a/OOPClss/SimpleOrderRegistry/.idea/workspace.xml b/OOPClss/SimpleOrderRegistry/.idea/workspace.xml new file mode 100644 index 0000000..e6f747a --- /dev/null +++ b/OOPClss/SimpleOrderRegistry/.idea/workspace.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1751044964396 + + + + \ No newline at end of file diff --git a/OOPClss/StudentApp/StudentApp/pom.xml b/OOPClss/StudentApp/StudentApp/pom.xml new file mode 100644 index 0000000..031ecd7 --- /dev/null +++ b/OOPClss/StudentApp/StudentApp/pom.xml @@ -0,0 +1,13 @@ + + + 4.0.0 + aui.students + StudentApp + 1.0-SNAPSHOT + jar + + UTF-8 + 23 + aui.students.studentapp.StudentApp + + \ No newline at end of file diff --git a/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/AcademicStatus.java b/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/AcademicStatus.java new file mode 100644 index 0000000..d9a9a1e --- /dev/null +++ b/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/AcademicStatus.java @@ -0,0 +1,10 @@ + +package aui.students.studentapp; + + +public enum AcademicStatus { + FRESHMAN, + SOPHOMORE, + JUNIOR, + SENIOR; +} diff --git a/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/Address.java b/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/Address.java new file mode 100644 index 0000000..78bcfc5 --- /dev/null +++ b/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/Address.java @@ -0,0 +1,90 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package aui.students.studentapp; + + +public class Address { + private int street_num; + private String street_name; + private String city; + private String country; + private int zip_code; + + public Address(int street_num, String street_name, String city, String country, int zip_code) { + this.street_num = street_num; + this.street_name = street_name; + this.city = city; + this.country = country; + this.zip_code = zip_code; + } + + + + + public int getStreet_num() { + return street_num; + } + + + public void setStreet_num(int street_num) { + this.street_num = street_num; + } + + + public String getStreet_name() + { + return street_name; + } + + + public void setStreet_name(String street_name) + { + this.street_name = street_name; + } + + + public String getCity() + { + return city; + } + + + public void setCity(String city) + { + this.city = city; + } + + + public String getCountry() + { + return country; + } + + + public void setCountry(String country) + { + this.country = country; + } + + + public int getZip_code() + { + return zip_code; + } + + + public void setZip_code(int zip_code) + { + this.zip_code = zip_code; + } + + @Override + public String toString() + { + return " "+street_num+", "+street_name+" "+city+" "+country+" "+zip_code; + } + + +} diff --git a/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/Student.java b/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/Student.java new file mode 100644 index 0000000..d103940 --- /dev/null +++ b/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/Student.java @@ -0,0 +1,100 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package aui.students.studentapp; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +/** + * + * @author Oumaima Hourrane + */ +public class Student { + //Fields + private String name; + private double gpa; + private int credits; + private LocalDate date; + private Address adds; //association (0..1) + private AcademicStatus status; //association + + //constructors + public Student(String name, double gpa, int credits ){ + this.name = name; + this.credits = credits; + this.gpa = gpa; + } + + public Student(String name, double gpa, int credits, String date, Address adds) { + this(name, gpa, credits); //always call the base constructor + setDate(date); + this.adds = adds; + } + + public Student(String name, double gpa, int credits, String status) { + this(name, gpa, credits); //always call the base constructor + this.status = AcademicStatus.valueOf(status.toUpperCase()); + } + + + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public double getGpa() { + return gpa; + } + + /** + * @param gpa the gpa to set + */ + public void setGpa(double gpa) { + this.gpa = gpa; + } + + + public int getCredits() { + return credits; + } + + + public void setCredits(int credits) { + this.credits = credits; + } + + + + public LocalDate getDate() { + return date; + } + + public void setDate(String date) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); + this.date = LocalDate.parse(date, formatter); + } + + + @Override + public String toString() + { + String str = "Student "+name+", has credits: "+credits+", and gpa "+gpa; + if (date != null) { + str += ". Student's birthday is "+date.format(DateTimeFormatter.ofPattern("MM/dd/yyyy")); + } + if (adds!=null){ + str += ". Student's address:"+adds.toString(); + } + if (status != null) { + str += ". Academic status: " + status.name(); + } + return str; + } +} diff --git a/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/StudentApp.java b/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/StudentApp.java new file mode 100644 index 0000000..b3658d8 --- /dev/null +++ b/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/StudentApp.java @@ -0,0 +1,105 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + */ + +package aui.students.studentapp; + +import java.util.Scanner; + + + +public class StudentApp { + + public static void main(String[] args) { + + Scanner scanner = new Scanner(System.in); + + // Prompt for student 1 (without birthdate and address) + System.out.println("Enter details for student 1:"); + System.out.print("Name: "); + String name1 = scanner.nextLine(); + + System.out.print("GPA: "); + double gpa1 = scanner.nextDouble(); + + System.out.print("Credits: "); + int credits1 = scanner.nextInt(); + scanner.nextLine(); // consume the newline + + Student stud1 = new Student(name1, gpa1, credits1); + System.out.println(stud1); // Print student 1 info + + + + // Prompt for student 2 (with birthdate and address) + System.out.println("\n Enter details for student 2:"); + + System.out.print("Name: "); + String name2 = scanner.nextLine(); //gets + + //for character next char + + System.out.print("GPA: "); + double gpa2 = scanner.nextDouble(); + + System.out.print("Credits: "); + int credits2 = scanner.nextInt(); + scanner.nextLine(); // consume the newline + + System.out.print("Birthdate (MM/dd/yyyy): "); + String birthDate2 = scanner.nextLine(); + + // Prompt for address + System.out.println("\n Enter address details for student 2:"); + + System.out.print("Street Number: "); + int streetNumber = scanner.nextInt(); + scanner.nextLine(); // consume the newline + + System.out.print("Street Name: "); + String streetName = scanner.nextLine(); + + System.out.print("City: "); + String city = scanner.nextLine(); + + System.out.print("Country: "); + String country = scanner.nextLine(); + + System.out.print("Postal Code: "); + int postalCode = scanner.nextInt(); + + // Create address object + Address address = new Address(streetNumber, streetName, city, country, postalCode); + + // Create student 2 object + Student stud2 = new Student(name2, gpa2, credits2, birthDate2, address); + System.out.println(stud2); // Print student 2 info + + + // Prompt for student 3 (with academic status) + System.out.println("\n Enter details for student 3:"); + + System.out.print("Name: "); + scanner.nextLine(); // Clear the newline before the next input + String name3 = scanner.nextLine(); + + System.out.print("GPA: "); + double gpa3 = scanner.nextDouble(); + + System.out.print("Credits: "); + int credits3 = scanner.nextInt(); + scanner.nextLine(); // consume the newline + + // Prompt for academic status + System.out.println("Academic Status (FRESHMAN, SOPHOMORE, JUNIOR, SENIOR): "); + String status3 = scanner.nextLine().toUpperCase(); + + // Create student 3 object + Student stud3 = new Student(name3, gpa3, credits3, status3); + System.out.println(stud3); // Print student 3 info + + // Close scanner + scanner.close(); + + } +} diff --git a/StudentApp/untitled/.gitignore b/StudentApp/untitled/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/StudentApp/untitled/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/StudentApp/untitled/.idea/.gitignore b/StudentApp/untitled/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/StudentApp/untitled/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/StudentApp/untitled/.idea/misc.xml b/StudentApp/untitled/.idea/misc.xml new file mode 100644 index 0000000..454992c --- /dev/null +++ b/StudentApp/untitled/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/StudentApp/untitled/.idea/modules.xml b/StudentApp/untitled/.idea/modules.xml new file mode 100644 index 0000000..3007dae --- /dev/null +++ b/StudentApp/untitled/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/StudentApp/untitled/.idea/vcs.xml b/StudentApp/untitled/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/StudentApp/untitled/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/StudentApp/untitled/src/Main.java b/StudentApp/untitled/src/Main.java new file mode 100644 index 0000000..d5238c9 --- /dev/null +++ b/StudentApp/untitled/src/Main.java @@ -0,0 +1,5 @@ +public class Main { + public static void main(String[] args) { + System.out.println("Hello, World!"); + } +} \ No newline at end of file diff --git a/StudentApp/untitled/src/aui/students/Students.java b/StudentApp/untitled/src/aui/students/Students.java new file mode 100644 index 0000000..ca7bff5 --- /dev/null +++ b/StudentApp/untitled/src/aui/students/Students.java @@ -0,0 +1,21 @@ +package aui.students; +import java.util.Date; + +public class Students { + private String name; + private int age; + private int id; + private String dateOfBirth; + private String address; + + public Students(String name, int age, int id, String dateOfBirth, String address){ + this.name=name; + this.age=age; + this.id=id; + this.dateOfBirth=dateOfBirth; + this.address=address; + } + + + +} diff --git a/StudentApp/untitled/untitled.iml b/StudentApp/untitled/untitled.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/StudentApp/untitled/untitled.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/UML/Library/Book.java b/UML/Library/Book.java new file mode 100644 index 0000000..27213b8 --- /dev/null +++ b/UML/Library/Book.java @@ -0,0 +1,19 @@ +public class Book{ + private String ISBN; + private String title; + private boolean isAvailable; + + public Book(String ISBN, String title, boolean isAvailable){ + this.ISBN=ISBN; + this.title=title; + this.isAvailable=true; + } + + public boolean isAvailable(){ + return isAvailable; + } + + public void setAvailable(boolean available){ + isAvailable=available + } +} \ No newline at end of file diff --git a/UML/Library/Librarian.java b/UML/Library/Librarian.java new file mode 100644 index 0000000..969c2a5 --- /dev/null +++ b/UML/Library/Librarian.java @@ -0,0 +1,8 @@ +public class Librarian extends User{ + void addBook(){ + + } + void removeBook(){ + + } +} \ No newline at end of file diff --git a/UML/Library/Loan.java b/UML/Library/Loan.java new file mode 100644 index 0000000..1805fb4 --- /dev/null +++ b/UML/Library/Loan.java @@ -0,0 +1,14 @@ +public class Loan { + private String dueDate; + private String dateReturned; + private Book book; + private Member member; + + public Loan(Book book, Member member, String dueDate){ + this.dueDate=dueDate; + this.book=book; + this.member=member; + this.dateReturned=null; + this.book.setAvailability(false); + } +} \ No newline at end of file diff --git a/UML/Library/Member.java b/UML/Library/Member.java new file mode 100644 index 0000000..bde156d --- /dev/null +++ b/UML/Library/Member.java @@ -0,0 +1,20 @@ +import java.util.*; + + +public Member extends User{ + private List loans = new ArrayList<>(); + + public void borrowBook(Book book, String dueDate){ + Loan loan = new Loan(book, this, dueDate); + loans.add(loan); + } + + public void returnBook(Book book){ + for(Loan loan: loans){ + if(loan.getBook()==book && loan.getDateReturned() == null) + loan.setDateReturned("2025-04-25"); + book.setAvailable(true); + break; + } + } +} \ No newline at end of file diff --git a/UML/Library/User.java b/UML/Library/User.java new file mode 100644 index 0000000..caab61c --- /dev/null +++ b/UML/Library/User.java @@ -0,0 +1,6 @@ +import java.util.*; + +public class User{ + private int id; + private String name; +} \ No newline at end of file From 0a7b4a6910805b0c54657c356a99273b49967878 Mon Sep 17 00:00:00 2001 From: Omar Belkady <31806568+omarbelkady@users.noreply.github.com> Date: Thu, 10 Jul 2025 11:16:13 +0100 Subject: [PATCH 23/24] New stuff --- OOPClss/.idea/workspace.xml | 71 +- .../build.xml | 73 + .../build/classes/.netbeans_automatic_build | 0 .../build/classes/.netbeans_update_resources | 0 .../build/classes/tests/Authentication.class | Bin 0 -> 1857 bytes .../build/classes/users/User.class | Bin 0 -> 1630 bytes .../build/classes/users/UserCollection.class | Bin 0 -> 882 bytes .../classes/users/UserNotFoundException.class | Bin 0 -> 691 bytes .../manifest.mf | 3 + .../nbproject/build-impl.xml | 1770 +++++++++++++++++ .../nbproject/genfiles.properties | 8 + .../nbproject/private/config.properties | 0 .../nbproject/private/private.properties | 6 + .../nbproject/private/private.xml | 11 + .../nbproject/project.properties | 87 + .../nbproject/project.xml | 15 + .../src/tests/Authentication.java | 97 + .../src/users/User.java | 98 + .../src/users/UserCollection.java | 51 + .../src/users/UserExistsException.java | 12 + .../src/users/UserNotFoundException.java | 25 + .../build.xml | 73 + .../build/built-jar.properties | 4 + .../build/classes/LMS/StudentSystem.class | Bin 0 -> 550 bytes .../build/classes/students/Student.class | Bin 0 -> 318 bytes .../classes/students/StudentCollection.class | Bin 0 -> 1560 bytes .../CollectionsSampleApplicationSkeleton.jar | Bin 0 -> 3551 bytes .../dist/README.TXT | 32 + .../manifest.mf | 3 + .../nbproject/build-impl.xml | 1419 +++++++++++++ .../nbproject/genfiles.properties | 8 + .../nbproject/private/private.properties | 2 + .../nbproject/private/private.xml | 12 + .../nbproject/project.properties | 72 + .../nbproject/project.xml | 14 + .../src/LMS/StudentSystem.java | 46 + .../src/students/Student.java | 54 + .../src/students/StudentCollection.java | 59 + OOPClss/DataStructures/Arrays.java | 12 + OOPClss/DataStructures/MyContainer.java | 9 + OOPClss/EcommerceApp/.gitignore | 29 + OOPClss/EcommerceApp/.idea/.gitignore | 3 + OOPClss/EcommerceApp/.idea/misc.xml | 6 + OOPClss/EcommerceApp/.idea/modules.xml | 8 + OOPClss/EcommerceApp/.idea/vcs.xml | 6 + OOPClss/EcommerceApp/EcommerceApp.iml | 11 + OOPClss/EcommerceApp/src/Main.java | 5 + .../EcommerceApp/src/com/address/Address.java | 28 + OOPClss/EcommerceApp/src/com/cart/Cart.java | 32 + .../src/com/cartItem/CartItem.java | 26 + .../src/com/customer/Customer.java | 59 + OOPClss/EcommerceApp/src/com/order/Order.java | 50 + .../src/com/orderitem/OrderItem.java | 22 + .../EcommerceApp/src/com/payment/Payment.java | 31 + .../src/com/paymentmethod/PaymentMethod.java | 34 + .../EcommerceApp/src/com/product/Product.java | 27 + OOPClss/Enhancedglovoapp/.gitignore | 29 + OOPClss/Enhancedglovoapp/.idea/.gitignore | 3 + OOPClss/Enhancedglovoapp/.idea/misc.xml | 6 + OOPClss/Enhancedglovoapp/.idea/modules.xml | 8 + OOPClss/Enhancedglovoapp/.idea/vcs.xml | 6 + OOPClss/Enhancedglovoapp/Enhancedglovoapp.iml | 11 + OOPClss/Enhancedglovoapp/src/admin.java | 24 + OOPClss/Enhancedglovoapp/src/customer.java | 58 + .../Enhancedglovoapp/src/deliveryPerson.java | 93 + OOPClss/Enhancedglovoapp/src/main.java | 5 + OOPClss/Enhancedglovoapp/src/manageable.java | 4 + OOPClss/Enhancedglovoapp/src/order.java | 62 + OOPClss/Enhancedglovoapp/src/orderItem.java | 46 + OOPClss/Enhancedglovoapp/src/orderStatus.java | 3 + .../Enhancedglovoapp/src/restaurantOwner.java | 39 + OOPClss/Enhancedglovoapp/src/user.java | 57 + OOPClss/Generics/Car.class | Bin 0 -> 1480 bytes OOPClss/Generics/Car.java | 52 + OOPClss/Generics/GenericsP1.class | Bin 0 -> 2788 bytes OOPClss/Generics/GenericsP1.java | 75 + OOPClss/GlovoAppPartIII/.idea/.gitignore | 3 + OOPClss/GlovoAppPartIII/.idea/misc.xml | 6 + OOPClss/GlovoAppPartIII/.idea/modules.xml | 8 + OOPClss/GlovoAppPartIII/.idea/vcs.xml | 6 + OOPClss/GlovoAppPartIII/GlovoApp.iml | 11 + .../src/bin/com/glovo/app/GlovoApp.class | Bin 0 -> 2208 bytes .../bin/com/glovo/manageable/Manageable.class | Bin 0 -> 174 bytes .../src/bin/com/glovo/model/Admin.class | Bin 0 -> 2454 bytes .../src/bin/com/glovo/model/Customer.class | Bin 0 -> 1724 bytes .../bin/com/glovo/model/DeliveryPerson.class | Bin 0 -> 2754 bytes .../src/bin/com/glovo/model/Permissions.class | Bin 0 -> 1069 bytes .../bin/com/glovo/model/RestaurantOwner.class | Bin 0 -> 2472 bytes .../src/bin/com/glovo/model/User.class | Bin 0 -> 2063 bytes .../src/com/glovo/app/GlovoApp.java | 41 + .../src/com/glovo/manageable/Manageable.java | 6 + .../src/com/glovo/model/Admin.java | 56 + .../src/com/glovo/model/Customer.java | 40 + .../src/com/glovo/model/DeliveryPerson.java | 85 + .../src/com/glovo/model/Order.java | 88 + .../src/com/glovo/model/OrderItem.java | 56 + .../src/com/glovo/model/OrderStatus.java | 10 + .../src/com/glovo/model/Permissions.java | 7 + .../src/com/glovo/model/Restaurant.java | 41 + .../src/com/glovo/model/RestaurantOwner.java | 59 + .../src/com/glovo/model/User.java | 65 + .../entities/driver/Driver.java | 2 +- .../src/com/ridesharingapp/main/Menu.java | 3 +- .../ridesharingapp/main/RideSharingApp.java | 2 +- .../StudentApp (1)/StudentApp/pom.xml | 13 + .../java/PrintingUsingOverloadedMethods.java | 23 + .../students/studentapp/AcademicStatus.java | 16 + .../java/aui/students/studentapp/Address.java | 104 + .../java/aui/students/studentapp/Student.java | 119 ++ .../aui/students/studentapp/StudentApp.java | 104 + 110 files changed, 6026 insertions(+), 52 deletions(-) create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/build.xml create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/.netbeans_automatic_build create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/.netbeans_update_resources create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/tests/Authentication.class create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/users/User.class create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/users/UserCollection.class create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/users/UserNotFoundException.class create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/manifest.mf create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/build-impl.xml create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/genfiles.properties create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/private/config.properties create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/private/private.properties create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/private/private.xml create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/project.properties create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/project.xml create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/src/tests/Authentication.java create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/src/users/User.java create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/src/users/UserCollection.java create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/src/users/UserExistsException.java create mode 100644 OOPClss/2_JavaUserDefinedExceptionSampleApp/src/users/UserNotFoundException.java create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build.xml create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build/built-jar.properties create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build/classes/LMS/StudentSystem.class create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build/classes/students/Student.class create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build/classes/students/StudentCollection.class create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/dist/CollectionsSampleApplicationSkeleton.jar create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/dist/README.TXT create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/manifest.mf create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/nbproject/build-impl.xml create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/nbproject/genfiles.properties create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/nbproject/private/private.properties create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/nbproject/private/private.xml create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/nbproject/project.properties create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/nbproject/project.xml create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/src/LMS/StudentSystem.java create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/src/students/Student.java create mode 100644 OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/src/students/StudentCollection.java create mode 100644 OOPClss/DataStructures/Arrays.java create mode 100644 OOPClss/DataStructures/MyContainer.java create mode 100644 OOPClss/EcommerceApp/.gitignore create mode 100644 OOPClss/EcommerceApp/.idea/.gitignore create mode 100644 OOPClss/EcommerceApp/.idea/misc.xml create mode 100644 OOPClss/EcommerceApp/.idea/modules.xml create mode 100644 OOPClss/EcommerceApp/.idea/vcs.xml create mode 100644 OOPClss/EcommerceApp/EcommerceApp.iml create mode 100644 OOPClss/EcommerceApp/src/Main.java create mode 100644 OOPClss/EcommerceApp/src/com/address/Address.java create mode 100644 OOPClss/EcommerceApp/src/com/cart/Cart.java create mode 100644 OOPClss/EcommerceApp/src/com/cartItem/CartItem.java create mode 100644 OOPClss/EcommerceApp/src/com/customer/Customer.java create mode 100644 OOPClss/EcommerceApp/src/com/order/Order.java create mode 100644 OOPClss/EcommerceApp/src/com/orderitem/OrderItem.java create mode 100644 OOPClss/EcommerceApp/src/com/payment/Payment.java create mode 100644 OOPClss/EcommerceApp/src/com/paymentmethod/PaymentMethod.java create mode 100644 OOPClss/EcommerceApp/src/com/product/Product.java create mode 100644 OOPClss/Enhancedglovoapp/.gitignore create mode 100644 OOPClss/Enhancedglovoapp/.idea/.gitignore create mode 100644 OOPClss/Enhancedglovoapp/.idea/misc.xml create mode 100644 OOPClss/Enhancedglovoapp/.idea/modules.xml create mode 100644 OOPClss/Enhancedglovoapp/.idea/vcs.xml create mode 100644 OOPClss/Enhancedglovoapp/Enhancedglovoapp.iml create mode 100644 OOPClss/Enhancedglovoapp/src/admin.java create mode 100644 OOPClss/Enhancedglovoapp/src/customer.java create mode 100644 OOPClss/Enhancedglovoapp/src/deliveryPerson.java create mode 100644 OOPClss/Enhancedglovoapp/src/main.java create mode 100644 OOPClss/Enhancedglovoapp/src/manageable.java create mode 100644 OOPClss/Enhancedglovoapp/src/order.java create mode 100644 OOPClss/Enhancedglovoapp/src/orderItem.java create mode 100644 OOPClss/Enhancedglovoapp/src/orderStatus.java create mode 100644 OOPClss/Enhancedglovoapp/src/restaurantOwner.java create mode 100644 OOPClss/Enhancedglovoapp/src/user.java create mode 100644 OOPClss/Generics/Car.class create mode 100644 OOPClss/Generics/Car.java create mode 100644 OOPClss/Generics/GenericsP1.class create mode 100644 OOPClss/Generics/GenericsP1.java create mode 100644 OOPClss/GlovoAppPartIII/.idea/.gitignore create mode 100644 OOPClss/GlovoAppPartIII/.idea/misc.xml create mode 100644 OOPClss/GlovoAppPartIII/.idea/modules.xml create mode 100644 OOPClss/GlovoAppPartIII/.idea/vcs.xml create mode 100644 OOPClss/GlovoAppPartIII/GlovoApp.iml create mode 100644 OOPClss/GlovoAppPartIII/src/bin/com/glovo/app/GlovoApp.class create mode 100644 OOPClss/GlovoAppPartIII/src/bin/com/glovo/manageable/Manageable.class create mode 100644 OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/Admin.class create mode 100644 OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/Customer.class create mode 100644 OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/DeliveryPerson.class create mode 100644 OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/Permissions.class create mode 100644 OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/RestaurantOwner.class create mode 100644 OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/User.class create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/app/GlovoApp.java create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/manageable/Manageable.java create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/model/Admin.java create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/model/Customer.java create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/model/DeliveryPerson.java create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/model/Order.java create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/model/OrderItem.java create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/model/OrderStatus.java create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/model/Permissions.java create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/model/Restaurant.java create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/model/RestaurantOwner.java create mode 100644 OOPClss/GlovoAppPartIII/src/com/glovo/model/User.java create mode 100644 OOPClss/genericsexample/StudentApp (1)/StudentApp/pom.xml create mode 100644 OOPClss/genericsexample/StudentApp (1)/StudentApp/src/main/java/PrintingUsingOverloadedMethods.java create mode 100644 OOPClss/genericsexample/StudentApp (1)/StudentApp/src/main/java/aui/students/studentapp/AcademicStatus.java create mode 100644 OOPClss/genericsexample/StudentApp (1)/StudentApp/src/main/java/aui/students/studentapp/Address.java create mode 100644 OOPClss/genericsexample/StudentApp (1)/StudentApp/src/main/java/aui/students/studentapp/Student.java create mode 100644 OOPClss/genericsexample/StudentApp (1)/StudentApp/src/main/java/aui/students/studentapp/StudentApp.java diff --git a/OOPClss/.idea/workspace.xml b/OOPClss/.idea/workspace.xml index 66bcd17..ba18005 100644 --- a/OOPClss/.idea/workspace.xml +++ b/OOPClss/.idea/workspace.xml @@ -2,43 +2,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + +

E%+Us)R z8CFjwmwx1Vy(?5#Eh~OK4!=w3E^tzKuk3ycUNM6DHXbV6tEo|L{S_c9kI@GFzyt|5 zHY=@TH}6zpjZSNsLs)ntw!{x6_o2hX??rG~Aqb(DV-xXTS6ID87x!v4Ik~sGun&DQ zptl%4ph2Awi=_>R_FB>&P4wnol?-hJo^@918b4n{Q5bN_oJf`wVC1|&(XF6cl5YUd}}k+rd* zPVGbWaT5v6u85HP&0Ri{eik<2+O#mRt_UHeB8828RNAYZR^Y8q(~%6n#!;@T>j(uP zlY}OU(Uwc)C9k1%=)yT^K@%{3V7BqBjWHGvCyoMIaC}coOZB!J$B;6De)E>Sbx$rP zAX;e3!!Y8tG;q45#%0#wP)DZJ&79=ng$*|hVrk3Mzc(|5dy6$5(7ZOli{RJIbTRy+ zi8WOfJp+nV(objxKMmEWGLN$;C`k-R56bs`lCD>Ufwv#4Rj96CU9YC5>Kl@hr5B`P zQv`vbrJ5$&+{9Sh%-=|$S|i^mn579M$80vj08ZGzRK23WKm&rO38Dh084QG?%4=7d zrYQykyYy`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III/.idea/modules.xml new file mode 100644 index 0000000..832b34d --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/.idea/vcs.xml b/OOPClss/GlovoAppPartIIII/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/GlovoApp.iml b/OOPClss/GlovoAppPartIIII/GlovoApp.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/GlovoApp.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/app/GlovoApp.class b/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/app/GlovoApp.class new file mode 100644 index 0000000000000000000000000000000000000000..f050893da7638a5d81e2d486d5f4fbb21f46f527 GIT binary patch literal 2208 zcmcJQNmCm~6vzK912aei*kg>r4vSrJEMbF;Km-hNgh3`a0u%}42%O-SG>8FdhRlrE zve?;|Lr%FQUm%sL*dHwn=zkaX#_rHGm4Zt|Q za>Ioa5^5CGqK@I@D&OG#95=H5+0?3*b{OhLbwhVCc-P zE$1IE*p8XkEE#UnPnrcovt=j@?rVdA{$OxuI2e@C$Z%@g?9GI^w zOtT$cu(;vOZWZs_257t5DfGW%IKtT9(QVovm$}R^SP7-H zbCpoa5?_half@%$w8AgAUSlvSO*~_+6V;9d)&N6CHP#6&r*CN1c2u*9AP0!TO*56+ zmN8f=CqgemXCOF4_rb@K^hsV*Q4G& zRH0&B;r5KSMV(9s?1EUatRRaOh8m+NZa%bK8LEWUGXs+J3 zd0TYG8Vm&{)+vpw=7hz0OuENhl@9@-YbmgWu7`A^+_pDODMiv(^|snn^AM4Th!vIR_wZ)q%03nurmyZ}iQ!v> zXh8WqhCb8t7;D#S+UWNPdGUJZ5uBcVY%$RLU54XRAAJA!uOcN^F{ME?(6|L&x=KdT zhIyRBB7H9rgKc!+K05I=y6_FL`VJTI11{l5(*B%QHNy2LmL>Qk-1`Gz0`f)C?w9`n DoTXJL literal 0 HcmV?d00001 diff --git a/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/manageable/Manageable.class b/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/manageable/Manageable.class new file mode 100644 index 0000000000000000000000000000000000000000..71af24f0ba243a529061947af22b605f96c48bda GIT binary patch literal 174 zcmX^0Z`VEs1_oyaE_MbcMh5xh{9OI?ocywU{oKU7#Prm}q?}ZJUpSMUfrXJlASIu*AJ_8!xB(5xt6K|q9j$$sTjhrz)(YX>W1qYw&j)$*Ao~HkTgBR%u7yT z04a&#Gg zx;x+$lX*qOIIap@tZRFE(Y7j@_uTMyxpO_u@?3#i5y^`%mcRri6#H36Nvnu9fl>MF^+-U-N zyr*DZ#RA?xnK=K>>3?4{oBH~zj;PjmUh5UF5D`@hJ@`E+0`pzWvtZCVJ$6|i3G>o2E`cm`a?i3Zm6E%fRWZf*(IQcVsuRBOckd=X#FTSk=8aK$C1#Wi56a`fQujlINqI}STxG>2H z8RMw@h%_eO74GkGn8$FRAKxYJ6Xf-w!2d=5-REB6I+~lAoy+vTg~+A*-ayG^;%|`r zl_vsAq$%{04q|{dhLGe7bS|{KOo<2hgjCua=PJ1N<$j0qGdF>H+-IIAeTYY-QuI0@ z#JI+DV|3VZB}X{upbw*zEaGtpwcT{`mk!gJ5Y4AlS;1$aO3TH}iD&{B<8*N~)O$ib zJ}e=$S?bFuhJVBP+#xO=VGKCLwN8*Xn2RY&mQK;U8L4@jnptXoeylmkzaVpmxYg-s zmg%44@zZ1RZiu-^NAq;FKux}gq%!Ywe7dBgbnY!?s<<$DICKp f*0^3Kkmpoi_vsft-Sp`*e9LoLUEkpc>>%?GUo~M0 literal 0 HcmV?d00001 diff --git a/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/Customer.class b/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/Customer.class new file mode 100644 index 0000000000000000000000000000000000000000..cc512284040cf2743746f6cee2143f4446aebb3f GIT binary patch literal 1724 zcmbVM+foxj5Iqwh8^VTQ03j%_B4851c)tMRC5nKcRH69b(~t~dVRt9BJBh`g_!(+> zsp7#8@S`kyk|2?6Q5Fw7GuxNbr>DE;*YCrh018-*BZ3YCohG^vWf&+*H(z#SP3B!$ z5>EbYAbf`Cg6-LAk>O=#ZI9P@-r-(3zo~rNE6<-zlHKY?4BZCeCVF5p44({Ls0K>9 zI=sP4C0_&qL#jQPhUqnt)EGS#e&7mEt#~`K8|RQR&~IV@gA9Ewybl5;T!s!=RSbg- zNL%JNC>=#f3GU9v33bTCFwzvhEYvIR3c8+5ww*wVZt{YOix_1Xa{0a}NUzA%J6rA2 zDNx)~#C$sB=0d>Y7>8xxl8FgiX6Uc8{+AmOs%WN;N94m$w^CrZpes9V;)>27revd7 zDH3Ki*BrxYh;Ms#?UE4I24)z>TMEcMUKV`Y5&8AMM+SMui0vHyN0QxQ=qykdGbGn+ zPrRzS+rodNSy89BbzZOil5Vh$j5ba*WE;NRv9(Q{>i*=Y^LpuLyD6)FQ7qL> z6GzQ@O&5&1?WvS1P(H7$3$-gtK@1NV(nnSnvud{ZK+|JM&4ASN3?m`xCYcx>GUS=X zy^>|Cz-kV}906(3t{qs-*0*fxeaj9=m5kz19FOtDz*AlG0>k9-6xd!(?u+ISH(GXy z7nSr67(TWZs%h9rWSPP_BA8s0a=%(RefIxxd~;9{A?EK}D*1YQPZZUBYkxH%3fyrv zZ6)ZE%oWcQe!<~EAOZtR3{!16g;6!I%rJJkDLr(Jyl{!eKSEPJ-`i-GI zO7bqu(t3^l=ICtDem-|~W;WgV11y*B`UWGHj($VpGij)Bw5HHWYY(~!BZ&kC(My`^ zxY5L!smBBQzMwDn9p?`*0({5VF@hdwjgv$_`P@9kb28L(h&+eM^A^(0n4`2a!tBa@ zh4G0F4XQdpKr3&DnkG(~PLL_RGqma($)TeTkjnkQlt!j6afl3X(r=n9?~q3XcX5yQ a0s3Dg-~07-uD&kd8EN7qeU2AcLHZ9>d9oA$ literal 0 HcmV?d00001 diff --git a/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/DeliveryPerson.class b/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/DeliveryPerson.class new file mode 100644 index 0000000000000000000000000000000000000000..ec7284322e559f801cae4e2353a8962221a53c10 GIT binary patch literal 2754 zcmb_dYg61*7=8|y4J?7>+IB%<+tQX@XtyY8Td)d?2$q{dsZy(k7%vy+x;# z-?f}0Ctq^5rIml~%CbOW%Ct@Islc<5#eL(*$XkZJn_u(FroB7)ev<4)D_YR1A*rJc zy1-ym^{lkaBUwIPm1Wnl1=^0}o>{cy`thL@=&o0*2s?D7&?%tPc>naeSt7bGKzsbj zFFHlTnl(H*sSb4O=s_39>(lY0PLS=$OSqd{h-E8V`?BawhKW-h-)`#pTDdv@U+ZnN-n|%J4c`b1RaKc`8@tljvSfbg-KRiP zfrT%SS~M?ibzNZuUd05qUh(@$vK!RMT)L?FplVZ0p<2m}(1zMNoK(kEDsEJF2$g^} zf;Q8g4vJj4(>Rjdq*8)HVOaT1Bb$n@t>njKrM#^gAi*G!=JEUv7u&;$(nJL z;uic83$7e)8=iuOEiq%-J5CF>1Xe`Gu(va&=U(o)N`;atrPXcjLjKyctjw0Iw!!o= zhR6L>0^3PQ>}c3kIk_h=d|A4tedHX-a1aF5IA;_+r_2ueYjwJWz#s1sF-xKrm-oT(bvrUtKu za##j_;U;@l0~^Nz8u{joWBY1Q!^VGeO7WfIKF0&sXZ$PhTjP5mH#&Ad-E;<#OE;fF z%cT>iXwNmBqU#TC3oLTIMljHhR&5_(*qHEzLtHs6xGE>B zp?9OuVS+e4LTHT@*{BsGv?5F7GTn|+pP)TTJx0(9R_m!5+9>ryQjZh)ZH(0?(4y26 zgnk!iHSaD;{fN|$iC@E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ErS>e9w1{y=Cb?cWPb|p9|bLRn7$?EEhm?GTq6EDKFG5b{%bI~LuPA;5vJQZ_lzVXnTz>_q-z?T}nQtkGX^?o|jOncwimC^7H2hgIi z<2&wwz)xqZEK&?3dSKW!OL~(_j1p_u>1~TCj;e<51;#E`<%Sbf6=sUF*{)X*g>3gBw8GWIA$khg*DKTp(NpLl z`eh7p9if*H`y*;C;4W8%JV7p<+!KWFytAZZoeypnf(xN)Ts|xaw>I6}hzeHh%QMIxdCyN|4tN4UktwEGN?B5Fn2t0?+@!%*QRMvgEJyu|fZl0_zYmYPc! zSWd@U&e8HVE%`)7KIh0r`OFqxp}<6ID%t$?|AE;fybZL5tSV}m1|3+zD)&MD-y+0X Uu&xK|Ccfs4s;h7C9Smgu0Sb*|PXGV_ literal 0 HcmV?d00001 diff --git a/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/User.class b/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/User.class new file mode 100644 index 0000000000000000000000000000000000000000..7ea5974c820cbc317af186daadf6f071cffaf731 GIT binary patch literal 2063 zcmbVM>r&fB7(ENvvW*OmO+sjHNse%wHIOqg4pU&NsXBJsQ#;D;sFw8X9|PGF81tQu z6eunqv8{zY*KgOf{)CB1tvue{RK8r0ReiSw8dnC>`RvabB56aM6en>+=f(7QPi=Jw` zjN#m=9M?{zsSy=GZcT0XnzG?)kFvTkmUN<6GS8I?gRtjx-^g%NwSo+u3N$q0fhDX> zC$JnV>J2My4om%N=^Mvy@w1}#pzKg&9kd4}89Zm>35!;=Wy^AX>jRrZ%fA(Dr2{!F zoJ^yU!*_UT;FYd}?*(R$`qlM!)Rwg4IK*AnaGIg&?F#&MJQ#go?8-};=*eJqS*fk< zZtb&$a6<9jZdWG2e?G<#&!gJ$D(F+x9nV{HLs_GTuY6zj>K=0`0|RdaZVdU9WU7I; z0+&AzWo~1?aFw%ZgrjJTE9W3jBYLDoJ4aZwb8vAt+3zVVa9!lT25~9wUsOLqROk0# zR2TM;uP*MPP@NguL+KCR3M^?1(p+ z)JS29$S?6#AAgCv;7zLf7mVL|h@VSG!fCFzlBx59)E7v7k@(w*)cHZ`D}>%jrY;Op zUnlh}@pluc3xm{ignpe&eJr4HK;}uU)A3Crb!m{=CiLDRbcxx}u{)<@$1l&Xz^}BA zbHJePU1IO!0au;-MU3(XocWXKr~3RpEZ`%q4?2Gzg-EG(sJg&ZYSlttbsv>P%||Sa k$3#9Pb_9=j29rOE7c}8Xv_6a0I$rZ8N9i(Fu!@=g0JhM`SpWb4 literal 0 HcmV?d00001 diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/app/GlovoApp.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/app/GlovoApp.java new file mode 100644 index 0000000..9ae3ac7 --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/app/GlovoApp.java @@ -0,0 +1,112 @@ +package com.glovo.app; + +import com.glovo.model.*; +import com.glovo.exception.EmptyOrderException; + + +import java.util.*; +import java.io.*; + + +public class GlovoApp { + public static void main(String [] args){ + Scanner sc = new Scanner(System.in); + OrderManager manager = new OrderManager(); + + while(true){ + System.out.println("\n--- Glovo Order Manager Menu ----"); + System.out.println("1. Add An Order"); + System.out.println("2. Remove An Order"); + System.out.println("3. View Order"); + System.out.println("4. Search Orders By Status"); + System.out.println("5. Sort Orders By Date"); + System.out.println("6. Save Order"); + System.out.println("7. Load Order"); + System.out.println("0. Quit"); + System.out.println("Please make an option: "); + try{ + int choice = Integer.parseInt(sc.nextLine()); + + switch(choice){ + case 1: + System.out.print("Order ID: "); + int id = Integer.parseInt(sc.nextLine()); + System.out.print("Delivery Address: "); + String address = sc.nextLine(); + Customer customer = new Customer("Younes", "0600000000", "Rabat"); + Restaurant restaurant = new Restaurant("PizzaHut", "Agdal", 4.6); + DeliveryPerson courier = new DeliveryPerson("Ali", "0655544444", "Bike"); + Order order = new Order(id, address, customer, courier, restaurant); + manager.addOrder(order); + System.out.println("Order added."); + break; + case 2: + if(manager.getAllOrders().isEmpty()){ + throw new EmptyOrderException("No Orders To Remove"); + } + System.out.println("Enter index of order to delete"); + int index = Integer.parseInt(sc.nextLine()); + manager.removeOrder(manager.getAllOrders.get(index)); + System.out.println("Order has been removed successfully"); + break; + + case 3: + if(manager.getAllOrders().isEmpty()){ + throw new EmptyOrderException("No Orders To Display"); + } + for(Order ord: manager.getAllOrders()){ + System.out.println(ord); + + } + break; + + case 4: + System.out.println("Status (PENDING, DISPATCHED, DELIVERED): "); + OrderStatus status = OrderStatus.valueOf(sc.nextLine.toUpperCase()); + List results = manager.searchByStatus(status); + + if(results.isEmpty()){ + System.out.println("No Orders to show"); + } + else{ + for(Order o: results){ + System.out.println(o); + } + } + break; + + case 5: + manager.sortByDate(); + System.out.println("Orders Arranged By Date"); + break; + + case 6: + manager.saveToFile("data/glovo/orders.ser"); + System.out.println("Orders saved."); + break; + case 7: + manager.loadFromFile("data/glovo/orders.ser"); + System.out.println("Orders loaded successfully"); + break; + + case 0: + System.out.println("Leave"); + return; + + default: + System.out.println(" Incorrect option"); + } + } + catch (EmptyOrderListException e) { + System.out.println(" " + e.getMessage()); + System.out.println(e.recoverySuggestion()); + } + + catch (Exception e) { + System.out.println("💥 Error: " + e.getMessage()); + } + } + } +} + +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/exception/EmptyOrderException.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/exception/EmptyOrderException.java new file mode 100644 index 0000000..095dd78 --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/exception/EmptyOrderException.java @@ -0,0 +1,11 @@ +package com.glovo.exception; + +public class EmptyOrderException extends Exception{ + public EmptyOrderException(String message){ + super(message); + } + + public String recoverFromException(){ + return("Please add at least one order before performing this operation: "); + } +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/manageable/Manageable.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/manageable/Manageable.java new file mode 100644 index 0000000..4b5e248 --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/manageable/Manageable.java @@ -0,0 +1,6 @@ +package com.glovo.manageable; + +public interface Manageable{ + void manageOrder(); + public void manageProfile(); +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Admin.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Admin.java new file mode 100644 index 0000000..120d18c --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Admin.java @@ -0,0 +1,56 @@ +package com.glovo.model; +import com.glovo.model.Permissions; +import com.glovo.manageable.Manageable; +import java.util.List; + + +public class Admin extends User implements Manageable{ + private List permissionsList; + private int adminId; + public Admin(String name, String phoneNumber, String email, String password, int adminId, Listperms){ + super(name,phoneNumber,email,password); + this.adminId=adminId; + this.permissionsList=perms; + } + + public int getAdminId() { + return adminId; + } + + public void setAdminId(int adminId) { + this.adminId = adminId; + } + + public List getPermissionsList() { + return permissionsList; + } + + public void setPermissionsList(List permissionsList) { + this.permissionsList = permissionsList; + } + + + + public void monitorOrder(){ + System.out.println("Admin " + getName() + " monitoring orders"); + } + + public void handleDispute(){ + System.out.println("Admin " + getName() + " handling dispute"); + } + + @Override + public void manageOrder(){ + monitorOrder(); + } + + @Override + public void manageProfile(){ + System.out.println("Admin " + getName() + " updating profile"); + } + + @Override + public String toString(){ + return(super.toString() + ", adminId=" + adminId + ", permissions=" + permissionsList); + } +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Customer.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Customer.java new file mode 100644 index 0000000..e2f5a25 --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Customer.java @@ -0,0 +1,40 @@ +package com.glovo.model; +import com.glovo.manageable.Manageable; + +public class Customer extends User implements Manageable{ + + private String address; + private String paymentInfo; + + + public Customer(String name, String phoneNumber, String email, String password, String address,String paymentInfo) { + super(name,phoneNumber,email,password); + this.address = address; + this.paymentInfo=paymentInfo; + } + + @Override + public void manageOrder(){ + System.out.println("Customer " + getName() + " viewing orders"); + } + + @Override + public void manageProfile(){ + System.out.println("Customer " + getName() + " viewing Profile"); + } + + + + public String getAddress() { + return address; + } + + + public String getPaymentInfo() { + return paymentInfo; + } + @Override + public String toString() { + return(super.toString() + " and its address: "+this.address+" and his payment info is: "+this.paymentInfo); + } +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/model/DeliveryPerson.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/DeliveryPerson.java new file mode 100644 index 0000000..0cb646a --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/DeliveryPerson.java @@ -0,0 +1,85 @@ +package com.glovo.model; +import java.time.LocalDate; +import com.glovo.manageable.Manageable; + +//for getter setter select the field right click===> refactor==>encapsulate fields==>select fields + +public class DeliveryPerson extends User implements Manageable{ + private String vehicleType; + private boolean availability; + private LocalDate deliveryTime; + + public DeliveryPerson(String name, String phoneNumber, String email, String password, String vehicleType, LocalDate deliveryTime) { + super(name, phoneNumber, email, password); + this.vehicleType=vehicleType; + this.deliveryTime=deliveryTime; + this.availability=true; + } + + public DeliveryPerson(String name, String phoneNumber, String email, String password, String vehicleType) { + this(name, phoneNumber, email, password, vehicleType, LocalDate.now()); + } + + + public void setName(String name) + { + super.setName(name); + } + + public String getName() + { + return super.getName(); + } + + public String getPhoneNumber() + { + return super.getPhoneNumber(); + } + + public void setPhoneNumber(String phoneNumber){ + super.setPhoneNumber(phoneNumber); + } + + public LocalDate getDeliveryTime() { + return deliveryTime; + } + + public void setDeliveryTime(LocalDate deliveryTime) { + this.deliveryTime = deliveryTime; + } + + public String getVehicleType(){ + return vehicleType; + } + + public void setVehicleType(String vehicleType){ + this.vehicleType=vehicleType; + } + + public boolean isAvailable(){ + return availability; + } + + public void setAvailability(boolean availability) + { + this.availability=availability; + } + + + + @Override + public void manageOrder(){ + System.out.println("This person: "+getName()+" is delivering your order"); + } + + @Override + public void manageProfile(){ + System.out.println("This person: "+getName()+" is updating vehicle info"); + } + + + @Override + public String toString(){ + return(super.toString()+" and its vehicle is: "+vehicleType+" and his availability: "+ availability+" and will be delivering it at: "+deliveryTime); + } +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Order.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Order.java new file mode 100644 index 0000000..fa5306d --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Order.java @@ -0,0 +1,88 @@ +package com.glovo.model; + +import java.time.LocalDate; +import java.util.List; +import java.util.ArrayList; +import java.util.Collections; + + + +public class Order{ + + private int orderId; + private LocalDate orderDate; + private String deliveryAddress; + private OrderStatus status; + private Customer customer; + private Courrier courrier; + private Restaurant restaurant; + private List items = new ArrayList<>(); + + + + + + public Order(int orderId, String deliveryAddress, Customer customer, DeliverPerson courrier, Restaurant restaurant) { + this(orderId, LocalDate.now(), deliveryAddress, OrderStatus.PENDING, customer, courrier, restaurant); + } + + public Order(int orderId, LocalDate orderDate, String deliveryAddress, OrderStatus status, Customer customer, Courrier courrier, Restaurant restaurant) + { + this.orderId = orderId; + this.orderDate = orderDate; + this.deliveryAddress = deliveryAddress; + this.status = status; + this.customer = customer; + this.courrier = courrier; + this.restaurant = restaurant; + } + public int getOrderId(){ + return orderId; + } + + public LocalDate getOrderDate() { + return orderDate; + } + + public String getDeliveryAddress(){ + return deliveryAddress; + } + + public OrderStatus getStatus(){ + return status; + } + + public void setStatus(OrderStatus status){ + this.status=status; + } + + public Customer getCustomer(){ + return customer; + } + + public Courrier getCourrier(){ + return courrier; + } + + public Restaurant getRestaurant() { + return restaurant; + } + + @Override + public String toString(){ + return String.format("Order id: %d, Date: %s, Status: %s, Delivery Address: %s, Customer: %s, Courrier: %s, Restaurant: %s",orderId, orderDate,status,deliveryAddress,customer,courrier,restaurant); + } + + public void addItem(OrderItem i){ + items.add(i); + } + + public List getItems() { + return Collections.unmodifiableList(items); + } + + public double getTotal(){ + return items.stream().mapToDouble(OrderItem::getTotalPrice).sum(); + } + +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/model/OrderItem.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/OrderItem.java new file mode 100644 index 0000000..0a260dd --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/OrderItem.java @@ -0,0 +1,56 @@ +package com.glovo.model; +import java.util.Collections; +import java.util.List; +import java.util.ArrayList; + +public class OrderItem { + private int itemId; + private int quantity; + private double price; + + public OrderItem(int itemId, int quantity, double price){ + this.itemId=itemId; + this.price=price; + this.quantity=quantity; + + } + + public void setStatus(OrderStatus status){ + this.status=status; + } + + public OrderStatus getStatus() { + return status; + } + + public double getPrice(){ + return price; + } + + public void setPrice(double price){ + this.price=price; + } + + public int getQuantity(){ + return quantity; + } + + public void setQuantity(int quantity){ + this.quantity=quantity; + } + + public int getItemId(){ + return itemId; + } + + public void setItemId(int itemId){ + this.itemId=itemId; + } + + public double getTotalPrice() { + return quantity * price; + } + + + +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/model/OrderManager.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/OrderManager.java new file mode 100644 index 0000000..c54dfb8 --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/OrderManager.java @@ -0,0 +1,58 @@ +package com.glovo.model; +import java.io.*; +import java.util.*; +import com.glovo.model.Owner; +import com.glovo.model.OrderStatus; + +public class OrderManager implements Serializable { + public List orders; + + public OrderManager(){ + this.orders=new ArrayList<>(); + } + + public void addOrder(Order o){ + orders.add(o); + } + + public void removeOrder(Order o){ + orders.remove(o); + } + + public void editOrder(int index, Order newOrder){ + if(index>=0 && indexSearchByStatus(OrderStatus status){ + List results = new ArrayList<>(); + for(Order o:orders){ + if(o.getStatus()==status){ + results.add(o) + } + } + return results; + } + + public void sortByDate(){ + orders.sort(Comparator.comparing(Order::getOrderDate)); + } + + public List getAllOrders(){ + return orders; + } + + public void saveToFile(String filePath) throws IOException{ + ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filePath)); + oos.writeObject(orders); + oos.close(); + } + + public void loadFromFile(String filePath){ + ObjectInputStream ois = new ObjectInputStream(new FileInputStream(path)); + orders=(List)ois.readObject(); + ois.close(); + } + +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/model/OrderStatus.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/OrderStatus.java new file mode 100644 index 0000000..c63ece0 --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/OrderStatus.java @@ -0,0 +1,10 @@ +package com.glovo.model; + + +public enum OrderStatus{ + PENDING, + DISPATCHED, + DELIVERED, + CANCELLED, + ASSIGNED +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Permissions.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Permissions.java new file mode 100644 index 0000000..162afc6 --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Permissions.java @@ -0,0 +1,7 @@ +package com.glovo.model; + +public enum Permissions { + MANAGE_USERS, + VIEW_REPORTS, + HANDLE_DISPUTES +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Restaurant.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Restaurant.java new file mode 100644 index 0000000..de3145a --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Restaurant.java @@ -0,0 +1,41 @@ +package com.glovo.model; + +public class Restaurant{ + private String name; + private String address; + private double rating; + + public Restaurant(String name, String address, double rating){ + this.name=name; + this.address=address; + this.rating=rating; + } + + public String getName(){ + return name; + } + + public String getAddress(){ + return address; + } + + public double getRating(){ + return rating; + } + + public void setRating(double rating){ + this.rating=rating; + } + + @Override + public String toString() { + return String.format( + "Restaurant: %s, Address: %s, Rating: %.1f", + name, + address, + rating + ); + } + + +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/model/RestaurantOwner.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/RestaurantOwner.java new file mode 100644 index 0000000..6d03572 --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/RestaurantOwner.java @@ -0,0 +1,59 @@ +package com.glovo.model; + +import java.util.List; +import com.glovo.manageable.Manageable; + +public class RestaurantOwner extends User implements Manageable{ + private String address; + private double rating; + private List menu; + + public RestaurantOwner(String name, String phoneNumber, String email, String password, String address, double rating, Listmenu){ + super(name,phoneNumber,email,password); + this.address=address; + this.rating=rating; + this.menu=menu; + } + + public void setRating(double rating){ + this.rating=rating; + } + + public double getRating() { + return rating; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public List getMenu() { + return menu; + } + + public void setMenu(List menu) { + this.menu = menu; + } + + @Override + public void manageOrder(){ + System.out.println("Restaurant Owner managing: "+getName()+"'s orders"); + } + + @Override + public void manageProfile(){ + System.out.println("Restaurant Owner managing: "+getName()+"'s profile"); + } + + @Override + public String toString(){ + return super.toString()+", address: "+address+" rating: "+rating+", menu: "+menu; + } + + + +} \ No newline at end of file diff --git a/OOPClss/GlovoAppPartIIII/src/com/glovo/model/User.java b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/User.java new file mode 100644 index 0000000..d86baf7 --- /dev/null +++ b/OOPClss/GlovoAppPartIIII/src/com/glovo/model/User.java @@ -0,0 +1,65 @@ +package com.glovo.model; + + +public class User{ + private String name; + private String phoneNumber; + private String email; + private String password; + + public User(String name, String phoneNumber, String email, String password){ + this.name=name; + this.phoneNumber=phoneNumber; + this.email=email; + this.password=password; + } + + + public void setName(String name){ + this.name=name; + } + + public String getName(){ + return name; + } + + public void setPhoneNumber(String phoneNumber){ + this.phoneNumber=phoneNumber; + } + + public String getPhoneNumber(){ + return phoneNumber; + } + + public void setEmail(String email){ + this.email=email; + } + + public String getEmail(){ + return email; + } + + public void setPassword(String password){ + this.password=password; + } + + public String getPassword(){ + return password; + } + + @Override + public String toString() + { + return("User: "+this.name+" has a phone Number of : "+this.phoneNumber+" and an email of: "+this.email+" and a password: "+this.password); + } + + public void login(String email, String password){ + System.out.println(name + " logged in with " + email); + } + + public void logout(String email, String password){ + System.out.println(name + " logged out"); + } + + +} \ No newline at end of file