├── Android
└── README.me
├── LeetC
├── PascalTri.java
├── README.md
└── NumberOfIsl.java
├── .vscode
└── settings.json
├── ReadingInput
├── pc.txt
├── Part3.java
├── Part1.java
└── Part2.java
├── Spring_Boot
├── todolist
│ ├── src
│ │ ├── main
│ │ │ ├── resources
│ │ │ │ └── application.properties
│ │ │ └── java
│ │ │ │ └── todolist
│ │ │ │ └── todolist
│ │ │ │ ├── api
│ │ │ │ └── TodoListAPI.java
│ │ │ │ ├── TodolistApplication.java
│ │ │ │ └── TodoList.java
│ │ └── test
│ │ │ └── java
│ │ │ └── todolist
│ │ │ └── todolist
│ │ │ └── TodolistApplicationTests.java
│ ├── .mvn
│ │ └── wrapper
│ │ │ ├── maven-wrapper.jar
│ │ │ └── maven-wrapper.properties
│ └── .gitignore
├── JPA
│ └── README.md
└── CORS
│ └── README.md
├── .idea
├── .gitignore
├── vcs.xml
├── misc.xml
├── modules.xml
└── Java.iml
├── Enums
├── Speaks.java
├── Student.java
├── README.md
├── MyAwesomeProg.java
└── User.java
├── OOPClss
├── 2_JavaUserDefinedExceptionSampleApp
│ ├── build
│ │ └── classes
│ │ │ ├── .netbeans_automatic_build
│ │ │ ├── .netbeans_update_resources
│ │ │ ├── users
│ │ │ ├── User.class
│ │ │ ├── UserCollection.class
│ │ │ └── UserNotFoundException.class
│ │ │ └── tests
│ │ │ └── Authentication.class
│ ├── nbproject
│ │ ├── private
│ │ │ ├── config.properties
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── genfiles.properties
│ │ └── project.xml
│ ├── manifest.mf
│ └── src
│ │ └── users
│ │ ├── UserExistsException.java
│ │ └── UserNotFoundException.java
├── Eventful
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── vcs.xml
│ │ ├── modules.xml
│ │ └── misc.xml
│ ├── src
│ │ └── com
│ │ │ └── eventful
│ │ │ ├── model
│ │ │ └── Category.java
│ │ │ └── app
│ │ │ └── Main.java
│ ├── Eventful.iml
│ └── .gitignore
├── GlovoApp
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── vcs.xml
│ │ ├── modules.xml
│ │ └── misc.xml
│ ├── src
│ │ └── com
│ │ │ └── glovo
│ │ │ └── model
│ │ │ ├── OrderStatus.java
│ │ │ ├── Restaurant.java
│ │ │ └── Customer.java
│ └── GlovoApp.iml
├── EcommerceApp
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── vcs.xml
│ │ ├── misc.xml
│ │ └── modules.xml
│ ├── src
│ │ ├── Main.java
│ │ └── com
│ │ │ ├── orderitem
│ │ │ └── OrderItem.java
│ │ │ ├── cartItem
│ │ │ └── CartItem.java
│ │ │ ├── cart
│ │ │ └── Cart.java
│ │ │ ├── product
│ │ │ └── Product.java
│ │ │ ├── address
│ │ │ └── Address.java
│ │ │ ├── payment
│ │ │ └── Payment.java
│ │ │ └── paymentmethod
│ │ │ └── PaymentMethod.java
│ ├── EcommerceApp.iml
│ └── .gitignore
├── LibraryApp
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── vcs.xml
│ │ ├── modules.xml
│ │ └── misc.xml
│ ├── src
│ │ └── com
│ │ │ └── library
│ │ │ ├── book
│ │ │ └── Book.class
│ │ │ ├── loan
│ │ │ └── Loan.class
│ │ │ ├── member
│ │ │ └── Member.class
│ │ │ ├── app
│ │ │ └── LibraryApp.class
│ │ │ ├── loanstatus
│ │ │ ├── LoanStatus.java
│ │ │ └── LoanStatus.class
│ │ │ └── librarian
│ │ │ ├── Librarian.class
│ │ │ └── Librarian.java
│ ├── Library.iml
│ └── .gitignore
├── RideSharingApp
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── vcs.xml
│ │ ├── misc.xml
│ │ └── modules.xml
│ ├── .gitignore
│ ├── RideSharingApp.iml
│ └── src
│ │ └── com
│ │ └── ridesharingapp
│ │ └── entities
│ │ └── tripstatus
│ │ └── TripStatus.java
├── Enhancedglovoapp
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── vcs.xml
│ │ ├── misc.xml
│ │ └── modules.xml
│ ├── src
│ │ ├── orderStatus.java
│ │ ├── manageable.java
│ │ ├── main.java
│ │ ├── admin.java
│ │ └── restaurantOwner.java
│ ├── .gitignore
│ └── Enhancedglovoapp.iml
├── Exercises.class
├── GlovoAppPartIII
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── vcs.xml
│ │ ├── modules.xml
│ │ └── misc.xml
│ ├── src
│ │ ├── bin
│ │ │ └── com
│ │ │ │ └── glovo
│ │ │ │ ├── model
│ │ │ │ ├── Admin.class
│ │ │ │ ├── User.class
│ │ │ │ ├── Customer.class
│ │ │ │ ├── Permissions.class
│ │ │ │ ├── DeliveryPerson.class
│ │ │ │ └── RestaurantOwner.class
│ │ │ │ ├── app
│ │ │ │ └── GlovoApp.class
│ │ │ │ └── manageable
│ │ │ │ └── Manageable.class
│ │ └── com
│ │ │ └── glovo
│ │ │ ├── model
│ │ │ ├── Permissions.java
│ │ │ ├── OrderStatus.java
│ │ │ ├── Restaurant.java
│ │ │ └── Customer.java
│ │ │ └── manageable
│ │ │ └── Manageable.java
│ └── GlovoApp.iml
├── GlovoAppPartIIII
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── vcs.xml
│ │ ├── modules.xml
│ │ └── misc.xml
│ ├── src
│ │ ├── bin
│ │ │ └── com
│ │ │ │ └── glovo
│ │ │ │ ├── model
│ │ │ │ ├── User.class
│ │ │ │ ├── Admin.class
│ │ │ │ ├── Customer.class
│ │ │ │ ├── Permissions.class
│ │ │ │ ├── DeliveryPerson.class
│ │ │ │ └── RestaurantOwner.class
│ │ │ │ ├── app
│ │ │ │ └── GlovoApp.class
│ │ │ │ └── manageable
│ │ │ │ └── Manageable.class
│ │ └── com
│ │ │ └── glovo
│ │ │ ├── model
│ │ │ ├── Permissions.java
│ │ │ ├── OrderStatus.java
│ │ │ ├── Restaurant.java
│ │ │ └── Customer.java
│ │ │ ├── manageable
│ │ │ └── Manageable.java
│ │ │ └── exception
│ │ │ └── EmptyOrderException.java
│ └── GlovoApp.iml
├── PayrollApp
│ └── untitled
│ │ ├── .idea
│ │ ├── .gitignore
│ │ ├── vcs.xml
│ │ ├── modules.xml
│ │ └── misc.xml
│ │ ├── src
│ │ ├── Main.class
│ │ ├── com
│ │ │ └── payroll
│ │ │ │ └── employee
│ │ │ │ ├── Employee.class
│ │ │ │ └── Employee.java
│ │ └── Main.java
│ │ ├── untitled.iml
│ │ └── .gitignore
├── EcommerceOrderSystem
│ ├── .idea
│ │ ├── .gitignore
│ │ ├── vcs.xml
│ │ ├── misc.xml
│ │ └── modules.xml
│ ├── src
│ │ └── com
│ │ │ └── ecommerce
│ │ │ ├── model
│ │ │ ├── paymentMethod
│ │ │ │ └── PaymentMethod.java
│ │ │ ├── orderitem
│ │ │ │ └── Orderitem.java
│ │ │ ├── cart
│ │ │ │ └── Cart.java
│ │ │ ├── cartItem
│ │ │ │ └── CartItem.java
│ │ │ ├── address
│ │ │ │ └── Address.java
│ │ │ ├── product
│ │ │ │ └── Product.java
│ │ │ ├── order
│ │ │ │ └── Order.java
│ │ │ ├── payment
│ │ │ │ └── Payment.java
│ │ │ └── shipment
│ │ │ │ └── Shipment.java
│ │ │ └── app
│ │ │ └── EcommerceApp.java
│ ├── .gitignore
│ └── EcommerceOrderSystem.iml
├── Generics
│ ├── Car.class
│ ├── GenericsP1.class
│ └── Car.java
├── GlovoAppPartIIII.zip
├── GlovoAppOmarBelkady.zip
├── ExercisesSummer2025
│ ├── daysOfWeek.java
│ ├── daysOfWeek.class
│ ├── Enumeration.class
│ ├── OneThrough50.class
│ ├── ProblemSets
│ │ ├── Book.class
│ │ ├── Main.class
│ │ ├── BankAccount
│ │ │ ├── Main.class
│ │ │ ├── BankAccount.class
│ │ │ └── Main.java
│ │ ├── PersonInheritanc
│ │ │ ├── Person.class
│ │ │ ├── Student.class
│ │ │ ├── Teacher.class
│ │ │ ├── Student.java
│ │ │ ├── Teacher.java
│ │ │ └── Person.java
│ │ ├── Main.java
│ │ └── Book.java
│ └── Enumeration.java
├── CollectionsSampleApplicationSkeleton (extract.me)
│ └── CollectionsSampleApplicationSkeleton
│ │ ├── manifest.mf
│ │ ├── nbproject
│ │ ├── private
│ │ │ ├── private.properties
│ │ │ └── private.xml
│ │ ├── genfiles.properties
│ │ └── project.xml
│ │ ├── build
│ │ ├── built-jar.properties
│ │ └── classes
│ │ │ ├── students
│ │ │ ├── Student.class
│ │ │ └── StudentCollection.class
│ │ │ └── LMS
│ │ │ └── StudentSystem.class
│ │ ├── dist
│ │ └── CollectionsSampleApplicationSkeleton.jar
│ │ └── src
│ │ └── LMS
│ │ └── StudentSystem.java
├── DataStructures
│ ├── MyContainer.java
│ └── Arrays.java
├── .idea
│ ├── misc.xml
│ ├── vcs.xml
│ ├── modules.xml
│ └── OOPClss.iml
├── Library.java
├── Member.java
├── StudentApp
│ └── StudentApp
│ │ ├── src
│ │ └── main
│ │ │ └── java
│ │ │ └── aui
│ │ │ └── students
│ │ │ └── studentapp
│ │ │ └── AcademicStatus.java
│ │ └── pom.xml
├── genericsexample
│ └── StudentApp (1)
│ │ └── StudentApp
│ │ ├── src
│ │ └── main
│ │ │ └── java
│ │ │ ├── aui
│ │ │ └── students
│ │ │ │ └── studentapp
│ │ │ │ └── AcademicStatus.java
│ │ │ └── PrintingUsingOverloadedMethods.java
│ │ └── pom.xml
└── Book.java
├── Switch
├── Speaks.java
├── Student.java
├── User.java
└── MyAwesomeProg.java
├── Spring_RestController_RestApi
├── todolist
│ ├── src
│ │ ├── main
│ │ │ ├── resources
│ │ │ │ └── application.properties
│ │ │ ├── java
│ │ │ │ └── todolist
│ │ │ │ │ └── todolist
│ │ │ │ │ ├── TodolistApplication.java
│ │ │ │ │ └── TodoList.java
│ │ │ └── todolist.hello
│ │ │ │ └── HelloController.java
│ │ └── test
│ │ │ └── java
│ │ │ └── todolist
│ │ │ └── todolist
│ │ │ └── TodolistApplicationTests.java
│ ├── .mvn
│ │ └── wrapper
│ │ │ ├── maven-wrapper.jar
│ │ │ └── maven-wrapper.properties
│ └── .gitignore
└── README.md
├── StudentApp
└── untitled
│ ├── .idea
│ ├── .gitignore
│ ├── vcs.xml
│ ├── modules.xml
│ └── misc.xml
│ ├── src
│ ├── Main.java
│ └── aui
│ │ └── students
│ │ └── Students.java
│ ├── untitled.iml
│ └── .gitignore
├── Solid_Principles
├── Interface_Segregation
│ ├── IRunnerBird.java
│ ├── ISwimmerBird.java
│ ├── IBird.java
│ ├── Penguin.java
│ ├── Parrot.java
│ └── Ostrich.java
├── Dependency_Inversion_Principle
│ ├── Car.java
│ ├── IRaceMachine.java
│ ├── Truck.java
│ └── Main.java
├── Open_Close_Responsibility_Principle
│ ├── PostModel.java
│ ├── Main.java
│ ├── Tag.java
│ ├── Post.java
│ └── README.md
├── Liskov_Substitution_Principle
│ ├── Square.java
│ ├── Rectangle.java
│ ├── Main.java
│ └── README.md
└── Single_Responsibility_Principle
│ └── Main.java
├── commit.sh
├── Dynamic_Pro
└── Fibonacci
│ └── Fib.class
├── UML
└── Library
│ ├── User.java
│ ├── Librarian.java
│ ├── Loan.java
│ ├── Book.java
│ └── Member.java
├── Inheritance
├── User.java
├── Student.java
├── p2
│ ├── Student.java
│ ├── User.java
│ └── MyAwesomeProg.java
└── MyAwesomeProg.java
├── Methods
├── Method.java
└── Main.java
├── Interfaces
├── Speaks.java
├── Student.java
├── Teacher.java
├── MyAwesomeProg.java
└── User.java
├── Conditionals
├── Booleanif.java
├── Ternaryop.java
├── While.java
├── ConditionalsWthCompOp.java
├── Righttriangle.java
├── If.java
├── DoWhile2.java
├── Switch.java
├── ForEach.java
├── Breakorcontinue.java
├── WhileLoopFreeMemICU.java
└── DoWhile.java
├── Casting
├── Casting2.java
├── Explicitcasting.java
├── README.md
└── Implicitcasting.java
├── MathndNumbers
├── Constants.java
└── Math.java
├── Functions
├── MyAwesomeProg.java
├── README.md
└── Getset.java
├── Loops
└── While2.java
├── Operators
├── Compoper.java
└── Logicoper.java
├── MethOver
├── Student.java
├── User.java
└── MyAwesomeProg.java
├── PBVVSPBR
├── README.md
├── MyAwesomeProg.java
└── MyAwesomeProgp2.java
├── MustKnow
├── Design Pat
│ └── README.md
├── GCDeuclid
│ └── README.md
└── Graphs
│ └── README.md
├── Polymorphism
├── Teacher.java
├── Student.java
├── User.java
└── MyAwesomeProg.java
├── ParentClassMethodsPLUSSuper
├── Student.java
├── MyAwesomeProg.java
└── User.java
├── ArraysInfo
├── omarsArrayProblem.java
├── Multidimarray.java
├── ArrayTest.java
└── MultidimArrs.java
├── Classes
├── Inheritance
│ ├── Animal.java
│ ├── Dog.java
│ ├── Main.java
│ └── Cat.java
├── Fields2Class
│ └── User.java
├── Objects.java
└── Dog.java
├── Constructors
├── Defconst
│ ├── User.java
│ ├── MyAwesomeProg.java
│ └── Student.java
├── Main.java
├── CustConst
│ ├── User.java
│ ├── Student.java
│ └── MyAwesomeProg.java
├── Dog.java
└── Cat.java
├── ArbitraryObjects
├── Student.java
└── Main.java
├── Strings.java
├── Encapsulation
├── Encapsulate.java
└── EncapsulateThis.java
├── CompareTo
├── README.md
└── Main.java
├── Maps
├── HashMapTest.java
├── Sorting.java
├── LinkedHashMapTest.java
├── TreeMapTest.java
├── HashTable
│ └── HashTable.java
└── LetterOccurence.java
├── Abstraction
├── Student.java
├── MyAwesomeProg.java
├── User.java
└── README.md
├── DataTypeCateg
├── ObjectType.java
└── PrimitiveType.java
├── Wrapper_Classes
└── README.md
├── NumberFormatting
├── currency.java
├── formatNums1.java
└── README.md
├── EqualsAndHashcode
├── Main2.java
├── README.md
└── NullPointExcep
│ └── MyAwesomeProg.java
├── Override
├── MyAwesomeProg1.java
├── toString
├── MyAwesomeProg.java
└── EqualsNdHashCode
│ └── MyAwesomeProg.java
├── Lists
├── ArrList.java
├── LinkedListTest.java
├── User.java
├── myArrList.java
└── CustType.java
├── Queues
└── README.md
├── Sets
└── TreeSetTest.java
├── Garbage_Collection
└── GarbageColl.java
└── RetCustObj
└── MyAwesomeProg.java
/Android/README.me:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/LeetC/PascalTri.java:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/LeetC/README.md:
--------------------------------------------------------------------------------
1 | ## Leet Code Practice
2 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.fontLigatures": null
3 | }
--------------------------------------------------------------------------------
/ReadingInput/pc.txt:
--------------------------------------------------------------------------------
1 | asus
2 | msi
3 | gigabyte
4 | asrock
5 | evga
--------------------------------------------------------------------------------
/Spring_Boot/todolist/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/Enums/Speaks.java:
--------------------------------------------------------------------------------
1 | public interface Speaks{
2 | void wavingToYou();
3 | }
4 |
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/private/config.properties:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Switch/Speaks.java:
--------------------------------------------------------------------------------
1 | public interface Speaks{
2 | void wavingToYou();
3 | }
4 |
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Spring_RestController_RestApi/todolist/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/OOPClss/Eventful/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/OOPClss/GlovoApp/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/OOPClss/RideSharingApp/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/StudentApp/untitled/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/OOPClss/Enhancedglovoapp/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/OOPClss/Exercises.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/Exercises.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/OOPClss/PayrollApp/untitled/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/OOPClss/Generics/Car.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/Generics/Car.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIIII.zip
--------------------------------------------------------------------------------
/Solid_Principles/Interface_Segregation/IRunnerBird.java:
--------------------------------------------------------------------------------
1 | public interface IRunnerBird{
2 | void run();
3 | }
4 |
--------------------------------------------------------------------------------
/commit.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | git pull origin master
3 | git add .
4 | git commit -m "$*"
5 | git push origin alan
--------------------------------------------------------------------------------
/Dynamic_Pro/Fibonacci/Fib.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/Dynamic_Pro/Fibonacci/Fib.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppOmarBelkady.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppOmarBelkady.zip
--------------------------------------------------------------------------------
/Solid_Principles/Dependency_Inversion_Principle/Car.java:
--------------------------------------------------------------------------------
1 | public class Car implements IRaceMachine{
2 |
3 |
4 | }
5 |
--------------------------------------------------------------------------------
/Solid_Principles/Dependency_Inversion_Principle/IRaceMachine.java:
--------------------------------------------------------------------------------
1 | public interface IRaceMachine{
2 |
3 |
4 | }
5 |
--------------------------------------------------------------------------------
/Solid_Principles/Dependency_Inversion_Principle/Truck.java:
--------------------------------------------------------------------------------
1 | public class Truck implements IRaceMachine{
2 |
3 | }
4 |
--------------------------------------------------------------------------------
/OOPClss/Enhancedglovoapp/src/orderStatus.java:
--------------------------------------------------------------------------------
1 | public enum orderStatus {
2 | PENDING, DISPATCHED, DELIVERED;
3 | }
4 |
--------------------------------------------------------------------------------
/OOPClss/Generics/GenericsP1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/Generics/GenericsP1.class
--------------------------------------------------------------------------------
/UML/Library/User.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class User{
4 | private int id;
5 | private String name;
6 | }
--------------------------------------------------------------------------------
/Inheritance/User.java:
--------------------------------------------------------------------------------
1 | public class User
2 | {
3 | public String firstName;//fieldA
4 | public String lastName;//fieldB
5 | }
6 |
--------------------------------------------------------------------------------
/Solid_Principles/Interface_Segregation/ISwimmerBird.java:
--------------------------------------------------------------------------------
1 | public interface ISwimmerBird{
2 |
3 | void swim(){
4 |
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/daysOfWeek.java:
--------------------------------------------------------------------------------
1 | public enum daysOfWeek{SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY}
2 |
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/daysOfWeek.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/ExercisesSummer2025/daysOfWeek.class
--------------------------------------------------------------------------------
/OOPClss/PayrollApp/untitled/src/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/PayrollApp/untitled/src/Main.class
--------------------------------------------------------------------------------
/Inheritance/Student.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 | import java.util.ArrayList;
3 |
4 | public class Student extends User
5 | {
6 |
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/Enumeration.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/ExercisesSummer2025/Enumeration.class
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/OneThrough50.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/ExercisesSummer2025/OneThrough50.class
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/Spring_Boot/todolist/src/main/java/todolist/todolist/api/TodoListAPI.java:
--------------------------------------------------------------------------------
1 | package todolist.todolist.api;
2 |
3 | public class TodoListAPI{
4 |
5 | }
--------------------------------------------------------------------------------
/UML/Library/Librarian.java:
--------------------------------------------------------------------------------
1 | public class Librarian extends User{
2 | void addBook(){
3 |
4 | }
5 | void removeBook(){
6 |
7 | }
8 | }
--------------------------------------------------------------------------------
/OOPClss/Enhancedglovoapp/src/manageable.java:
--------------------------------------------------------------------------------
1 | public interface manageable {
2 | public void manageOrder();
3 | public void manageProfile();
4 | }
5 |
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/Book.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/ExercisesSummer2025/ProblemSets/Book.class
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/ExercisesSummer2025/ProblemSets/Main.class
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/src/com/library/book/Book.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/LibraryApp/src/com/library/book/Book.class
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/src/com/library/loan/Loan.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/LibraryApp/src/com/library/loan/Loan.class
--------------------------------------------------------------------------------
/Spring_Boot/todolist/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/Spring_Boot/todolist/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/Methods/Method.java:
--------------------------------------------------------------------------------
1 | public class Method{
2 | public void dumbMethod(String name)
3 | {
4 | System.out.println("Hello "+name);
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/src/com/library/member/Member.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/LibraryApp/src/com/library/member/Member.class
--------------------------------------------------------------------------------
/Inheritance/p2/Student.java:
--------------------------------------------------------------------------------
1 | public class Student extends User
2 | {
3 | public boolean verified = true;//method overriding
4 | public String major;
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/src/Main.java:
--------------------------------------------------------------------------------
1 | public class Main {
2 | public static void main(String[] args) {
3 | System.out.println("Hello, World!");
4 | }
5 | }
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/src/com/library/app/LibraryApp.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/LibraryApp/src/com/library/app/LibraryApp.class
--------------------------------------------------------------------------------
/StudentApp/untitled/src/Main.java:
--------------------------------------------------------------------------------
1 | public class Main {
2 | public static void main(String[] args) {
3 | System.out.println("Hello, World!");
4 | }
5 | }
--------------------------------------------------------------------------------
/Inheritance/p2/User.java:
--------------------------------------------------------------------------------
1 | public class User
2 | {
3 | public String firstName;//fieldA
4 | public String lastName;//fieldB
5 | public boolean verified = false;
6 | }
7 |
--------------------------------------------------------------------------------
/OOPClss/Enhancedglovoapp/src/main.java:
--------------------------------------------------------------------------------
1 | public class main {
2 | public static void main(String[] args) {
3 | System.out.println("Hello, World!");
4 | }
5 | }
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/Admin.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/Admin.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/User.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/User.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/User.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/User.class
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/src/com/library/loanstatus/LoanStatus.java:
--------------------------------------------------------------------------------
1 | package com.library.loanstatus;
2 |
3 | public enum LoanStatus {
4 | BORROWED,RETURNED,OVERDUE;
5 | }
6 |
--------------------------------------------------------------------------------
/OOPClss/GlovoApp/src/com/glovo/model/OrderStatus.java:
--------------------------------------------------------------------------------
1 | package com.glovo.model;
2 |
3 |
4 | public enum OrderStatus{
5 | PENDING,
6 | DISPATCHED,
7 | DELIVERED
8 | }
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/bin/com/glovo/app/GlovoApp.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIII/src/bin/com/glovo/app/GlovoApp.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/app/GlovoApp.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/app/GlovoApp.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/Admin.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/Admin.class
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/src/com/library/librarian/Librarian.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/LibraryApp/src/com/library/librarian/Librarian.class
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/Main.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/Customer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/Customer.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/Customer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/Customer.class
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/src/com/library/loanstatus/LoanStatus.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/LibraryApp/src/com/library/loanstatus/LoanStatus.class
--------------------------------------------------------------------------------
/Interfaces/Speaks.java:
--------------------------------------------------------------------------------
1 | public interface Speaks
2 | {
3 | //An interface method has no body every class that implements must
4 | //overwrite it
5 | void waveAtThem();
6 | }
7 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/Permissions.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/Permissions.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/Permissions.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/Permissions.class
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/BankAccount.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/BankAccount.class
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Person.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Person.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/bin/com/glovo/manageable/Manageable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIII/src/bin/com/glovo/manageable/Manageable.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/DeliveryPerson.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/DeliveryPerson.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/RestaurantOwner.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIII/src/bin/com/glovo/model/RestaurantOwner.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/com/glovo/model/Permissions.java:
--------------------------------------------------------------------------------
1 | package com.glovo.model;
2 |
3 | public enum Permissions {
4 | MANAGE_USERS,
5 | VIEW_REPORTS,
6 | HANDLE_DISPUTES
7 | }
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/DeliveryPerson.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/DeliveryPerson.class
--------------------------------------------------------------------------------
/OOPClss/PayrollApp/untitled/src/com/payroll/employee/Employee.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/PayrollApp/untitled/src/com/payroll/employee/Employee.class
--------------------------------------------------------------------------------
/Spring_RestController_RestApi/todolist/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/Spring_RestController_RestApi/todolist/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/Conditionals/Booleanif.java:
--------------------------------------------------------------------------------
1 | public class Booleanif
2 | {
3 | public static void main(String[] args) {
4 | int income = 120_000;
5 | boolean has_HighIncome=(income >= 100000);
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Student.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Student.class
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Teacher.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Teacher.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/manageable/Manageable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/manageable/Manageable.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/RestaurantOwner.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/GlovoAppPartIIII/src/bin/com/glovo/model/RestaurantOwner.class
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Permissions.java:
--------------------------------------------------------------------------------
1 | package com.glovo.model;
2 |
3 | public enum Permissions {
4 | MANAGE_USERS,
5 | VIEW_REPORTS,
6 | HANDLE_DISPUTES
7 | }
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/users/User.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/users/User.class
--------------------------------------------------------------------------------
/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/com/glovo/manageable/Manageable.java:
--------------------------------------------------------------------------------
1 | package com.glovo.manageable;
2 |
3 | public interface Manageable{
4 | void manageOrder();
5 | public void manageProfile();
6 | }
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/com/glovo/manageable/Manageable.java:
--------------------------------------------------------------------------------
1 | package com.glovo.manageable;
2 |
3 | public interface Manageable{
4 | void manageOrder();
5 | public void manageProfile();
6 | }
--------------------------------------------------------------------------------
/OOPClss/Eventful/src/com/eventful/model/Category.java:
--------------------------------------------------------------------------------
1 | package com.eventful.model.category;
2 |
3 | public enum Category{
4 | MUSIC,
5 | THEATER,
6 | SPORTS,
7 | CONFERENCE,
8 | OTHER
9 | }
--------------------------------------------------------------------------------
/OOPClss/DataStructures/MyContainer.java:
--------------------------------------------------------------------------------
1 | public class MyContainer{
2 | private ArrayListmyarr = new ArrayList<>();
3 |
4 | public add(T item){
5 | myarr.add(item);
6 | }
7 |
8 |
9 | }
--------------------------------------------------------------------------------
/OOPClss/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/Eventful/src/com/eventful/app/Main.java:
--------------------------------------------------------------------------------
1 | package com.eventful.app;
2 | public class Main {
3 | public static void main(String[] args)
4 | {
5 | System.out.println("Hello, World!");
6 | }
7 | }
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/tests/Authentication.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/tests/Authentication.class
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/users/UserCollection.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/users/UserCollection.class
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/paymentMethod/PaymentMethod.java:
--------------------------------------------------------------------------------
1 | package com.ecommerce.model.paymentMethod;
2 |
3 | public enum PaymentMethod{
4 | CASH,
5 | CREDIT_CARD,
6 | PAYPAL
7 | }
--------------------------------------------------------------------------------
/OOPClss/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/com/glovo/model/OrderStatus.java:
--------------------------------------------------------------------------------
1 | package com.glovo.model;
2 |
3 |
4 | public enum OrderStatus{
5 | PENDING,
6 | DISPATCHED,
7 | DELIVERED,
8 | CANCELLED,
9 | ASSIGNED
10 | }
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/com/glovo/model/OrderStatus.java:
--------------------------------------------------------------------------------
1 | package com.glovo.model;
2 |
3 |
4 | public enum OrderStatus{
5 | PENDING,
6 | DISPATCHED,
7 | DELIVERED,
8 | CANCELLED,
9 | ASSIGNED
10 | }
--------------------------------------------------------------------------------
/Casting/Casting2.java:
--------------------------------------------------------------------------------
1 | public class Casting2
2 | {
3 | public static void main(String [] args)
4 | {
5 | double x=1.1;
6 | double y=x+2;
7 | System.out.println(y);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/users/UserNotFoundException.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/2_JavaUserDefinedExceptionSampleApp/build/classes/users/UserNotFoundException.class
--------------------------------------------------------------------------------
/OOPClss/Eventful/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/GlovoApp/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/Library.java:
--------------------------------------------------------------------------------
1 | public class Library{
2 | List myBooks;
3 | List membersOfLib;
4 |
5 | public Library(){
6 | myBooks = new ArrayList<>();
7 | membersOfLib = new ArrayList<>();
8 | }
9 | }
--------------------------------------------------------------------------------
/OOPClss/Member.java:
--------------------------------------------------------------------------------
1 | public class Member{
2 | public String name;
3 | public int member_id;
4 |
5 | public void borrow(Book book){
6 | System.out.println("You borrowed the following: "+book+" today!");
7 | }
8 |
9 | }
--------------------------------------------------------------------------------
/OOPClss/RideSharingApp/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/StudentApp/untitled/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/Enhancedglovoapp/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Solid_Principles/Interface_Segregation/IBird.java:
--------------------------------------------------------------------------------
1 | public interface IBird{
2 | //all birds eat
3 | void eat();
4 |
5 | //all bird can run
6 | //void run();
7 |
8 | //penguins swim but birds do not swim
9 | //void swim();
10 | }
11 |
--------------------------------------------------------------------------------
/OOPClss/PayrollApp/untitled/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Administrator\\AppData\\Roaming\\NetBeans\\8.1\\build.properties
3 |
--------------------------------------------------------------------------------
/OOPClss/StudentApp/StudentApp/src/main/java/aui/students/studentapp/AcademicStatus.java:
--------------------------------------------------------------------------------
1 |
2 | package aui.students.studentapp;
3 |
4 |
5 | public enum AcademicStatus {
6 | FRESHMAN,
7 | SOPHOMORE,
8 | JUNIOR,
9 | SENIOR;
10 | }
11 |
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/Main.java:
--------------------------------------------------------------------------------
1 | public class Main{
2 | public static void main(String [] args){
3 | Book myBook = new Book("Great Expectations", "Charles Dickens", "111-9598-98569-95");
4 | System.out.println(myBook);
5 | }
6 | }
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | javac.debug=true
5 | javadoc.preview=true
6 | user.properties.file=C:\\Users\\SSE\\AppData\\Roaming\\NetBeans\\11.2\\build.properties
7 |
--------------------------------------------------------------------------------
/OOPClss/DataStructures/Arrays.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class Arrays{
4 | ArrayList names= new ArrayList<>();
5 | names.add("Alice");
6 | names.add("Bobby");
7 |
8 |
9 | public static void main(String [] args){
10 |
11 | }
12 | }
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Student.java:
--------------------------------------------------------------------------------
1 | public class Student extends Person{
2 | private int studentId;
3 | public Student(String name, int age,int studentId){
4 | super(name,age);
5 | this.studentId=studentId;
6 | }
7 |
8 | }
--------------------------------------------------------------------------------
/Spring_Boot/todolist/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/MathndNumbers/Constants.java:
--------------------------------------------------------------------------------
1 | package com.domainName;
2 | import java.utils.Arrays
3 |
4 | public class Constants{
5 | public static void main(String [] args)
6 | {
7 | //the final keyword enforces immutability on the variable
8 | final float PI=3.141592653F;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/src/com/ecommerce/app/EcommerceApp.java:
--------------------------------------------------------------------------------
1 | package com.ecommerce.app;
2 |
3 | import com.ecommerce.model.customer.Customer;
4 | import com.ecommerce.model.address.Address;
5 | import java.util.Scanner;
6 |
7 |
8 |
9 | public class EcommerceApp {
10 |
11 | }
--------------------------------------------------------------------------------
/Functions/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | public class MyAwesomeProg
2 | {
3 | public static void main(String [] args)
4 | {
5 | User user = new User();
6 | user.setFirstName("Bob");
7 | user.setLastName("Smith");
8 |
9 | System.out.println(user.getFullName());
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Spring_RestController_RestApi/README.md:
--------------------------------------------------------------------------------
1 | ### Rest Controller in Spring Boot
2 | ```
3 | A controller is basically java class where I can handle URLs and API Endpoints which as a result
4 | passes on the logic to the service or to the model. A controller is the starting point to your url.
5 |
6 | ```
--------------------------------------------------------------------------------
/Spring_RestController_RestApi/todolist/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Enums/Student.java:
--------------------------------------------------------------------------------
1 | public class Student extends User implements Speaks
2 | {
3 | public boolean verified = true;//method overriding
4 | public String major;
5 |
6 | public Student(String fName, String lName)
7 | {
8 | firstName=fName;
9 | lastName=lName;
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/Loops/While2.java:
--------------------------------------------------------------------------------
1 | public class While2
2 | {
3 | public static void main (String[] args)
4 | {
5 | int myIter = 0;
6 | while(myIter < 10)
7 | {
8 | System.out.println("This is my iter bro " + myIter);
9 | myIter++;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build/built-jar.properties:
--------------------------------------------------------------------------------
1 | #Fri, 08 Apr 2016 08:48:38 +0000
2 |
3 |
4 | D\:\\course\ Materials\\Spring16\\CSC2303\\2_Laboratories\\lab9_Collections\ lab\ skeleton\ application\\CollectionsSampleApplicationSkeleton=
5 |
--------------------------------------------------------------------------------
/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build/classes/students/Student.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build/classes/students/Student.class
--------------------------------------------------------------------------------
/OOPClss/Eventful/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OOPClss/GlovoApp/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Switch/Student.java:
--------------------------------------------------------------------------------
1 | public class Student extends User implements Speaks
2 | {
3 | public boolean verified = true;//method overriding
4 | public String major;
5 |
6 | public Student(String fName, String lName)
7 | {
8 | firstName=fName;
9 | lastName=lName;
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/OOPClss/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build/classes/LMS/StudentSystem.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build/classes/LMS/StudentSystem.class
--------------------------------------------------------------------------------
/Operators/Compoper.java:
--------------------------------------------------------------------------------
1 | package com.domainName;
2 |
3 | public class Compoper
4 | {
5 |
6 | public static void main(String[] args) {
7 | int x=1;
8 | int y=2;
9 | //== is the equality operator
10 | //= is the assignment operator
11 | System.out.println(x==y);//prints false
12 | }
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/StudentApp/untitled/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MethOver/Student.java:
--------------------------------------------------------------------------------
1 | public class Student extends User
2 | {
3 | public boolean verified = true;//method overriding
4 | public String major;
5 | @Override
6 | public void sayHello()
7 | {
8 | logln("Hello y\'all my major is "+ major+
9 | ". My name is " + firstName + " " + lastName);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Operators/Logicoper.java:
--------------------------------------------------------------------------------
1 | public class Logicoper
2 | {
3 |
4 | public static void main(String[] args)
5 | {
6 | int temperature=22;
7 | boolean isCool= temperature > 20 && temperature <30;
8 | System.out.println(isCool);//output:true
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Solid_Principles/Open_Close_Responsibility_Principle/PostModel.java:
--------------------------------------------------------------------------------
1 | public class PostModel{
2 |
3 |
4 | public void saveAsTag(String someContent){
5 |
6 | }
7 |
8 |
9 | public void save(String someContent){
10 |
11 | }
12 |
13 | public void saveAsMention(String content){
14 |
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OOPClss/Eventful/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/GlovoApp/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/PayrollApp/untitled/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/StudentApp/untitled/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build/classes/students/StudentCollection.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/build/classes/students/StudentCollection.class
--------------------------------------------------------------------------------
/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/dist/CollectionsSampleApplicationSkeleton.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usrbinomarbash/Java/HEAD/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/dist/CollectionsSampleApplicationSkeleton.jar
--------------------------------------------------------------------------------
/OOPClss/Enhancedglovoapp/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/RideSharingApp/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/RideSharingApp/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Solid_Principles/Liskov_Substitution_Principle/Square.java:
--------------------------------------------------------------------------------
1 | //If I create a square I must inherit from rectangle
2 | //Because A Square is A Rectangle
3 | public class Square extends Rectangle{
4 |
5 | private int height_width;
6 |
7 | public Square(int height_width){
8 | this.height_width=height_width;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Conditionals/Ternaryop.java:
--------------------------------------------------------------------------------
1 | package com.omarbelkady;
2 |
3 | public class Ternaryop
4 | {
5 | public static void main(String[] args) {
6 | Integer income = 120000;
7 | String className= income > 100000 ? "First":"Economy" ;
8 | //className=condition?true:false
9 | System.out.println(className);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OOPClss/Enhancedglovoapp/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OOPClss/PayrollApp/untitled/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/PBVVSPBR/README.md:
--------------------------------------------------------------------------------
1 | ### JAVA
2 |
3 | ```
4 | BY convention JAVA SAYS IT IS PBV. This means that if we pass in an argument, to a method,
5 | we pass the value. The value is then copied to the parameter.
6 | However, when we work with objects, the value passed in, is the location in memory.
7 | So we have to change it in the method.
8 | ```
9 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MustKnow/Design Pat/README.md:
--------------------------------------------------------------------------------
1 | ### Design Patterns
2 |
3 |
4 | #### Adapter Design Pattern
5 | - Convert An Interface of A Class into Another Interface that clients expect
6 | - Enables us to make incompatible classes work with one another
7 | - i.e. delegate logic to the Adapter
8 | - 
--------------------------------------------------------------------------------
/Spring_Boot/todolist/src/test/java/todolist/todolist/TodolistApplicationTests.java:
--------------------------------------------------------------------------------
1 | package todolist.todolist;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class TodolistApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/Enums/README.md:
--------------------------------------------------------------------------------
1 | ## WHAT EXACTLY ARE ENUMERATIONS AKA ENUM
2 | Enumerations allow us to have a list of possible values for a variable. Similar to a Switch.
3 | ```java
4 | public enum currentSubs{"Bronze", "Silver", "Gold", "Platinum"};
5 | ```
6 | As you can see for the variable currentSubs I can have the value set to Bronze OR Silver OR Gold OR Platinum
7 |
8 |
--------------------------------------------------------------------------------
/OOPClss/PayrollApp/untitled/src/Main.java:
--------------------------------------------------------------------------------
1 |
2 |
3 | import com.payroll.employee.Employee;
4 |
5 | public class Main {
6 | public static void main(String[] args)
7 | {
8 | System.out.println("Hello, World!");
9 | Employee e1= new Employee("Mohammed", 525168, 5874.2, "financial", 5515886);
10 | System.out.println(e1);
11 | }
12 | }
--------------------------------------------------------------------------------
/Spring_RestController_RestApi/todolist/src/test/java/todolist/todolist/TodolistApplicationTests.java:
--------------------------------------------------------------------------------
1 | package todolist.todolist;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class TodolistApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/.idea/Java.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/src/users/UserExistsException.java:
--------------------------------------------------------------------------------
1 | package users;
2 |
3 | public class UserExistsException extends Exception{
4 | private String username;
5 | public UserExistsException(String username){
6 | this.username=username;
7 | }
8 |
9 | public String getUsername(){
10 | return username;
11 | }
12 | }
--------------------------------------------------------------------------------
/Methods/Main.java:
--------------------------------------------------------------------------------
1 | import java.util.Scanner;
2 |
3 | public class Main{
4 |
5 | public static void main(String [] args)
6 | {
7 | Scanner inp = new Scanner(System.in);
8 | Method mea= new Method();
9 | System.out.print("Enter your Name heer: ");
10 | String name = inp.nextLine();
11 | mea.dumbMethod(name);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/OOPClss/.idea/OOPClss.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Polymorphism/Teacher.java:
--------------------------------------------------------------------------------
1 | public class Teacher extends User
2 | {
3 | public void fName(String fN,String lN)
4 | {
5 | log("Hello My name is " +fN+ " " +lN+" ");
6 | }
7 |
8 | //Because We inherited User we must inherit sayHello
9 | //I will override it
10 | @Override
11 | public void sayHello()
12 | {
13 | log("I will be your Teacher today.");
14 | }
15 |
16 |
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/Enumeration.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 |
4 |
5 | public class Enumeration{
6 | public static void main(String [] args){
7 | System.out.println("What is your favorite day of the week?");
8 | Scanner sc=new Scanner(System.in);
9 | String dayst = sc.nextLine();
10 | daysOfWeek day = daysOfWeek.valueOf(dayst);
11 |
12 | }
13 | }
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/com/glovo/exception/EmptyOrderException.java:
--------------------------------------------------------------------------------
1 | package com.glovo.exception;
2 |
3 | public class EmptyOrderException extends Exception{
4 | public EmptyOrderException(String message){
5 | super(message);
6 | }
7 |
8 | public String recoverFromException(){
9 | return("Please add at least one order before performing this operation: ");
10 | }
11 | }
--------------------------------------------------------------------------------
/ParentClassMethodsPLUSSuper/Student.java:
--------------------------------------------------------------------------------
1 | public class Student extends User
2 | {
3 | public boolean verified = true;//method overriding
4 | public String major;
5 |
6 | public Student(String fName, String lName)
7 | {
8 | //Now I will call the access the base class constructor
9 | super(fName,lName);
10 | //how to initialize the default fields
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/Inheritance/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 | import java.util.ArrayList;
3 |
4 | public class MyAwesomeProg
5 | {
6 | public static void log(Object o)
7 | {
8 | System.out.print(o);
9 | }
10 |
11 | public static void logln(Object o)
12 | {
13 | System.out.println(o);
14 | }
15 |
16 | public static void main(String [] args)
17 | {
18 |
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ArraysInfo/omarsArrayProblem.java:
--------------------------------------------------------------------------------
1 | public class OmarsArrayProblem
2 | {
3 | public static void main(String [] args){
4 | int [] grades = {9, 9, 4, 13, 34, 21, 3, 41, 94, 1};
5 |
6 | //replacing an array element
7 | grades [1] = 900;
8 |
9 | try{
10 | System.out.println(grades[10]);
11 | }
12 |
13 | catch(Exception e)
14 | {
15 | System.out.println(e);
16 | }
17 |
18 | }
19 |
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Classes/Inheritance/Animal.java:
--------------------------------------------------------------------------------
1 | public class Animal
2 | {
3 | private final String name;
4 | private final int age;
5 |
6 | public Animal(String n, int a)
7 | {
8 | name = n;
9 | age = a;
10 | }
11 |
12 | public String getName() {return name;}
13 | public int getAge() {return age;}
14 |
15 | public void speak() {System.out.println("called from animal class");}
16 | }
--------------------------------------------------------------------------------
/UML/Library/Loan.java:
--------------------------------------------------------------------------------
1 | public class Loan {
2 | private String dueDate;
3 | private String dateReturned;
4 | private Book book;
5 | private Member member;
6 |
7 | public Loan(Book book, Member member, String dueDate){
8 | this.dueDate=dueDate;
9 | this.book=book;
10 | this.member=member;
11 | this.dateReturned=null;
12 | this.book.setAvailability(false);
13 | }
14 | }
--------------------------------------------------------------------------------
/Constructors/Defconst/User.java:
--------------------------------------------------------------------------------
1 | public abstract class User
2 | {
3 | public String firstName;//fieldA
4 | public String lastName;//fieldB
5 | public boolean verified = false;
6 |
7 | public static void log(Object o)
8 | {
9 | System.out.print(o);
10 | }
11 |
12 | public static void logln(Object o)
13 | {
14 | System.out.println(o);
15 | }
16 |
17 | public abstract void sayHello();
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/Solid_Principles/Liskov_Substitution_Principle/Rectangle.java:
--------------------------------------------------------------------------------
1 | public class Rectangle{
2 |
3 | private int width;
4 | private int height;
5 |
6 | public int getWidth(){
7 | return width;
8 | }
9 |
10 | public void setWidth(int width){
11 | this.width=width;
12 | }
13 |
14 | public int getHeight(){
15 | return height;
16 | }
17 |
18 | public void setHeight(int height){
19 | this.height=height;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ArbitraryObjects/Student.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 |
4 | class Student
5 | {
6 | private Map attr;
7 |
8 | public Student(){ attr = new HashMap<>();}
9 |
10 | public void setAttribute(String key, Object value){attr.put(key, value);}
11 | public Object getAttribute(String key){return attr.get(key);}
12 |
13 | @Override
14 | public String toString(){return super.toString();}
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/Spring_Boot/todolist/src/main/java/todolist/todolist/TodolistApplication.java:
--------------------------------------------------------------------------------
1 | package todolist.todolist;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class TodolistApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(TodolistApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/Conditionals/While.java:
--------------------------------------------------------------------------------
1 | package com.omarbelkady;
2 | import java.util.Scanner;
3 |
4 |
5 | public class While
6 | {
7 | public static void main(String[] args) {
8 | Scanner scanner= new Scanner(System.in);
9 | String input= "";
10 | while(!input.equals("quit"))
11 | {
12 | System.out.print("What do you want to do today?: ");
13 | input=scanner.next().toLowerCase();
14 | }
15 |
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/Spring_RestController_RestApi/todolist/src/main/java/todolist/todolist/TodolistApplication.java:
--------------------------------------------------------------------------------
1 | package todolist.todolist;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class TodolistApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(TodolistApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/Strings.java:
--------------------------------------------------------------------------------
1 |
2 | public class Strings
3 | {
4 | public static void main(String [] args)
5 | {
6 | //Since the variable is a reference type we must use the new operator
7 | //When we use a reference to a variable we must instantiate the variable with the new operator
8 | String message= "Hello Guys";
9 | System.out.println(message.endsWith("!!"));//prints true
10 | System.out.println(message.startsWith("a"));//prints false
11 |
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Solid_Principles/Interface_Segregation/Penguin.java:
--------------------------------------------------------------------------------
1 | public class Penguin implements IBird, ISwimmerBird{
2 |
3 | @Override
4 | public void eat()
5 | {
6 | System.out.println("The Penguin is eating");
7 | }
8 |
9 | //The penguin does not run
10 | //@Override
11 | //public void run()
12 | // {
13 |
14 | // }
15 |
16 | //I am now segregating
17 | @Override
18 | public void swim(){
19 | System.out.println("The Penguin is swimming");
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/Constructors/Defconst/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 | import java.util.ArrayList;
3 |
4 | public class MyAwesomeProg
5 | {
6 | public static void log(Object o)
7 | {
8 | System.out.print(o);
9 | }
10 |
11 | public static void logln(Object o)
12 | {
13 | System.out.println(o);
14 | }
15 |
16 | public static void main(String [] args)
17 | {
18 | Student m = new Student();//CALLING THE DEFAULT CONSTRUCTOR
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Constructors/Main.java:
--------------------------------------------------------------------------------
1 | /*An object is essentially an instance of a class*/
2 | import java.util.ArrayList;
3 |
4 |
5 | public class Main
6 | {
7 | public static void main(String [] args)
8 | {
9 | Cat rich= new Cat("Richard", 19, 150);
10 | Cat diana = new Cat("Diana", 7);
11 | Cat isabella = new Cat("Isabella");
12 | rich.speak();
13 | diana.speak();
14 | isabella.speak();
15 |
16 | }
17 |
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/Conditionals/ConditionalsWthCompOp.java:
--------------------------------------------------------------------------------
1 | public class ConditionalsWthCompOp
2 | {
3 | //main method
4 | public static void main (String[] args)
5 | {
6 | int x= 7;
7 | int y=9;
8 | int z=12;
9 | boolean compare;
10 | //Compare: ==, >=,<=, <, >, !=
11 | //Assign: =
12 | compare= x permissions;
6 |
7 | @Override
8 | public void manageOrder() {
9 |
10 | }
11 |
12 | @Override
13 | public void manageProfile() {
14 |
15 | }
16 |
17 | public void handleDispute(){
18 |
19 | }
20 |
21 | public void monitorOrder(){
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/OOPClss/Eventful/Eventful.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/OOPClss/GlovoApp/GlovoApp.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Encapsulation/Encapsulate.java:
--------------------------------------------------------------------------------
1 | public class Encapsulate
2 | {
3 | public static void main(String[] args)
4 | {
5 | EncapsulateThis encapsObj = new EncapsulateThis();
6 |
7 | encapsObj.setTheName("Marsha Smith");
8 | encapsObj.setSSN(422212212);
9 | encapsObj.setBankAccountNum(23123193);
10 | System.out.println("Hello There the name is: "+encapsObj.getTheName()+" and her SSN is: "+encapsObj.getSSN()+" and her bank account number is: "+encapsObj.getBanAccNum());
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Inheritance/p2/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 | import java.util.ArrayList;
3 |
4 | public class MyAwesomeProg
5 | {
6 | public static void log(Object o)
7 | {
8 | System.out.print(o);
9 | }
10 |
11 | public static void logln(Object o)
12 | {
13 | System.out.println(o);
14 | }
15 |
16 | public static void main(String [] args)
17 | {
18 | Student m = new Student();
19 | m.major = "Computer Science";
20 | logln(m.major);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/MethOver/User.java:
--------------------------------------------------------------------------------
1 | public class User
2 | {
3 | public String firstName;//fieldA
4 | public String lastName;//fieldB
5 | public boolean verified = false;
6 |
7 | public static void log(Object o)
8 | {
9 | System.out.print(o);
10 | }
11 |
12 | public static void logln(Object o)
13 | {
14 | System.out.println(o);
15 | }
16 |
17 |
18 |
19 | public void sayHello()
20 | {
21 | logln("Buenos Dias My name is " + firstName + " " + lastName );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/Library.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/StudentApp/untitled/untitled.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/CompareTo/README.md:
--------------------------------------------------------------------------------
1 | # Comparing Objects
2 |
3 | #### class needs to implement java.lang.Comparable
4 |
5 | ```java
6 | public class Student implements Comparable
7 | {
8 | ...
9 | }
10 | ```
11 |
12 | useful for
13 | - sorting
14 | - TreeSet
15 | - TreeMap
16 |
17 | Need to implement
18 |
19 | ```java
20 | @Override
21 | public int compareTo(Student arg0)
22 | {
23 | if (arg0 == this)
24 | return 0;
25 |
26 | // logic goes here
27 | ...
28 | }
29 | ```
--------------------------------------------------------------------------------
/Maps/HashMapTest.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 | public class HashMapTest
3 | {
4 | /**
5 | * HashMap are not ordered
6 | *
7 | * */
8 | public static void main (String[] args)
9 | {
10 | Map m = new HashMap<>();
11 | m.put("Timothy",5);
12 | m.put("Joey",10);
13 | m.put("Dennis",66);
14 | m.put("Varshika",-54);
15 | m.put("Sanjna",-524);
16 | System.out.println(m);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/EcommerceApp.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/OOPClss/Eventful/.gitignore:
--------------------------------------------------------------------------------
1 | ### IntelliJ IDEA ###
2 | out/
3 | !**/src/main/**/out/
4 | !**/src/test/**/out/
5 |
6 | ### Eclipse ###
7 | .apt_generated
8 | .classpath
9 | .factorypath
10 | .project
11 | .settings
12 | .springBeans
13 | .sts4-cache
14 | bin/
15 | !**/src/main/**/bin/
16 | !**/src/test/**/bin/
17 |
18 | ### NetBeans ###
19 | /nbproject/private/
20 | /nbbuild/
21 | /dist/
22 | /nbdist/
23 | /.nb-gradle/
24 |
25 | ### VS Code ###
26 | .vscode/
27 |
28 | ### Mac OS ###
29 | .DS_Store
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/GlovoApp.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/GlovoApp.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/.gitignore:
--------------------------------------------------------------------------------
1 | ### IntelliJ IDEA ###
2 | out/
3 | !**/src/main/**/out/
4 | !**/src/test/**/out/
5 |
6 | ### Eclipse ###
7 | .apt_generated
8 | .classpath
9 | .factorypath
10 | .project
11 | .settings
12 | .springBeans
13 | .sts4-cache
14 | bin/
15 | !**/src/main/**/bin/
16 | !**/src/test/**/bin/
17 |
18 | ### NetBeans ###
19 | /nbproject/private/
20 | /nbbuild/
21 | /dist/
22 | /nbdist/
23 | /.nb-gradle/
24 |
25 | ### VS Code ###
26 | .vscode/
27 |
28 | ### Mac OS ###
29 | .DS_Store
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/.gitignore:
--------------------------------------------------------------------------------
1 | ### IntelliJ IDEA ###
2 | out/
3 | !**/src/main/**/out/
4 | !**/src/test/**/out/
5 |
6 | ### Eclipse ###
7 | .apt_generated
8 | .classpath
9 | .factorypath
10 | .project
11 | .settings
12 | .springBeans
13 | .sts4-cache
14 | bin/
15 | !**/src/main/**/bin/
16 | !**/src/test/**/bin/
17 |
18 | ### NetBeans ###
19 | /nbproject/private/
20 | /nbbuild/
21 | /dist/
22 | /nbdist/
23 | /.nb-gradle/
24 |
25 | ### VS Code ###
26 | .vscode/
27 |
28 | ### Mac OS ###
29 | .DS_Store
--------------------------------------------------------------------------------
/OOPClss/PayrollApp/untitled/untitled.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/OOPClss/RideSharingApp/.gitignore:
--------------------------------------------------------------------------------
1 | ### IntelliJ IDEA ###
2 | out/
3 | !**/src/main/**/out/
4 | !**/src/test/**/out/
5 |
6 | ### Eclipse ###
7 | .apt_generated
8 | .classpath
9 | .factorypath
10 | .project
11 | .settings
12 | .springBeans
13 | .sts4-cache
14 | bin/
15 | !**/src/main/**/bin/
16 | !**/src/test/**/bin/
17 |
18 | ### NetBeans ###
19 | /nbproject/private/
20 | /nbbuild/
21 | /dist/
22 | /nbdist/
23 | /.nb-gradle/
24 |
25 | ### VS Code ###
26 | .vscode/
27 |
28 | ### Mac OS ###
29 | .DS_Store
--------------------------------------------------------------------------------
/OOPClss/RideSharingApp/RideSharingApp.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/StudentApp/untitled/.gitignore:
--------------------------------------------------------------------------------
1 | ### IntelliJ IDEA ###
2 | out/
3 | !**/src/main/**/out/
4 | !**/src/test/**/out/
5 |
6 | ### Eclipse ###
7 | .apt_generated
8 | .classpath
9 | .factorypath
10 | .project
11 | .settings
12 | .springBeans
13 | .sts4-cache
14 | bin/
15 | !**/src/main/**/bin/
16 | !**/src/test/**/bin/
17 |
18 | ### NetBeans ###
19 | /nbproject/private/
20 | /nbbuild/
21 | /dist/
22 | /nbdist/
23 | /.nb-gradle/
24 |
25 | ### VS Code ###
26 | .vscode/
27 |
28 | ### Mac OS ###
29 | .DS_Store
--------------------------------------------------------------------------------
/OOPClss/Enhancedglovoapp/.gitignore:
--------------------------------------------------------------------------------
1 | ### IntelliJ IDEA ###
2 | out/
3 | !**/src/main/**/out/
4 | !**/src/test/**/out/
5 |
6 | ### Eclipse ###
7 | .apt_generated
8 | .classpath
9 | .factorypath
10 | .project
11 | .settings
12 | .springBeans
13 | .sts4-cache
14 | bin/
15 | !**/src/main/**/bin/
16 | !**/src/test/**/bin/
17 |
18 | ### NetBeans ###
19 | /nbproject/private/
20 | /nbbuild/
21 | /dist/
22 | /nbdist/
23 | /.nb-gradle/
24 |
25 | ### VS Code ###
26 | .vscode/
27 |
28 | ### Mac OS ###
29 | .DS_Store
--------------------------------------------------------------------------------
/OOPClss/Enhancedglovoapp/Enhancedglovoapp.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/OOPClss/PayrollApp/untitled/.gitignore:
--------------------------------------------------------------------------------
1 | ### IntelliJ IDEA ###
2 | out/
3 | !**/src/main/**/out/
4 | !**/src/test/**/out/
5 |
6 | ### Eclipse ###
7 | .apt_generated
8 | .classpath
9 | .factorypath
10 | .project
11 | .settings
12 | .springBeans
13 | .sts4-cache
14 | bin/
15 | !**/src/main/**/bin/
16 | !**/src/test/**/bin/
17 |
18 | ### NetBeans ###
19 | /nbproject/private/
20 | /nbbuild/
21 | /dist/
22 | /nbdist/
23 | /.nb-gradle/
24 |
25 | ### VS Code ###
26 | .vscode/
27 |
28 | ### Mac OS ###
29 | .DS_Store
--------------------------------------------------------------------------------
/Conditionals/Righttriangle.java:
--------------------------------------------------------------------------------
1 | public class Righttriangle
2 | {
3 | public static void main (String[] args) {
4 |
5 | for(int i=10; i>=0;i--)
6 | {
7 | for(int o=i;o>=0;o--)
8 | {
9 | if(o==5)
10 | {
11 | continue;
12 | }
13 |
14 | System.out.print(o + "");
15 | }
16 | System.out.println();
17 | }
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/.gitignore:
--------------------------------------------------------------------------------
1 | ### IntelliJ IDEA ###
2 | out/
3 | !**/src/main/**/out/
4 | !**/src/test/**/out/
5 |
6 | ### Eclipse ###
7 | .apt_generated
8 | .classpath
9 | .factorypath
10 | .project
11 | .settings
12 | .springBeans
13 | .sts4-cache
14 | bin/
15 | !**/src/main/**/bin/
16 | !**/src/test/**/bin/
17 |
18 | ### NetBeans ###
19 | /nbproject/private/
20 | /nbbuild/
21 | /dist/
22 | /nbdist/
23 | /.nb-gradle/
24 |
25 | ### VS Code ###
26 | .vscode/
27 |
28 | ### Mac OS ###
29 | .DS_Store
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/EcommerceOrderSystem.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/BankAccount/Main.java:
--------------------------------------------------------------------------------
1 | public class Main{
2 | public static void main(String [] args){
3 | BankAccount bankacc1 = new BankAccount("Youssef Tahiri", 56555.32, "123 Main St., Austin, TX, 78701", 'M',24,8547562);
4 | System.out.println(bankacc1);
5 | bankacc1.deposit(25520);
6 | System.out.println(bankacc1.getBalance());
7 | bankacc1.withdraw(1552);
8 | System.out.println(bankacc1);
9 | }
10 | }
--------------------------------------------------------------------------------
/UML/Library/Book.java:
--------------------------------------------------------------------------------
1 | public class Book{
2 | private String ISBN;
3 | private String title;
4 | private boolean isAvailable;
5 |
6 | public Book(String ISBN, String title, boolean isAvailable){
7 | this.ISBN=ISBN;
8 | this.title=title;
9 | this.isAvailable=true;
10 | }
11 |
12 | public boolean isAvailable(){
13 | return isAvailable;
14 | }
15 |
16 | public void setAvailable(boolean available){
17 | isAvailable=available
18 | }
19 | }
--------------------------------------------------------------------------------
/MathndNumbers/Math.java:
--------------------------------------------------------------------------------
1 | package com.omarbelkady;
2 |
3 | public class Math{
4 | public static void main(String [] args)
5 | {
6 | //the round method in the math class is overloaded depending on the input
7 | //if I input a float it returns a double
8 | //if I input a double it returns a long
9 | int result = Math.round(1.1F);
10 | int result2= (int)Math.ceil(1.1F);
11 | //result2 operation performs a ceiling to the value meaning round it up
12 | System.out.println(result);
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/Solid_Principles/Single_Responsibility_Principle/Main.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class Main{
4 | public static void logLn(Object o)
5 | {
6 | System.out.println(o);
7 | }
8 |
9 |
10 | public static void log(Object o)
11 | {
12 | System.out.print(o);
13 | }
14 |
15 |
16 | public static void main(String [] args){
17 | //Instantiating the calculator class
18 | Calculator calculate= new Calculator(256837,746767);
19 | calculate.sum();
20 | logLn(calculate.sum());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Solid_Principles/Open_Close_Responsibility_Principle/Main.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class Main{
4 | public static void logLn(Object o)
5 | {
6 | System.out.println(o);
7 | }
8 |
9 |
10 | public static void log(Object o)
11 | {
12 | System.out.print(o);
13 | }
14 |
15 |
16 | public static void main(String [] args){
17 | //Instantiating the calculator class
18 | Calculator calculate= new Calculator(256837,746767);
19 | calculate.sum();
20 | logLn(calculate.sum());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Abstraction/Student.java:
--------------------------------------------------------------------------------
1 | public class Student extends User
2 | {
3 | public boolean verified = true;//method overriding
4 | public String major;
5 |
6 |
7 |
8 |
9 | /*my Student class which is the derived class I must create a
10 | method called sayHello which will override the method because it is necessary or
11 | else this will raise an error.*/
12 | @Override
13 | public void sayHello()
14 | {
15 | logln("Hello y\'all my major is "+ major+ ". My name is " + firstName + " " + lastName);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/OOPClss/genericsexample/StudentApp (1)/StudentApp/src/main/java/aui/students/studentapp/AcademicStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package aui.students.studentapp;
6 |
7 | /**
8 | *
9 | * @author Oumaima Hourrane
10 | */
11 | public enum AcademicStatus {
12 | FRESHMAN,
13 | SOPHOMORE,
14 | JUNIOR,
15 | SENIOR;
16 | }
17 |
--------------------------------------------------------------------------------
/Conditionals/If.java:
--------------------------------------------------------------------------------
1 | package com.omarbelkady;
2 |
3 | public class If
4 | {
5 | public static void main(String[] args) {
6 | Integer temperature=32;
7 | if(temperature >30)
8 | {
9 | System.out.print("It is a hot day");
10 | System.out.print(". Drink plenty of water.");
11 | }
12 | else if(temperature>20 && temperature<=30)
13 |
14 | System.out.println("It is a cool day");
15 |
16 | else
17 | System.out.println("It is cold");
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MethOver/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 | import java.util.ArrayList;
3 |
4 | public class MyAwesomeProg
5 | {
6 | public static void log(Object o)
7 | {
8 | System.out.print(o);
9 | }
10 |
11 | public static void logln(Object o)
12 | {
13 | System.out.println(o);
14 | }
15 |
16 | public static void main(String [] args)
17 | {
18 | Student m = new Student();
19 | m.major= "Biology";
20 | m.firstName = "Nathan";
21 | m.lastName = "Higgins";
22 | m.sayHello();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/Book.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class Book {
4 | private String title;
5 | private String author;
6 | private String ISBN;
7 |
8 | public Book(String title, String author, String ISBN) {
9 | this.title = title;
10 | this.author = author;
11 | this.ISBN = ISBN;
12 | }
13 |
14 | @Override
15 | public String toString(){
16 | return String.format("Book: {title='%s', author='%s', ISBN='%s'}",title, author,ISBN);
17 | }
18 | }
--------------------------------------------------------------------------------
/Polymorphism/Student.java:
--------------------------------------------------------------------------------
1 | public class Student extends User
2 | {
3 | public boolean verified = true;//method overriding
4 | public String major;
5 |
6 |
7 |
8 |
9 | /*my Student class which is the derived class I must create a
10 | method called sayHello which will override the method because it is necessary or
11 | else this will raise an error.*/
12 | @Override
13 | public void sayHello()
14 | {
15 | logln("Hello y\'all my major is "+ major+
16 | ". My name is " + firstName + " " + lastName);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Solid_Principles/Interface_Segregation/Parrot.java:
--------------------------------------------------------------------------------
1 | public class Parrot implements IBird{
2 | @Override
3 | public void eat(){
4 | System.out.println("The parrot is eating dude");
5 | }
6 |
7 | //As you can see the Run method isn't doing anything
8 | //which means I must comment it out
9 | //@Override
10 | //public void run(){
11 | //}
12 |
13 | //As you can the swim method is incorporated but a parrot does not swim
14 | //968 746867 56837
15 | //@Override
16 | //public void swim(){
17 |
18 | //}
19 |
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Conditionals/DoWhile2.java:
--------------------------------------------------------------------------------
1 | package com.omarbelkady;
2 | import java.util.Scanner;
3 |
4 |
5 | public class DoWhile2
6 | {
7 | public static void main(String[] args)
8 | {
9 | Scanner scanner= new Scanner(System.in);
10 | String input= "";
11 |
12 | do
13 | {
14 | System.out.print("What do you want to do today?: ");
15 | input=scanner.next().toLowerCase();
16 | System.out.println(input)
17 | }
18 |
19 | while(!input.equals("quit"));
20 |
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/Maps/Sorting.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class Sorting
4 | {
5 | public static void main (String[] args)
6 | {
7 | Integer [] m = {5,6,-64, -119,313,12,65,3,2};
8 | //Arrays.sort(varNam,starting position, ending position(not including this),)
9 | //Arrays.sort(m,1,6);
10 |
11 | //To sort the entire array
12 | Arrays.sort(m,0,9);
13 | for(int i:m)
14 | {
15 | System.out.print(i+" , ");
16 | }
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=a03a820a
2 | build.xml.script.CRC32=02ee4d09
3 | build.xml.stylesheet.CRC32=f85dc8f2@1.93.0.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=a03a820a
7 | nbproject/build-impl.xml.script.CRC32=92d6f372
8 | nbproject/build-impl.xml.stylesheet.CRC32=f89f7d21@1.93.0.48
9 |
--------------------------------------------------------------------------------
/Solid_Principles/Interface_Segregation/Ostrich.java:
--------------------------------------------------------------------------------
1 | //I will implement many interfaces here
2 | public class Ostrich implements IBird, IRunnerBird{
3 |
4 | @Override
5 | public void eat(){
6 | System.out.println("This Ostrich is eating!");
7 | }
8 |
9 | @Override
10 | public void run(){
11 | System.out.println("The ostrich is running dude");
12 | }
13 |
14 | //I implement this method but I notice an ostrich does
15 | //not swim 968 27736259 56837 neither so I can delete
16 | //@Override
17 | //public void swim(){
18 |
19 | //}
20 | }
21 |
--------------------------------------------------------------------------------
/Constructors/CustConst/User.java:
--------------------------------------------------------------------------------
1 | public abstract class User
2 | {
3 | public String firstName;//fieldA
4 | public String lastName;//fieldB
5 | public boolean verified = false;
6 |
7 | public static void log(Object o)
8 | {
9 | System.out.print(o);
10 | }
11 |
12 | public static void logln(Object o)
13 | {
14 | System.out.println(o);
15 | }
16 |
17 |
18 | /*
19 | the sayHello Method has a keyword abstract in its function definition.
20 | This means that we cannot have a body.
21 | */
22 | public abstract void sayHello();
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/DataTypeCateg/ObjectType.java:
--------------------------------------------------------------------------------
1 |
2 | import java.util.*;
3 | public class ObjectType
4 | {
5 | public static void logLn(Object o){System.out.println(o);}
6 |
7 | public static void main(String[] args)
8 | {
9 | /**
10 | * OBJECT TYPES EXTEND java.lang.Object IMPLICITLY
11 | * ARRAYS ARE ALSO OBJECTS
12 | */
13 | List li = new ArrayList<>();
14 | li.add("spongebob");
15 | li.add("patrick");
16 | logLn(li);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Polymorphism/User.java:
--------------------------------------------------------------------------------
1 | public abstract class User
2 | {
3 | public String firstName;//fieldA
4 | public String lastName;//fieldB
5 | public boolean verified = false;
6 |
7 | public static void log(Object o)
8 | {
9 | System.out.print(o);
10 | }
11 |
12 | public static void logln(Object o)
13 | {
14 | System.out.println(o);
15 | }
16 |
17 |
18 | /*
19 | the sayHello Method has a keyword abstract in its function definition.
20 | This means that we cannot have a body.
21 | */
22 | public abstract void sayHello();
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/Abstraction/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 | import java.util.ArrayList;
3 |
4 | public class MyAwesomeProg
5 | {
6 | public static void log(Object o)
7 | {
8 | System.out.print(o);
9 | }
10 |
11 | public static void logln(Object o)
12 | {
13 | System.out.println(o);
14 | }
15 |
16 | public static void main(String [] args)
17 | {
18 | Student m = new Student();
19 | m.major= "Biology";
20 | m.firstName = "Nathan";
21 | m.lastName = "Higgins";
22 | m.sayHello();
23 |
24 |
25 | }
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/Constructors/CustConst/Student.java:
--------------------------------------------------------------------------------
1 | public class Student extends User
2 | {
3 | public boolean verified = true;//method overriding
4 | public String major;
5 | public Student(){
6 | logln("HOWDY, HOWDY, I AM CREATING A STUDENT FOR YOU");
7 | }
8 |
9 | public Student(String alpha, String beta)
10 | {
11 | //how to initialize the default fields
12 | firstName= alpha;
13 | lastName=beta;
14 | }
15 |
16 | @Override
17 | public void sayHello()
18 | {
19 | logln("Hello y\'all my major is "+ major+". My name is " + firstName + " " + lastName);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Enums/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 | import java.util.ArrayList;
3 |
4 | public class MyAwesomeProg
5 | {
6 | public static void log(Object o)
7 | {
8 | System.out.print(o);
9 | }
10 |
11 | public static void logln(Object o)
12 | {
13 | System.out.println(o);
14 | }
15 |
16 | public static void main(String [] args)
17 | {
18 | Student d = new Student("Daniela", "Ennen");
19 | d.currentSubs=d.currentSubs.Silver;
20 |
21 | //To output I do this
22 | logln(d.currentSubs);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/OOPClss/RideSharingApp/src/com/ridesharingapp/entities/tripstatus/TripStatus.java:
--------------------------------------------------------------------------------
1 | package com.ridesharingapp.entities.tripstatus;
2 |
3 | public enum TripStatus {
4 | REQUESTED("Trip requested by driver"),
5 | ASSIGNED("Trip assigned to driver"),
6 | IN_PROGRESS("Trip in progress"),
7 | COMPLETED("Trip completed");
8 |
9 | public final String description;
10 |
11 | TripStatus(String description){
12 | this.description=description;
13 | }
14 |
15 | public String getDescription(){
16 | return description;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Spring_Boot/todolist/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/StudentApp/untitled/src/aui/students/Students.java:
--------------------------------------------------------------------------------
1 | package aui.students;
2 | import java.util.Date;
3 |
4 | public class Students {
5 | private String name;
6 | private int age;
7 | private int id;
8 | private String dateOfBirth;
9 | private String address;
10 |
11 | public Students(String name, int age, int id, String dateOfBirth, String address){
12 | this.name=name;
13 | this.age=age;
14 | this.id=id;
15 | this.dateOfBirth=dateOfBirth;
16 | this.address=address;
17 | }
18 |
19 |
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Abstraction/User.java:
--------------------------------------------------------------------------------
1 | public abstract class User
2 | {
3 | public String firstName;//fieldA
4 | public String lastName;//fieldB
5 | public boolean verified = false;
6 |
7 | public static void log(Object o)
8 | {
9 | System.out.print(o);
10 | }
11 |
12 | public static void logln(Object o)
13 | {
14 | System.out.println(o);
15 | }
16 |
17 |
18 | /*
19 | the sayHello Method has a keyword abstract in its function definition.
20 | This means that we cannot have a body.
21 | */
22 | public abstract void sayHello();
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/src/com/orderitem/OrderItem.java:
--------------------------------------------------------------------------------
1 | package com.orderitem;
2 |
3 | public class OrderItem {
4 | private String productName;
5 | private double price;
6 |
7 | public OrderItem(String productName, double price){
8 | this.productName=productName;
9 | this.price=price;
10 | }
11 |
12 | @Override
13 | public String toString() {
14 | return "OrderItem{" +
15 | "productName='" + productName + '\'' +
16 | ", price=" + price +
17 | '}';
18 | }
19 |
20 | }
21 |
22 |
23 |
--------------------------------------------------------------------------------
/ArraysInfo/Multidimarray.java:
--------------------------------------------------------------------------------
1 |
2 | public class Multidimarray
3 | {
4 | static void log(Object o) {System.out.print(o);}
5 | static void logLn(Object o) {System.out.println(o);}
6 | public static void main(String [] args)
7 | {
8 |
9 | //Multidimensional Array Declaration 2 rows by 3 columns
10 | int [][] funNumsPart2= {{1,2,3},{4,5,6}};
11 | print(funNumsPart2);
12 |
13 | }
14 | public static void print(int [][] arr)
15 | {
16 | for (int[] row: arr)
17 | {
18 | for (int col: row)
19 | {
20 | log(col+" ");
21 | }
22 | logLn(" ");
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Casting/Explicitcasting.java:
--------------------------------------------------------------------------------
1 | public class Explicitcasting
2 | {
3 | public static void main(String [] args)
4 | {
5 | String x= "1";
6 | Integer.parseInt(x)+2;//integer wrapper class for int primitive type
7 | String d= "4.1";
8 | //CASTING SYNTAX: Float/double/String/Short/char.parseFloat/parseDouble/parseString/parseShort/parseChar
9 | //datatypeyouwanttoconvertto.parsedatatypeyouwanttoconvertto(nameofvariable)
10 | double n = Double.parseDouble(d)+2;
11 | System.out.println(n);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Spring_RestController_RestApi/todolist/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/Constructors/Defconst/Student.java:
--------------------------------------------------------------------------------
1 | public class Student extends User
2 | {
3 | public boolean verified = true;
4 | public String major;
5 |
6 | /*This will be called as soon as I create an Instance of the class*/
7 | /*REMEMBER THE CONSTRUCTOR MUUUUST HAVE SAME NAME AS CLASS AND CANNOT HAVE A RETURN TYPE*/
8 |
9 | public Student(){
10 | logln("HOWDY, HOWDY, I AM CREATING A STUDENT FOR YOU");
11 | }
12 |
13 |
14 |
15 |
16 | @Override
17 | public void sayHello()
18 | {
19 | logln("Hello y\'all my major is " + major + ". My name is " + firstName + " " + lastName);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=b5adcbc2
2 | build.xml.script.CRC32=98bf525b
3 | build.xml.stylesheet.CRC32=8064a381@1.79.1.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=b5adcbc2
7 | nbproject/build-impl.xml.script.CRC32=8756d95a
8 | nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48
9 |
--------------------------------------------------------------------------------
/Constructors/CustConst/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 | import java.util.ArrayList;
3 |
4 | public class MyAwesomeProg
5 | {
6 | public static void log(Object o)
7 | {
8 | System.out.print(o);
9 | }
10 |
11 | public static void logln(Object o)
12 | {
13 | System.out.println(o);
14 | }
15 |
16 | public static void main(String [] args)
17 | {
18 | //This is not possible I have to create a constructor that takes two arguments
19 | //Not 1
20 | //Student d = new Student("Driss", "PUT THE LNAME HEERE")
21 | Student f = new Student("Kenza", "Saleh");
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/src/com/cartItem/CartItem.java:
--------------------------------------------------------------------------------
1 | package com.cartItem;
2 |
3 |
4 | import com.product.Product;
5 |
6 | public class CartItem {
7 | private Product product;
8 | private int quantity;
9 |
10 |
11 | public CartItem(Product product, int quantity){
12 | this.product=product;
13 | this.quantity=quantity;
14 | }
15 |
16 | @Override
17 | public String toString() {
18 | return "CartItem{" +
19 | "product=" + product +
20 | ", quantity=" + quantity +
21 | '}';
22 | }
23 |
24 |
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Solid_Principles/Open_Close_Responsibility_Principle/Tag.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 | public class Tag extends Post{
3 |
4 | //We want to make an extension of the Post Class
5 |
6 | //Creating another instance of the post Model
7 | private PostModel postModel;
8 |
9 | //Creating the constructor
10 | public Tag(){
11 | postModel = new PostModel();
12 | }
13 |
14 | //Public Method that will override the post
15 | @Override
16 | public void createAPost(String someContent){
17 | super.createAPost(someContent);
18 |
19 | //call the post Model
20 | postModel.saveAsTag(someContent);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/UML/Library/Member.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 |
4 | public Member extends User{
5 | private List loans = new ArrayList<>();
6 |
7 | public void borrowBook(Book book, String dueDate){
8 | Loan loan = new Loan(book, this, dueDate);
9 | loans.add(loan);
10 | }
11 |
12 | public void returnBook(Book book){
13 | for(Loan loan: loans){
14 | if(loan.getBook()==book && loan.getDateReturned() == null)
15 | loan.setDateReturned("2025-04-25");
16 | book.setAvailable(true);
17 | break;
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Classes/Inheritance/Dog.java:
--------------------------------------------------------------------------------
1 | public class Dog extends Animal
2 | {
3 |
4 | //Let's create a constructor
5 | public Dog(String name, int age){
6 | //set the age and attributes to whatever we pass in
7 | super(name, age);
8 |
9 | //The this keyword is referencing the attributes of the class
10 |
11 | speak();
12 | }
13 |
14 | @Override
15 | public void speak()
16 | {
17 | System.out.println("called from Dog");
18 | System.out.println("I am "+getName()+" and I am "+ getAge()+ " years old");
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Solid_Principles/Open_Close_Responsibility_Principle/Post.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 | public class Post{
3 |
4 | //Instantiating a Private PostModel Object
5 | private PostModel postModel;
6 |
7 | //Post Class Constructor
8 | public Post(){
9 | postModel = new PostModel();
10 | }
11 |
12 | //Public Method that takes a string
13 | public void createAPost(String someContent){
14 | //If Post starts with HashTag save it as Post
15 | //Else save it normally
16 | // if(someContent.startsWith("#")){
17 | // postModel.saveAsTag(someContent);
18 | // }
19 | postModel.save(someContent);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Spring_RestController_RestApi/todolist/src/main/java/todolist/todolist/TodoList.java:
--------------------------------------------------------------------------------
1 | package todolist.todolist;
2 | import org.springframework.boot.SpringApplication;
3 | import org.springframework.boot.autoconfigure.SpringBootApplication;
4 | /*The annotation below tell the java compiler that it is not a java proect but a spring project */
5 | @SpringBootApplication
6 | public class TodoList{
7 | public static void main(String [] args)
8 | {
9 | //Run the application source is the className
10 | //SpringApplication.run(source, args);
11 | SpringApplication.run(TodoList.class, args);
12 | }
13 | }
--------------------------------------------------------------------------------
/DataTypeCateg/PrimitiveType.java:
--------------------------------------------------------------------------------
1 | public class PrimitiveType
2 | {
3 | public static void logLn(Object o){System.out.println(o);}
4 |
5 | public static void main(String[] args)
6 | {
7 | /**
8 | * PRIMITIVE TYPES HAVE WRAPPER CLASSES OBJECT TYPES
9 | * boolean : Boolean
10 | * byte: Byte
11 | * char: Character
12 | * short: Short
13 | * int: Integer
14 | * long: Long
15 | * float: Float
16 | * double: Double
17 | *
18 | */
19 |
20 | int x = 4;
21 | logLn(x); //will give us 4
22 |
23 | }
24 | }
--------------------------------------------------------------------------------
/OOPClss/Book.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 |
4 | public class Book{
5 | public String title;
6 | public String author;
7 | public String isbn;
8 |
9 | public Book(String title, String author, String isbn){
10 | this.title=title;
11 | this.author=author;
12 | this.isbn=isbn;
13 | }
14 |
15 | public void getInfo(){
16 | System.out.println("The book has a title"+title+" and an author "+author+" with an ISBN number of: "+isbn)
17 | }
18 |
19 | public String toString(){
20 | return "Book [Title: " + title + ", Author: " + author + " ,ISBN: " + "]";
21 | }
22 | }
--------------------------------------------------------------------------------
/ReadingInput/Part3.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 | import java.io.*;
3 | public class Part3
4 | {
5 | public static void readFile(File f) throws IOException
6 | {
7 | Scanner s = new Scanner(f);
8 |
9 | //check the file lines
10 | while (s.hasNextLine())
11 | {
12 | String line = s.nextLine();
13 |
14 | //logic goes here
15 | System.out.println(line);
16 | }
17 |
18 | s.close();
19 | }
20 |
21 | public static void main(String [] args) throws Exception
22 | {
23 | readFile(new File("pc.txt"));
24 | }
25 | }
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | JavaUserDefinedExceptionSampleApp
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Encapsulation/EncapsulateThis.java:
--------------------------------------------------------------------------------
1 | public class EncapsulateThis{
2 | private String fullName;
3 | private int SSN;
4 | private int BankAccountNum;
5 |
6 | public int getBanAccNum()
7 | {
8 | return BankAccountNum;
9 | }
10 |
11 | public String getTheName()
12 | {
13 | return fullName;
14 | }
15 |
16 | public int getSSN()
17 | {
18 | return SSN;
19 | }
20 |
21 | public void setTheName(String AName)
22 | {
23 | fullName=AName;
24 | }
25 |
26 | public void setSSN(int aSSN)
27 | {
28 | SSN=aSSN;
29 | }
30 |
31 | public void setBankAccountNum(int bankAcctNum)
32 | {
33 | BankAccountNum=bankAcctNum;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/Conditionals/Switch.java:
--------------------------------------------------------------------------------
1 | package com.omarbelkady;
2 |
3 | public class Switch
4 | {
5 | public static void main(String[] args)
6 | {
7 | String role= "admin";
8 |
9 | switch(role)
10 | {
11 |
12 | case "admin”:
13 | {
14 | System.out.println("Hello Sir");
15 | break;
16 | }
17 |
18 | case "moderator":
19 | {
20 | System.out.println("Hello Moderator");
21 | break;
22 | }
23 |
24 | default:
25 | {
26 | System.out.println("You are a guest");
27 | }
28 | }
29 | }
30 |
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/src/users/UserNotFoundException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package users;
6 |
7 | import static users.UserCollection.usersList;
8 |
9 |
10 | public class UserNotFoundException extends Exception {
11 |
12 | private String username;
13 |
14 | public UserNotFoundException(String username) {
15 | super("The username :" + username + " does not exist.");
16 | this.username = username;
17 | }
18 |
19 |
20 | public String getUname() {
21 | return username;
22 | }
23 |
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/Wrapper_Classes/README.md:
--------------------------------------------------------------------------------
1 | ```
2 | A Wrapper class is a class whose object wraps or contains a primitive data
3 | type.
4 |
5 | When I convert a primitive data type into an object this process is called
6 | boxing
7 |
8 | When I convert an object into its corresponding primitive data type this
9 | is called unboxing.
10 |
11 | We use a wrapper class to when an internet connection is required
12 | to communicate between two apps. All wrapper classes constructors take
13 | one to three args
14 |
15 | Examples of Wrapper Classes:
16 | - Number
17 | - Character
18 | - Byte
19 | - Short
20 | - Long
21 | - Double
22 | - Float
23 | - Boolean
24 | - Math
25 | ```
26 |
27 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/orderitem/Orderitem.java:
--------------------------------------------------------------------------------
1 | package com.ecommerce.model.orderitem;
2 |
3 | public class Orderitem{
4 | private Product product;
5 | private int quantity;
6 | private double lineTotal;
7 |
8 | public Orderitem(Product product, int quantity){
9 | this.product=product;
10 | this.quantity=quantity
11 | }
12 |
13 | @Override
14 | public String toString() {
15 | return "Orderitem{" +
16 | "product=" + product +
17 | ", quantity=" + quantity +
18 | ", lineTotal=" + lineTotal +
19 | '}';
20 | }
21 |
22 |
23 | }
--------------------------------------------------------------------------------
/Maps/LinkedHashMapTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | A linked Hash map maintains the order at which we declare the dictionary values NOT in alphabetical order
3 | */
4 | import java.util.*;
5 | public class LinkedHashMapTest
6 | {
7 | /**
8 | * LinkedHashMap maintain insertion order
9 | *
10 | * */
11 | public static void main (String[] args)
12 | {
13 | Map m = new LinkedHashMap<>();
14 | m.put("Timothy",5);
15 | m.put("Joey",10);
16 | m.put("Dennis",66);
17 | m.put("Varshika",-54);
18 | m.put("Sanjna",-524);
19 | System.out.println(m);
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/MustKnow/GCDeuclid/README.md:
--------------------------------------------------------------------------------
1 | ```java
2 | public class GCDeuclid{
3 | public static void logLn(Object o){
4 | System.out.println(o);
5 | }
6 |
7 | public static void main(String [] args){
8 | logLn(euclidgcd(1800,54));
9 | }
10 |
11 | public static int euclidgcd(int divid, int divis){
12 | //2526 56837 35
13 | /*
14 | * if divisor i.e. divis completely divid i.e. dividend
15 | * remain=0 i.e. therefore divis is the gcd
16 | * */
17 | int remain = divid%divis;
18 | if(remain==0){
19 | return divis;
20 | }
21 |
22 | return euclidgcd(divis,remain);
23 | }
24 | }
25 | ```
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/cart/Cart.java:
--------------------------------------------------------------------------------
1 | package com.ecommerce.model.customer;
2 | package com.ecommerce.model.cartItem;
3 | package com.ecommerce.model.cart;
4 |
5 |
6 | public class Cart{
7 | private Customer customer;
8 | private CartItem items[];
9 |
10 | public Cart(Customer customer){
11 | this.customer=customer;
12 | }
13 |
14 | public void addItem(CartItem item){
15 |
16 | }
17 | @Override
18 | public String toString() {
19 | return "Cart{" +
20 | "customer=" + customer +
21 | ", items=" + java.util.Arrays.toString(items) +
22 | '}';
23 | }
24 |
25 |
26 | }
--------------------------------------------------------------------------------
/Functions/README.md:
--------------------------------------------------------------------------------
1 | ## A block of code that performs a task
2 | ## We can have a function that sends an email to someone, we can have a function that converts someone’s weight from pounds to kilos. We can have a function that validates user input, etc.
3 | ## Function naming IS CAMEL CASE
4 |
5 | Function architecture in Java
6 | #1. We always put the left brace within the same line where we define our function
7 |
8 | ## Usage
9 |
10 | ```java
11 | ReturnType nameOfFunction() {
12 |
13 | }
14 | ```
15 | ### Function architecture in Java #2.
16 | ```java
17 | void sendEmail() {
18 |
19 | }
20 | ```
21 | Every Java program should have at least one function and this function is called main.
22 |
--------------------------------------------------------------------------------
/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 | org.netbeans.modules.java.j2seproject
3 |
4 |
5 | CollectionsSampleApplicationSkeleton
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Teacher.java:
--------------------------------------------------------------------------------
1 | public class Teacher extends Person{
2 | private String subject;
3 | private double salary;
4 |
5 | public Teacher(String name, int age, String subject, double salary){
6 | super(name, age);
7 | this.subject=subject;
8 | this.salary=salary;
9 | }
10 |
11 | public String getSubject(){
12 | return subject;
13 | }
14 |
15 | public double getSalary(){
16 | return salary;
17 | }
18 |
19 | @Override
20 | public String toString(){
21 | return String.format("Teacher{%s, subject='%s',salary=%.2f}",super.toString(), subject,salary);
22 | }
23 | }
--------------------------------------------------------------------------------
/Spring_Boot/todolist/src/main/java/todolist/todolist/TodoList.java:
--------------------------------------------------------------------------------
1 | package todolist.todolist;
2 | import org.springframework.boot.SpringApplication;
3 | import org.springframework.boot.autoconfigure.SpringBootApplication;
4 | /*The annotation below tell the java compiler that it is not a java project but a spring project */
5 |
6 | @SpringBootApplication
7 | public class TodoList{
8 | public static void main(String [] args)
9 | {
10 | //Run the application source is the className
11 | //SpringApplication.run(source, args);
12 | SpringApplication.run(TodoList.class, args);
13 | //A package is just a denotation of a .PASC Directory
14 |
15 | }
16 | }
--------------------------------------------------------------------------------
/NumberFormatting/currency.java:
--------------------------------------------------------------------------------
1 | package com.omarbelkady;
2 |
3 | import java.text.NumberFormat;
4 |
5 | public class Main{
6 | public static void main(String [] args)
7 | {
8 | NumberFocmat currency = NumberFormat.getCurrencyInstance();
9 | //method for formatting currency
10 | String result = currency.format(1234567.891);
11 | System.out.println(result);
12 | #NumberFormat percentage = NumberFormat.getPercentInstance();
13 | #String result2= percentage.format(0.123);
14 | #shorter way to do it
15 | String result2= NumberFormat.getPercentInstance().format(number:0.123);
16 | System.out.println(result2);
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/Spring_RestController_RestApi/todolist/src/main/todolist.hello/HelloController.java:
--------------------------------------------------------------------------------
1 | package todolist.hello;
2 |
3 | import org.springframework.web.bind.annotation.RestController;
4 | /*This is just a java file right now to let java this is a rest controller I must annotate
5 | it using @RestController directive*/
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | @RestController
8 | @RequestMapping("")
9 | public class HelloController {
10 | //To make the request I need to map the request/method to a function inside a Controller
11 | @GetMapping("/hello")
12 | public String SayHi(){
13 | return "Hello There 6627, go learn sql the best programming language";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/ArbitraryObjects/Main.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 | public class Main
3 | {
4 | static void logLn(Object o) {System.out.println(o);}
5 | public static void main(String [] args)
6 | {
7 | // int [] grades = {3,4,5};
8 | // System.out.println(grades.length);
9 | // System.out.println(stringRep(grades));
10 |
11 | Student stu = new Student();
12 | stu.setAttribute("ID", 12345);
13 | stu.setAttribute("Name", "Angela");
14 | stu.setAttribute("Friend", new String[]{"Alan", "Lyndon", "Smruti", "Omar"});
15 |
16 | String[] friends = (String[]) stu.getAttribute("Friend");
17 |
18 | logLn(Arrays.toString(friends));
19 |
20 |
21 | }
22 | }
--------------------------------------------------------------------------------
/Conditionals/ForEach.java:
--------------------------------------------------------------------------------
1 | //The break statement terminates the loop and the continue statement restarts at the beginning of the loop
2 | package com.omarbelkady;
3 | import java.util.Scanner;
4 |
5 |
6 | public class ForEach
7 | {
8 | public static void main(String[] args)
9 | {
10 |
11 |
12 | String [] fruits= {"Apple", "Mango", "Oranges"};
13 |
14 | //For loop in this context
15 | /* for(int i = 0;i users = new ArrayList();
30 | users.add(myself);
31 | users.add(him);
32 |
33 | User.searchList(users, him);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/EqualsAndHashcode/README.md:
--------------------------------------------------------------------------------
1 | # Equals and Hashcode
2 |
3 | - If 2 objects are equal, they have the same hash code
4 | - You have to override hashCode() if you override equals()
5 |
6 | ```java
7 | public class Student
8 | {
9 | // fields go here
10 | ...
11 |
12 | @Override
13 | public boolean equals(Object o)
14 | {
15 | if (!o(instatanceof Student))
16 | return false;
17 |
18 | if (o == this)
19 | return true;
20 |
21 | //logic goes here, compare fields
22 | }
23 |
24 | @Override
25 | public int hashCode()
26 | {
27 | // logic goes here, hash fields
28 | }
29 | }
30 | ```
31 |
32 | - Useful for
33 | - Lists
34 | - HashSet
35 | - HashMap
--------------------------------------------------------------------------------
/Interfaces/Teacher.java:
--------------------------------------------------------------------------------
1 | public class Teacher extends User implements Speaks
2 | {
3 | //REMEMBER SINCE I IMPLEMENTED SPEAK I MUST HAVE THE METHOD WAVEATTHEM
4 |
5 | @Override
6 | public void waveAtThem()
7 | {
8 | logln("Hi there");
9 | }
10 |
11 | //An interface forces a class to meet certain criteria
12 | //As in they must have certain methods
13 |
14 |
15 | //If i overload the constructor I have to redefine the default one
16 | public Teacher(String fName,String lName)
17 | {
18 | super(fName, lName);
19 | }
20 | }
21 | //Whenever you define implicitly a child constructor it will call the parent constructor:
22 | //Just call the super() and pass in the corresponding arguments.
23 |
--------------------------------------------------------------------------------
/Maps/TreeMapTest.java:
--------------------------------------------------------------------------------
1 |
2 | import java.util.*;
3 | public class TreeMapTest
4 | {
5 | /**
6 | * TreeMaps maintain sorted order by keys
7 | *
8 | * */
9 | public static void main (String[] args)
10 | {
11 |
12 | Map m = new TreeMap<>();
13 | m.put("Timothy",5);
14 | m.put("Joey",10);
15 | m.put("Dennis",66);
16 | m.put("Varshika",-54);
17 | m.put("Sanjna",-524);
18 | System.out.println(m);
19 | }
20 | }
21 | /*
22 | In the console we will have the sorted dictionary in
23 | alphabetical order: Dennis(the key)=value of dennis,
24 | Joey(the key)=value of Joey, Timothy(the key)=value of Timothy
25 | */
26 |
27 |
--------------------------------------------------------------------------------
/Override/MyAwesomeProg1.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class MyAwesomeProg1
4 | {
5 | public static void log(Object o)
6 | {
7 | System.out.print(o);
8 | }
9 |
10 | public static void logln(Object o)
11 | {
12 | System.out.println(o);
13 | }
14 |
15 | public static void main(String [] args)
16 | {
17 |
18 | User myself = new User();
19 | myself.setFirstName("Omar ");
20 | myself.setLastName("Belkady");
21 |
22 |
23 |
24 | User him = new User();
25 | him.setFirstName("Alan ");
26 | him.setLastName("6342");
27 |
28 |
29 | List users = new ArrayList();
30 | users.add(myself);
31 | users.add(him);
32 |
33 | logln(myself.toString());
34 | }
35 |
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/Override/toString/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class MyAwesomeProg
4 | {
5 | public static void log(Object o)
6 | {
7 | System.out.print(o);
8 | }
9 |
10 | public static void logln(Object o)
11 | {
12 | System.out.println(o);
13 | }
14 |
15 | public static void main(String [] args)
16 | {
17 |
18 | User myself = new User();
19 | myself.setFirstName("Omar ");
20 | myself.setLastName("Belkady");
21 |
22 |
23 |
24 | User him = new User();
25 | him.setFirstName("Alan ");
26 | him.setLastName("6342");
27 |
28 |
29 | List users = new ArrayList();
30 | users.add(myself);
31 | users.add(him);
32 |
33 | logln(myself.toString());
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/Spring_Boot/JPA/README.md:
--------------------------------------------------------------------------------
1 | ## JPA: The relational manager of data in Spring Boot
2 | - Spring Data JPA(Java Persistence API) is a framework that abstracts all of the complexity needed for you to interract with your DBs
3 | - Spring Data JPA is an abstraction on top of JPA and hibernate
4 | - The job of Hibernate is to take any Java Object(data) and then ORM(Object Relational Mapping) is used to map the data to the database
5 | - The java class is represented as a table in my DB
6 | - Spring Data JPA does the heavy lifting for me by reducing the boilerplate code that we have to write
7 | - Spring Data JPA gives me lots of generated queries
8 | - I can access my database without having to write one single line of SQL(Worst Programming Language Ever) thanks to repositories
--------------------------------------------------------------------------------
/OOPClss/StudentApp/StudentApp/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | aui.students
5 | StudentApp
6 | 1.0-SNAPSHOT
7 | jar
8 |
9 | UTF-8
10 | 23
11 | aui.students.studentapp.StudentApp
12 |
13 |
--------------------------------------------------------------------------------
/PBVVSPBR/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class MyAwesomeProg
4 | {
5 | public static void log(Object o)
6 | {
7 | System.out.print(o);
8 | }
9 |
10 | public static void logln(Object o)
11 | {
12 | System.out.println(o);
13 | }
14 |
15 | public static void main(String [] args)
16 | {
17 | //Object user#1
18 | User myself = new User();
19 | myself.setFirstName("Omar");
20 | myself.setLastName("Belkady");
21 |
22 |
23 | //Object user#2
24 | User him = new User();
25 | him.setFirstName("Omar ");
26 | him.setLastName("Belkady");
27 |
28 | //List of user Objects
29 | List users = new ArrayList();
30 | users.add(myself);
31 | users.add(him);
32 |
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/src/com/cart/Cart.java:
--------------------------------------------------------------------------------
1 | package com.cart;
2 | import com.cartItem.CartItem;
3 | import com.customer.Customer;
4 |
5 | import java.util.ArrayList;
6 |
7 |
8 | public class Cart {
9 | private Customer customer;
10 | private ArrayListitems = new ArrayList<>();
11 |
12 | public Cart(Customer customer){
13 | this.customer=customer;
14 | }
15 |
16 |
17 | public void addItem(CartItem item){
18 | if(item != null){
19 | items.add(item);
20 | }
21 | }
22 |
23 |
24 | @Override
25 | public String toString() {
26 | return "Cart{" +
27 | "customer=" + customer +
28 | ", items=" + items +
29 | '}';
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/Conditionals/Breakorcontinue.java:
--------------------------------------------------------------------------------
1 | /*The break statement terminates the loop and the continue statement restarts at the beginning of the loop*/
2 | package com.omarbelkady;
3 | import java.util.Scanner;
4 |
5 |
6 | public class Breakorcontinue
7 | {
8 | public static void main(String[] args)
9 | {
10 |
11 | Scanner scanner= new Scanner( System.in );
12 |
13 | String input="1";
14 |
15 | while(true)
16 | {
17 | System.out.print("Input: ");
18 | input=scanner.next().toLowerCase();
19 | if(input.equals("pass"))
20 | continue;
21 | if(input.equals("quit"))
22 | break;
23 | System.out.println(input);
24 | }
25 |
26 |
27 |
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/Override/toString/MyAwesomeProgp2.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class MyAwesomeProgp2
4 | {
5 | public static void log(Object o)
6 | {
7 | System.out.print(o);
8 | }
9 |
10 | public static void logln(Object o)
11 | {
12 | System.out.println(o);
13 | }
14 |
15 | public static void main(String [] args)
16 | {
17 |
18 | User myself = new User();
19 | myself.setFirstName("Omar ");
20 | myself.setLastName("Belkady");
21 |
22 |
23 |
24 | User him = new User();
25 | him.setFirstName("Alan ");
26 | him.setLastName("6342");
27 |
28 |
29 | List users = new ArrayList();
30 | users.add(myself);
31 | users.add(him);
32 |
33 | logln(myself.hashCode() == him.hashCode());
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/OOPClss/genericsexample/StudentApp (1)/StudentApp/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | aui.students
5 | StudentApp
6 | 1.0-SNAPSHOT
7 | jar
8 |
9 | UTF-8
10 | 23
11 | aui.students.studentapp.StudentApp
12 |
13 |
--------------------------------------------------------------------------------
/Override/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class MyAwesomeProg
4 | {
5 | public static void log(Object o)
6 | {
7 | System.out.print(o);
8 | }
9 |
10 | public static void logln(Object o)
11 | {
12 | System.out.println(o);
13 | }
14 |
15 | public static void main(String [] args)
16 | {
17 |
18 | User myself = new User();
19 | myself.setFirstName("Omar");
20 | myself.setLastName("Belkady");
21 |
22 |
23 |
24 | User him = new User();
25 | him.setFirstName("Alan");
26 | him.setLastName("6342");
27 |
28 |
29 | List users = new ArrayList();
30 | users.add(myself);
31 | users.add(him);
32 |
33 | logln(User.searchList(users, "Omar", "6342"));
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/Interfaces/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 | import java.util.ArrayList;
3 |
4 | public class MyAwesomeProg
5 | {
6 | public static void log(Object o)
7 | {
8 | System.out.print(o);
9 | }
10 |
11 | public static void logln(Object o)
12 | {
13 | System.out.println(o);
14 | }
15 |
16 | public static void main(String [] args)
17 | {
18 |
19 | //Student d = new Student("Driss", "PUT THE LNAME HEERE")
20 | Student Eliya = new Student("Eliya", "Reine");
21 | Eliya.waveAtThem();
22 |
23 | List elementsThatSound = new ArrayList();
24 | //Things that go within the list must implement the interface
25 | elementsThatSound.add(Eliya);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/OOPClss/PayrollApp/untitled/src/com/payroll/employee/Employee.java:
--------------------------------------------------------------------------------
1 | package com.payroll.employee;
2 |
3 | public class Employee{
4 | private String name;
5 | private int emp_id;
6 | private double salary;
7 | private String department;
8 | private int SSN;
9 |
10 | public Employee(String name, int emp_id, double salary, String department, int SSN){
11 | this.name=name;
12 | this.emp_id=emp_id;
13 | this.salary=salary;
14 | this.department=department;
15 | this.SSN=SSN;
16 | }
17 |
18 | @Override
19 | public String toString(){
20 | return(name+" is an employee with id: "+emp_id+" and has a salary of "+salary+" and works in the "+department+" department and has a SSN: "+SSN+".");
21 | }
22 |
23 | }
--------------------------------------------------------------------------------
/OOPClss/genericsexample/StudentApp (1)/StudentApp/src/main/java/PrintingUsingOverloadedMethods.java:
--------------------------------------------------------------------------------
1 |
2 | package genericsexample;
3 |
4 | import java.aui.students.studentapp.Student;
5 | import java.aui.students.studentapp.Address;
6 |
7 |
8 | public class PrintingUsingOverloadedMethods {
9 |
10 |
11 | public static StringBuilder printArray(T[] array){
12 | StringBuilder result = new StringBuilder();
13 | for(T element: array){
14 | result.append(element).append(" ");
15 | }
16 | return result.toString().trim();
17 | }
18 |
19 | public static void main(String[] args) {
20 | Student [] studentArray = { new Student("Alice",3.5,40), new Student("Bob",3.5,85)};
21 | printArray(studentArray);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Switch/User.java:
--------------------------------------------------------------------------------
1 | public abstract class User implements Speaks
2 | {
3 | public enum currentSubs
4 | {Silver, Gold, Platinum};
5 | public String firstName; //fieldA
6 | public String lastName; //fieldB
7 | private boolean isVerified = false;
8 |
9 | public static void log(Object o)
10 | {
11 | System.out.print(o);
12 | }
13 |
14 | public static void logln(Object o)
15 | {
16 | System.out.println(o);
17 | }
18 |
19 |
20 |
21 | //I can now create a field of the same name of the name
22 | public currentSubs currentSubs; //Type is currentSubs and nameoffield is current
23 |
24 | public final void wavingToYou ()
25 | {
26 | logln ("Hello y\'all my major is . My name is " + firstName);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Enums/User.java:
--------------------------------------------------------------------------------
1 | public abstract class User implements Speaks
2 | {
3 | public enum currentSubs
4 | {Bronze, Silver, Gold, Platinum };
5 | public String firstName; //fieldA
6 | public String lastName; //fieldB
7 | private boolean isVerified = false;
8 |
9 | public static void log(Object o)
10 | {
11 | System.out.print(o);
12 | }
13 |
14 | public static void logln(Object o)
15 | {
16 | System.out.println(o);
17 | }
18 |
19 |
20 |
21 | //I can now create a field of the same name of the name
22 | public currentSubs currentSubs; //Type is currentSubs and nameoffield is current
23 |
24 | public final void wavingToYou ()
25 | {
26 | logln ("Hello y\'all my major is . My name is " + firstName);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/src/com/product/Product.java:
--------------------------------------------------------------------------------
1 | package com.product;
2 |
3 | public class Product {
4 | private String sku;
5 | private String name;
6 | private double price;
7 | private int quantityInStock;
8 |
9 | public Product(String sku, String name, double price, int quantityInStock){
10 | this.sku=sku;
11 | this.name=name;
12 | this.price=price;
13 | this.quantityInStock=quantityInStock;
14 | }
15 |
16 | @Override
17 | public String toString() {
18 | return "Product{" +
19 | "sku='" + sku + '\'' +
20 | ", name='" + name + '\'' +
21 | ", price=" + price +
22 | ", quantityInStock=" + quantityInStock +
23 | '}';
24 | }
25 |
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/address/Address.java:
--------------------------------------------------------------------------------
1 | package com.ecommerce.model.address;
2 |
3 |
4 | public class Address{
5 | private String street;
6 | private String city;
7 | private String state;
8 | private String zip;
9 |
10 | public Address(String street, String city, String state, String zip) {
11 | this.street = street;
12 | this.city = city;
13 | this.state = state;
14 | this.zip = zip;
15 | }
16 |
17 | @Override
18 | public String toString() {
19 | return "Address{" +
20 | "street='" + street + '\'' +
21 | ", city='" + city + '\'' +
22 | ", state='" + state + '\'' +
23 | ", zip='" + zip + '\'' +
24 | '}';
25 | }
26 | }
--------------------------------------------------------------------------------
/Spring_Boot/CORS/README.md:
--------------------------------------------------------------------------------
1 | ### CORS In Spring Boot
2 |
3 |
4 |
5 | ```java
6 | package com.starter.springboot;
7 |
8 | import org.springframework.context.annotation.Configuration;
9 | import org.springframework.web.servlet.config.annotation.CorsRegistry;
10 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
11 |
12 | @Configuration
13 | public class AppConf implements WebMvcConfigurer {
14 |
15 | @Override
16 | public void addCorsMappings(CorsRegistry registry) {
17 | //enabling CORS
18 | registry.addMapping("/**")
19 | //setting the allowed origin
20 | .allowedOrigins("http://localhost:4200")
21 | //setting the allowed request Method
22 | .allowedMethods("GET");
23 | }
24 | }
25 | ```
--------------------------------------------------------------------------------
/MustKnow/Graphs/README.md:
--------------------------------------------------------------------------------
1 | ### Graphs Implementation
2 |
3 |
4 |
5 |
6 | ##### DFS
7 | ```java
8 | import java.util.*;
9 | class Main{
10 | public final int depthfirsts(int node, int result){
11 | /*PRE ORDER
12 | *
13 | * result.push(node,value);
14 | * */
15 |
16 | if(node.left) {
17 | depthfirsts(node.left, result);
18 | }
19 |
20 |
21 | result.push(node,value);
22 |
23 |
24 | if(node.right){
25 | depthfirsts(node.right);
26 | }
27 |
28 | /*POST ORDER
29 | *
30 | * result.push(node,value);
31 | * */
32 | return result;
33 | }
34 | }
35 | ```
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/src/com/address/Address.java:
--------------------------------------------------------------------------------
1 | package com.address;
2 |
3 | public class Address {
4 | private String address;
5 | private String city;
6 | private String state;
7 | private String zipcode;
8 |
9 | public Address(String address, String city, String state, String zipcode) {
10 | this.address = address;
11 | this.city = city;
12 | this.state = state;
13 | this.zipcode = zipcode;
14 | }
15 |
16 |
17 | @Override
18 | public String toString() {
19 | return "Address{" +
20 | "address='" + address + '\'' +
21 | ", city='" + city + '\'' +
22 | ", state='" + state + '\'' +
23 | ", zipcode='" + zipcode + '\'' +
24 | '}';
25 | }
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/product/Product.java:
--------------------------------------------------------------------------------
1 | package com.ecommerce.model.product;
2 |
3 | public class Product{
4 | private String sku;
5 | private String name;
6 | private double price;
7 | private int quantityInStock;
8 |
9 | public Product(String sku, String name, double price, int quantityInStock){
10 | this.sku=sku;
11 | this.name=name;
12 | this.price=price;
13 | this.quantityInStock=quantityInStock;
14 | }
15 |
16 | @Override
17 | public String toString(){
18 | return "Product{" +
19 | "sku='" + sku + '\'' +
20 | ", name='" + name + '\'' +
21 | ", price=" + price +
22 | ", quantityInStock=" + quantityInStock +
23 | '}';
24 | }
25 | }
--------------------------------------------------------------------------------
/NumberFormatting/formatNums1.java:
--------------------------------------------------------------------------------
1 | package com.omarbelkady;
2 |
3 | import java.text.NumberFormat;
4 |
5 | public class Main{
6 | public static void main(String [] args)
7 | {
8 | //Say I want to format 1234567 to $1,234,567
9 | //Or say I want to output 10% instead of 0.1
10 | //I create a variable and instantiate it
11 | //NumberFormat currency = new NumberFormat();
12 | //The above line of code errors because we cannot instantiate an abstract
13 | //class
14 | //instead we do this and this way of doing this is the factory method
15 | //A factory method is called this way because we create new objects
16 | //We store it in a currency variable of type NumberFormat
17 |
18 | NumberFormat currency = NumberFormat.getCurrencyInstance();
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ArraysInfo/ArrayTest.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 | //the utils.Arrays library implementation is used to be able to use array functions in java
3 |
4 | public class ArrayTest
5 | {
6 | public static void main(String [] args)
7 | {
8 | //old fashioned way array declaration always we must use the new keyword
9 | //int [] numbers= new int [5];
10 |
11 | //new trend to declare arrays
12 | int [] numbers = {2,3,5,1,4};
13 | numbers[0]= 1;
14 | numbers[1]=2;
15 | Arrays.sort(numbers);
16 | //To print the actual items within the array I must import the java.utils.Arrays library.
17 | //Arrays.toString(numbers)//prints the string representation of the array
18 | //System.out.println(numbers)//prints the address of the object in memory
19 | System.out.println(Arrays.toString(numbers));
20 |
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/EqualsAndHashcode/NullPointExcep/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class MyAwesomeProg
4 | {
5 | public static void log(Object o)
6 | {
7 | System.out.print(o);
8 | }
9 |
10 | public static void logln(Object o)
11 | {
12 | System.out.println(o);
13 | }
14 |
15 | public static void main(String [] args)
16 | {
17 |
18 | User myself = new User();
19 | myself.setFirstName("Omar");
20 | myself.setLastName("Belkady");
21 |
22 |
23 |
24 | User him = new User();
25 | him.setFirstName("Omar ");
26 | him.setLastName("Belkady");
27 |
28 |
29 | List users = new ArrayList();
30 | users.add(myself);
31 | users.add(him);
32 |
33 | logln(myself.hashCode() == him.hashCode());
34 | logln(User.searchList(users, him));
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/Solid_Principles/Dependency_Inversion_Principle/Main.java:
--------------------------------------------------------------------------------
1 | public class Main{
2 | public static void main(String [] args){
3 | Car car= new Car();
4 |
5 | Truck truck = new Truck();
6 |
7 | //I need to pass in an argument or parameter
8 | //to the constructor of the race
9 | //I pass the car parameter into the constructor of the race
10 | Race firstRace = new Race(car);
11 | //If I pass Truck here as a parameter it will no longer work because
12 | //what inside the Race constructor is a car
13 | firstRace.start();
14 |
15 | //Now I can pass to the Race Constructor a car
16 | //or a Truck or I can create a second race to initiate
17 | //the second race
18 |
19 | Race secondRace = newRace(truck);
20 | secondRace.start();
21 |
22 | //Above is how to avoid the dependency inversion principle
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Solid_Principles/Liskov_Substitution_Principle/Main.java:
--------------------------------------------------------------------------------
1 | public class Main{
2 | public static void main(String [] args)
3 | {
4 | //Instantiating a Rectangle object
5 | Rectangle rectangle = new Rectangle();
6 | rectangle.setHeight(6);
7 | rectangle.setWidth(8);
8 |
9 | //Square square = new Square();
10 |
11 | /* The code below is not good because I am being redundant
12 | *
13 | * square.setHeight(6);
14 | * square.setWidth(6);
15 | * because I created a constructor I am not using the setWidth and setHeight Methods
16 | *
17 | *
18 | * I will comment out the default constructor of Square call and call on the
19 | * custom constructor
20 | * */
21 | Square square=new Square(6);
22 | }
23 |
24 | }
25 | /*Ways to avoid violations:
26 | Stop inheriting from Rectangle even though a Square is a Rectangle
27 |
28 | */
29 |
--------------------------------------------------------------------------------
/Lists/ArrList.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 | import java.util.ArrayList;
3 | public class ArrList
4 | {
5 | public static void main(String [] args)
6 | {
7 |
8 | User me = new User();
9 | me.setFirstName("Omar");
10 | me.setLastName("Belkady");
11 |
12 |
13 | User you = new User();
14 | you.setFirstName("Nour”);
15 | you.setLastName("Abouham");
16 |
17 | //Remember uppercase User is the type. The you is the name of the
18 | //variable
19 | //When working with lists where we have to put a generic type
20 | //We can use the custom type. This is a custom type of type User
21 | List users = new ArrayList();
22 | //To append I use .add and I add the custom type user
23 | users.add(you);
24 | users.add(me);
25 |
26 | //To access
27 | System.out.println(users.get(1).getFullName());//1=me
28 |
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/NumberFormatting/README.md:
--------------------------------------------------------------------------------
1 | ### Number Formatting thanks to Nelan
2 | ```java
3 | import java.util.*;
4 | public class Omar{
5 | public static main void(String [] args){
6 | Scanner in = new Scanner(System.in);
7 | System.out.print("enter double");
8 | double d = in.nextDouble(); //doubles
9 | System.out.print("enter int");
10 | int i = in.nextInt(); //ints
11 |
12 | System.out.print("enter text");
13 | String text = in.next(); //gets a string up to the first space
14 | in.nextLine();
15 | System.out.print("enter text w/ spaces");
16 | String line = in.nextLine(); //gets a string up to the first space
17 |
18 | System.out.println(d);
19 | System.out.println(i);
20 | System.out.println(text);
21 | System.out.println(line);
22 | in.close();
23 |
24 | System.out.println(new DecimalFormat("#.###").format(4.567346344634));
25 | }
26 | }
27 | ```
28 |
--------------------------------------------------------------------------------
/Classes/Fields2Class/User.java:
--------------------------------------------------------------------------------
1 | //<---------------------------STEP1:DEFINE THE FIELDS------------------------------>
2 | /*
3 | public class User
4 | {
5 | public String firstName;
6 | public String lastName;
7 | }
8 |
9 |
10 | */
11 |
12 | //<--------STEP2:DEFINE THE METHODS WITH THE APPROPRIATE RETURN TYPE AS A KEYWORD PLACED BEFORE THE NAME AND AFTER THE ACCESS MODIFIER-------->
13 | public class User
14 | {
15 | public String firstName;
16 | public String lastName;
17 |
18 |
19 | /* The bottom code will error because we declared it as a void meaning
20 | We do not want anything to be returned to us*/
21 | /*
22 | public void output(){
23 | return "Hi, my name is "+ firstName + " " + lastName + ".";
24 | }
25 | */
26 |
27 | public String output()
28 | {
29 | return "Hi, my name is "+ firstName + " " + lastName + ".";
30 | }
31 | }
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/src/com/payment/Payment.java:
--------------------------------------------------------------------------------
1 | package com.payment;
2 |
3 |
4 | import java.time.LocalDate;
5 | import com.paymentmethod.PaymentMethod;
6 |
7 |
8 | public class Payment {
9 | private int paymentId;
10 | private double amount;
11 | private LocalDate date;
12 | private PaymentMethod method;
13 |
14 | public Payment(int paymentId, double amount, LocalDate date, PaymentMethod method){
15 | this.paymentId=paymentId;
16 | this.amount=amount;
17 | this.date=date;
18 | this.method=method;
19 | }
20 |
21 | @Override
22 | public String toString() {
23 | return "Payment{" +
24 | "paymentId=" + paymentId +
25 | ", amount=" + amount +
26 | ", date=" + date +
27 | ", method=" + method +
28 | '}';
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/Abstraction/README.md:
--------------------------------------------------------------------------------
1 | ## Abstraction
2 |
3 | - Hide certain details and show only what's necessary to the User
4 | - Used through Abstract Classes/Interfaces
5 | - Any class that inherits from an abstract class must implement all the abstract methods declared in the abstract class
6 | - An abstract Class Cannot be instantiated
7 |
8 |
9 | ### Example
10 |
11 |
12 | ```java
13 | public abstract class Animal{
14 | public abstract void animalSound();
15 |
16 | public void sleep(){
17 | System.out.println("Zzz");
18 | }
19 | }
20 |
21 | public class Dog extends Animal{
22 | public void animalSound(){
23 | System.out.println("Woofwoof");
24 | }
25 | }
26 |
27 | public class Base{
28 | public static void main(String [] args)
29 | {
30 | Dog olivia = new Dog();
31 | olivia.animalSound();
32 | olivia.sleep();
33 | }
34 | }
35 | ```
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/order/Order.java:
--------------------------------------------------------------------------------
1 | package com.ecommerce.model.order;
2 | package com.ecommerce.model.customer;
3 | package com.ecommerce.model.orderitem;
4 |
5 | public class Order{
6 | private int orderId;
7 | private LocalDate date;
8 | private Customer customer;
9 | private Orderitem orderitem[];
10 |
11 |
12 | public Order(int orderId, Customer customer, Orderitem orderitem){
13 | this.orderId=orderId;
14 | this.customer=customer;
15 | this.orderitem=orderitem;
16 | }
17 |
18 | @Override
19 | public String toString() {
20 | return "Order{" +
21 | "orderId=" + orderId +
22 | ", date=" + date +
23 | ", customer=" + customer +
24 | ", orderitem=" + java.util.Arrays.toString(orderitem) +
25 | '}';
26 | }
27 |
28 |
29 | }
--------------------------------------------------------------------------------
/Casting/README.md:
--------------------------------------------------------------------------------
1 | ### The final keyword placed in front of a variable is treated as a constant
2 | ### When a datatype of type short is declared It will allocate 2 bytes of memory for the variable.
3 | ### Then it will find a different memory location and try to allocate memory for the
4 | ### another variable which we do not the name and this function is anonymous.
5 | ### This process is called implicit casting it is also referred to as automatic conversion.
6 | ### Whenever we have a value that can be converted to a bigger data type,
7 | ### casting will take place implicitly or automatically. Therefore byte can be converted to short
8 | ### and then a short can be automatically converted to an int. Then an int can easily be converted to a long
9 | ### Casting a decimal(double) to an int is called explicit casting. Casting takes place only
10 | ### with compatible types like we cannot cast a string to a number.
11 |
--------------------------------------------------------------------------------
/Lists/LinkedListTest.java:
--------------------------------------------------------------------------------
1 | //A linked list is faster in certain operations than an Array List.
2 |
3 |
4 | import java.util.*;
5 |
6 | public class LinkedListTest
7 | {
8 |
9 | public static void main (String[] args)
10 | {
11 | //When defining the type for a list always use the keyword Integer NOOOOOT Int
12 | LinkedList t = new LinkedList();
13 |
14 | t.add(1);
15 | t.add(2);
16 | t.add(5);
17 | t.add(4);
18 | t.add(9);
19 | t.add(17);
20 | t.add(14);
21 | t.add(-25);
22 | t.get(0);
23 | t.set(1,9); //changes the value of 2 in the 2nd index to 9
24 | System.out.println(t);
25 | System.out.println(t.subList(1,3));//start at the 2nd element and stop at the 4 element do not print the 4th
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/OOPClss/LibraryApp/src/com/library/librarian/Librarian.java:
--------------------------------------------------------------------------------
1 | package com.library.librarian;
2 |
3 | public class Librarian {
4 | private int employeeId;
5 | private String name;
6 |
7 | public Librarian(String name, int employeeId) {
8 | this.name = name;
9 | this.employeeId = employeeId;
10 | }
11 |
12 | public String getName() {
13 | return name;
14 | }
15 |
16 | public void setName(String name) {
17 | this.name = name;
18 | }
19 |
20 | public int getEmployeeId() {
21 | return employeeId;
22 | }
23 |
24 | public void setEmployeeId(int employeeId) {
25 | this.employeeId = employeeId;
26 | }
27 |
28 | @Override
29 | public String toString() {
30 | return String.format(
31 | "Librarian[id=%d, name=%s]",
32 | employeeId, name
33 | );
34 | }
35 |
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/Classes/Objects.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class Objects
4 | {
5 | public static void main(String [] args)
6 | {
7 | Scanner sc= new Scanner(System.in);
8 |
9 |
10 | ramo("WHAT\'s UUUUUUUUP!",7);
11 | System.out.println(add2(9,1666));
12 | System.out.println(str("Have a terrible day\n"));
13 | sc.close();
14 | }
15 |
16 |
17 |
18 | public static void ramo(String myString, int l)
19 | {
20 | for(int i=0;i users = new TreeSet<>();
11 | users.add(new User("Kevin", "Nguyen"));
12 | users.add(new User("Lyndon", "Nguyen"));
13 | users.add(new User("Vince", "Li"));
14 | users.add(new User("Alan", "Ngo"));
15 | users.add(new User("Varshika", "Pichela"));
16 | users.add(new User("Lucinda", "Nguyen"));
17 | users.add(new User("Carlos", "Ovalle"));
18 | users.add(new User("Smruti", "Shah"));
19 |
20 | logLn(users);
21 | // Should print
22 | // [Alan Ngo, Carlos Ovalle, Kevin Nguyen, Lucinda Nguyen, Lyndon Nguyen, Varshika Pichela, Vince Li, Smruti Shah]
23 | }
24 | }
--------------------------------------------------------------------------------
/OOPClss/2_JavaUserDefinedExceptionSampleApp/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | file:/D:/Course%20materials/Spring%2021/CSC2303/0_Units/unit%206_exceptions/group%20activity/skeletons/skeletons/2_JavaUserDefinedExceptionSampleApp/src/tests/Testing.java
8 | file:/D:/Course%20materials/Spring%2021/CSC2303/0_Units/unit%206_exceptions/group%20activity/skeletons/skeletons/2_JavaUserDefinedExceptionSampleApp/src/users/UserCollection.java
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/payment/Payment.java:
--------------------------------------------------------------------------------
1 |
2 | package com.ecommerce.model.payment;
3 |
4 | import java.time.LocalDate;
5 | import com.ecommerce.model.paymentMethod.PaymentMethod;
6 |
7 |
8 |
9 | public class Payment{
10 | private int paymentId;
11 | private double amount;
12 | private LocalDate date;
13 | private PaymentMethod method;
14 |
15 | public Payment(int paymentId, double amount, LocalDate date, PaymentMethod method){
16 | this.paymentId=paymentId;
17 | this.amount=amount;
18 | this.date=date;
19 | this.method=method;
20 | }
21 |
22 | @Override
23 | public String toString() {
24 | return "Payment{" +
25 | "paymentId=" + paymentId +
26 | ", amount=" + amount +
27 | ", date=" + date +
28 | ", method=" + method +
29 | '}';
30 | }
31 |
32 | }
--------------------------------------------------------------------------------
/PBVVSPBR/MyAwesomeProgp2.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class MyAwesomeProgp2
4 | {
5 | public static void log(Object o)
6 | {
7 | System.out.print(o);
8 | }
9 |
10 | public static void logln(Object o)
11 | {
12 | System.out.println(o);
13 | }
14 |
15 | public static void main(String [] args)
16 | {
17 | //Object user#1
18 | User myself = new User();
19 | myself.setFirstName("Omar");
20 | myself.setLastName("Belkady");
21 |
22 |
23 | //Object user#2
24 | User him = new User();
25 | him.setFirstName("Omar ");
26 | him.setLastName("Belkady");
27 |
28 | //List of user Objects
29 | List users = new ArrayList();
30 | users.add(myself);
31 | users.add(him);
32 |
33 | int p =6;
34 | User.changeSth(p);
35 | logln(p);//prints 6 because increment didn’t affect var
36 |
37 | User.changeSth(him);
38 | logln(him);
39 |
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceOrderSystem/src/com/ecommerce/model/shipment/Shipment.java:
--------------------------------------------------------------------------------
1 | package com.ecommerce.model.shipment;
2 |
3 | import java.time.LocalDate;
4 | import com.ecommerce.model.order.Order;
5 |
6 |
7 | public class Shipment{
8 | private int shipmentId;
9 | private Order order;
10 | private LocalDate shipDate;
11 | private String carrier;
12 |
13 |
14 | public Shipment(int shipmentId, Order order, LocalDate shipDate, String carrier){
15 | this.shipmentId=shipmentId;
16 | this.order=order;
17 | this.shipDate=shipDate;
18 | this.carrier=carrier;
19 | }
20 |
21 | @Override
22 | public String toString() {
23 | return "Shipment{" +
24 | "shipmentId=" + shipmentId +
25 | ", order=" + order +
26 | ", shipDate=" + shipDate +
27 | ", carrier='" + carrier + '\'' +
28 | '}';
29 | }
30 |
31 |
32 | }
--------------------------------------------------------------------------------
/ReadingInput/Part1.java:
--------------------------------------------------------------------------------
1 |
2 | import java.util.Scanner;
3 |
4 | public class Part1
5 | {
6 | public static void main(String [] args)
7 | {
8 | //Creating a scanner object. The parameters we pass in, specifies where we
9 | //will read user input from: terminal window/file
10 | //Terminal window: System.in
11 | //File
12 | Scanner scanner= new Scanner(System.in);
13 | byte age= scanner.nextByte();//for reading the next byte and storing it in a var
14 | //scanner.nextLine();//for reading the next line aka getline(cin, varname) in C++
15 | //scanner.nextBoolean();//for reading next boolean
16 |
17 | //line below is implicit casting or implicit type conversion
18 | //I am converting the age of type byte to a string to have the string printed
19 | //out to the console
20 | System.out.println("My friend you are: " + age);
21 | scanner.close();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Lists/User.java:
--------------------------------------------------------------------------------
1 | public class User
2 | {
3 | private String fN;
4 | public String lN;
5 |
6 | public String getFullName()
7 | {
8 | return getFirstName() + " " + lN.toUpperCase();
9 | }
10 |
11 | public String output()
12 | {
13 | return "Hi, my name is "+ fN + " " + lN + ".";
14 | }
15 | public String getFirstName()
16 | {
17 | return fN.toUpperCase();
18 | }
19 |
20 | //Setter not returning anything ∴ void
21 | public void setFirstName(String firstName)
22 | {
23 | //Assigning the fName value we pass in to the field firstName
24 | fN=firstName.strip().toLowerCase();
25 | //the .strip remove any whitespaces before output.
26 |
27 | }
28 |
29 | public String getLastName()
30 | {
31 | return lN;
32 | }
33 |
34 | //Setter not returning anything ∴ void
35 | public void setLastName(String lastName)
36 | {
37 | //Assigning the lN value we pass in to the field lastName
38 | lN=lastName;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/Classes/Inheritance/Main.java:
--------------------------------------------------------------------------------
1 | /*An object is essentially an instance of a class*/
2 |
3 |
4 | public class Main
5 | {
6 | public static void main(String [] args)
7 | {
8 | //Create 1st dog object
9 | Dog blanco = new Dog("Blanco", 5);
10 |
11 | //I want to invoke the speak method
12 | blanco.speak();
13 |
14 | //Create 2nd dog object
15 | Dog eva = new Dog("Eva", 2);
16 |
17 | //I want to invoke the speak method
18 | eva.speak();
19 |
20 | //Create 3rd dog object
21 | Dog yorkie = new Dog("Yorkie", 4);
22 |
23 | //I want to invoke the speak method
24 | yorkie.speak();
25 |
26 |
27 | yorkie.speak();
28 |
29 |
30 | Cat carla= new Cat("Carla", 19, 13);
31 | carla.speak();
32 | carla.eat(3);
33 | System.out.println(carla.getFood());
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/Constructors/Dog.java:
--------------------------------------------------------------------------------
1 | public class Dog
2 | {
3 | public String name;
4 | public int age;
5 |
6 | //Let's create a constructor
7 | public Dog(String name, int age){
8 | //set the age and attributes to whatever we pass in
9 | this.name=name;
10 | this.age=age;
11 |
12 | //The this keyword is referencing the attributes of the class
13 |
14 | }
15 |
16 | public void speak()
17 | {
18 | System.out.println("I am "+this.name+" and I am "+ this.age+ " years old");
19 | }
20 |
21 | //Lets create another method to get the age
22 | public int getAge()
23 | {
24 | return this.age;
25 | }
26 |
27 | //Lets create another method that will set the age
28 | public void setAge(int age)
29 | {
30 | this.age=age;
31 | }
32 |
33 | private int add2()
34 | {
35 | return this.age+2;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Interfaces/User.java:
--------------------------------------------------------------------------------
1 | public abstract class User
2 | {
3 | //MAKE YOUR FIELDS PRIVATE WHEN USING ANY CLASS FOR BETTER CODE PRACTICE
4 |
5 | private String firstName;//fieldA
6 | private String lastName;//fieldB
7 | private boolean isVerified = false;
8 |
9 | //Remember this is an abstract class which means
10 | //we will not be invoking the constructor directly
11 | //Which means to not call it within our calling program
12 | //But in our Student Class
13 | //I create a User Constructor
14 | public User(String fName, String lName)
15 | {
16 | //Remember fieldName=parameterName
17 | //NOTTT parameterName=fieldName
18 | firstName=fName;
19 | lastName=lName;
20 |
21 | }
22 |
23 |
24 | }
25 |
26 | //Remember this is an abstract class which means
27 | //we will not be invoking the constructor directly
28 | //Which means to not call it within our calling program
29 | //But in our Student Class
30 |
--------------------------------------------------------------------------------
/Constructors/Cat.java:
--------------------------------------------------------------------------------
1 | public class Cat extends Dog
2 | {
3 |
4 | private int food;
5 |
6 | public Cat(String name, int age, int food)
7 | {
8 | //We must call the super class constructor using this implementation or else it will error
9 | super(name, age);
10 | this.food=food;
11 | }
12 |
13 | //HERE’S HOW ITS DONE
14 | public Cat(String name, int age)
15 | {
16 | super(name, age);
17 | //if they do not specify the value of food we give it a default value of 50
18 | this.food=50;
19 | }
20 |
21 | public Cat(String name)
22 | {
23 | super(name, 0);
24 | this.food=50;
25 | }
26 |
27 |
28 | //We want to override the speak method
29 | public void speak(){
30 | System.out.println("Meow my name is "+ this.name + " and I get fed " + this.food);
31 | }
32 |
33 | public void eat(int x)
34 | {
35 | this.food -= x;
36 | }
37 | }
38 |
39 |
40 |
--------------------------------------------------------------------------------
/OOPClss/EcommerceApp/src/com/paymentmethod/PaymentMethod.java:
--------------------------------------------------------------------------------
1 | package com.paymentmethod;
2 |
3 | import com.payment.Payment;
4 |
5 | public enum PaymentMethod {
6 | CASH("Cash on delivery",0.00),
7 | CREDIT_CARD("Credit Card Payment",2.5),
8 | PAYPAL("Paypal Payment",3.0);
9 |
10 | private final String description;
11 | private final double processingFeePercentage;
12 |
13 | PaymentMethod(String description,double processingFeePercentage){
14 | this.description=description;
15 | this.processingFeePercentage=processingFeePercentage;
16 | }
17 |
18 | public String getDescription(){
19 | return description;
20 | }
21 |
22 | public double getProcessingFeePercentage(){
23 | return processingFeePercentage;
24 | }
25 |
26 |
27 | @Override
28 | public String toString() {
29 | return description +" (Fee: "+processingFeePercentage +"%)";
30 | }
31 |
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/OOPClss/Enhancedglovoapp/src/restaurantOwner.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 |
3 | public class restaurantOwner extends user implements manageable {
4 | private List menu;
5 | private double rating;
6 | private String address;
7 |
8 | public double getRating(){
9 | return rating;
10 | }
11 |
12 | public void setRating(double rating) {
13 | this.rating = rating;
14 | }
15 |
16 | public String getAddress() {
17 | return address;
18 | }
19 |
20 | public void setAddress(String address) {
21 | this.address = address;
22 | }
23 |
24 | public restaurantOwner(String address, double rating, List menu){
25 | this.address=address;
26 | this.rating = rating;
27 | this.menu=menu;
28 | }
29 |
30 | @Override
31 | public void manageOrder() {
32 |
33 | }
34 |
35 | @Override
36 | public void manageProfile() {
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/ArraysInfo/MultidimArrs.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class MultidimArrs{
4 | public static void main(String [] args)
5 | {
6 | //new trend to declare arrays
7 | // int [] numbers= {};
8 | // numbers[0]= 1;
9 | // numbers[1]=2;
10 |
11 | //declaring an Array
12 | int [] numbers= {2,3,5,1,4};
13 |
14 | Arrays.sort(numbers); //{1,2,3,4,5}
15 | //To print the actual items within the array I must import the java.utils.Arrays library.
16 | //Arrays.toString(numbers)//prints the string representation of the array
17 | //System.out.println(numbers)//prints the address of the object in memory
18 | System.out.println(Arrays.toString(numbers));
19 |
20 | //Multidimensional Array Declaration 2 rows by 3 columns
21 | int [][] funNumsPart2= new int[2][3];
22 |
23 | //set the value of the matrix in the 2nd row 2nd column to 3
24 | funNumsPart2[1][1]=3;
25 | System.out.println(Arrays.toString(numbers));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Functions/Getset.java:
--------------------------------------------------------------------------------
1 | public class Getset
2 | {
3 | private String firstName;
4 | public String lastName;
5 |
6 | public String getFullName()
7 | {
8 | return getFirstName() + " " + lastName;
9 | }
10 |
11 | public String output()
12 | {
13 | return "Hi, my name is "+ firstName + " " + lastName + ".";
14 | }
15 | public String getTheFirstName()
16 | {
17 | return firstName.toUpperCase();
18 | }
19 |
20 | //Setter not returning anything ∴ void
21 | public void setFirstName(String fN)
22 | {
23 | //Assigning the fName value we pass in to the field firstName
24 | firstName=fN.strip().toLowerCase();
25 | //the .strip remove any whitespaces before output.
26 |
27 | }
28 |
29 | public String getTheLastName()
30 | {
31 | return lastName;
32 | }
33 |
34 | //Setter not returning anything ∴ void
35 | public void setLastName(String lN)
36 | {
37 | //Assigning the lN value we pass in to the field lastName
38 | lastName=lN;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/OOPClss/ExercisesSummer2025/ProblemSets/PersonInheritanc/Person.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 |
4 | public class Person{
5 | private String name;
6 | private int age;
7 |
8 | public Person(String name,int age){
9 | this.name=name;
10 | this.age=age;
11 | }
12 |
13 | public String getName(){
14 | return name;
15 | }
16 |
17 | public int getAge(){
18 | return age;
19 | }
20 |
21 | @Override
22 | public String toString(){
23 | return String.format("Person{name='%s',age=%d}",name,age);
24 | }
25 |
26 |
27 | public static void main(String [] args){
28 | Person p = new Person("Alice Walton", 29);
29 | Student s = new Student("Bob", 20, 1001);
30 | Teacher t = new Teacher("Carol", 42, "Physics II", 55_000.00);
31 | List indivs = Arrays.asList(p,s,t);
32 | for(Person person: indivs){
33 | System.out.println(indivs);
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/Override/EqualsNdHashCode/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class MyAwesomeProg
4 | {
5 | public static void log(Object o)
6 | {
7 | System.out.print(o);
8 | }
9 |
10 | public static void logln(Object o)
11 | {
12 | System.out.println(o);
13 | }
14 |
15 | public static void main(String [] args)
16 | {
17 |
18 | User myself = new User();
19 | myself.setFirstName("Omar ");
20 | myself.setLastName("Belkady");
21 |
22 |
23 |
24 | User him = new User();
25 | him.setFirstName("Alan ");
26 | him.setLastName("Ngo");
27 |
28 |
29 | List users = new ArrayList();
30 | users.add(myself);
31 | users.add(him);
32 |
33 | logln(myself.hashCode() == him.hashCode()); //false when him == Alan ngo
34 | logln(myself.equals(him));//false when him== Alan Ngo
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/Classes/Dog.java:
--------------------------------------------------------------------------------
1 | public class Dog
2 | {
3 | private String name;
4 | private int age;
5 |
6 | //Let's create a constructor
7 | public Dog(String name, int age){
8 | //set the age and attributes to whatever we pass in
9 | this.name=name;
10 | this.age=age;
11 |
12 | //The this keyword is referencing the attributes of the class
13 |
14 | add2();
15 | speak();
16 | }
17 |
18 | public void speak()
19 | {
20 | System.out.println("I am "+this.name+" and I am "+ this.age+ " years old");
21 | }
22 |
23 | //Lets create another method to get the age
24 | public int getAge()
25 | {
26 | return this.age;
27 | }
28 |
29 | //Lets create another method that will set the age
30 | public void setAge(int age)
31 | {
32 | this.age=age;
33 | }
34 |
35 | private int add2()
36 | {
37 | return this.age+2;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/OOPClss/GlovoApp/src/com/glovo/model/Restaurant.java:
--------------------------------------------------------------------------------
1 | package com.glovo.model;
2 |
3 | public class Restaurant{
4 | private String name;
5 | private String address;
6 | private double rating;
7 |
8 | public Restaurant(String name, String address, double rating){
9 | this.name=name;
10 | this.address=address;
11 | this.rating=rating;
12 | }
13 |
14 | public String getName(){
15 | return name;
16 | }
17 |
18 | public String getAddress(){
19 | return address;
20 | }
21 |
22 | public double getRating(){
23 | return rating;
24 | }
25 |
26 | public void setRating(double rating){
27 | this.rating=rating;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return String.format(
33 | "Restaurant: %s, Address: %s, Rating: %.1f",
34 | name,
35 | address,
36 | rating
37 | );
38 | }
39 |
40 |
41 | }
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/com/glovo/model/Restaurant.java:
--------------------------------------------------------------------------------
1 | package com.glovo.model;
2 |
3 | public class Restaurant{
4 | private String name;
5 | private String address;
6 | private double rating;
7 |
8 | public Restaurant(String name, String address, double rating){
9 | this.name=name;
10 | this.address=address;
11 | this.rating=rating;
12 | }
13 |
14 | public String getName(){
15 | return name;
16 | }
17 |
18 | public String getAddress(){
19 | return address;
20 | }
21 |
22 | public double getRating(){
23 | return rating;
24 | }
25 |
26 | public void setRating(double rating){
27 | this.rating=rating;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return String.format(
33 | "Restaurant: %s, Address: %s, Rating: %.1f",
34 | name,
35 | address,
36 | rating
37 | );
38 | }
39 |
40 |
41 | }
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Restaurant.java:
--------------------------------------------------------------------------------
1 | package com.glovo.model;
2 |
3 | public class Restaurant{
4 | private String name;
5 | private String address;
6 | private double rating;
7 |
8 | public Restaurant(String name, String address, double rating){
9 | this.name=name;
10 | this.address=address;
11 | this.rating=rating;
12 | }
13 |
14 | public String getName(){
15 | return name;
16 | }
17 |
18 | public String getAddress(){
19 | return address;
20 | }
21 |
22 | public double getRating(){
23 | return rating;
24 | }
25 |
26 | public void setRating(double rating){
27 | this.rating=rating;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return String.format(
33 | "Restaurant: %s, Address: %s, Rating: %.1f",
34 | name,
35 | address,
36 | rating
37 | );
38 | }
39 |
40 |
41 | }
--------------------------------------------------------------------------------
/ReadingInput/Part2.java:
--------------------------------------------------------------------------------
1 |
2 | import java.util.*;
3 |
4 | public class Part2
5 | {
6 | public static void main(String [] args)
7 | {
8 | //Creating a scanner object. The parameters we pass in, specifies where we
9 | //will read user input from: terminal window/file
10 | //Terminal window: System.in
11 | //File
12 | Scanner scanner= new Scanner(System.in);
13 | System.out.print("Welcome enter your age "); //byte age= scanner.nextByte();
14 | int age=scanner.nextInt();
15 | //To read a string
16 |
17 | System.out.print("Welcome enter your name ");
18 | String name=scanner.next();
19 | //Anytime I write to the console next it reads the next token
20 | //Say I write for name input Omar Belkady it will say Hi Omar
21 | //Not Hi Omar Belkady because the next method reads one token at a time
22 | //To read Omar Belkady we use the method nextLine
23 | System.out.println("Name: "+name);
24 | System.out.println("Age: "+age);
25 |
26 | scanner.close();
27 |
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Lists/myArrList.java:
--------------------------------------------------------------------------------
1 | import java.util.ArrayList;
2 | import java.util.List;
3 |
4 | public class MyArrList
5 | {
6 | public static void main(String [] args)
7 | {
8 | //Creating an array of Names
9 | String [] fNames = {"Richard", "Nouhaila", "Hicham", "Alan", "Angela", "Waleed"};
10 | String [] lNames = {"Nguyen", "Bahtat", "Ikken", "Ngo", "Cao", "ana"};
11 | //Creating a user list
12 | List user = new ArrayList();
13 |
14 | //Just assume we are reading the data from a file
15 |
16 | //Create a loop to loop through and first invoke the new user
17 | //Then we set the firstName
18 | //Then we set the lastName
19 | for(int i=0; i() mylinkl = new LinkedList<>()
8 | ```
9 |
10 | #### Priority Queue Instantiation of String Type
11 |
12 | ```java
13 | Queue() mylinkl = new Priority Queue<>()
14 | ```
15 |
16 | #### Priority Queue Instantiation of Integer Type
17 |
18 | ```java
19 | Queue() mylinkl = new Priority Queue<>()
20 | ```
21 |
22 | | |Start | Method |Output |
23 | |----------------|-----------|------------|---------------|
24 | |add|[] |.add("Hello"); |["Hello"] |
25 | |element | ["Hello"] |.element() |Hello |
26 | |peek | ["Hello", "Hi"] |.peek() |Hello |
27 | |pole | ["Hello", "Hi"] |.pole() |Hello |
28 | |remove | ["Hello", "Hi"] |.remove("Hi") |["Hello"] |
29 | |size | [“Hello”, “Hi”] |.size() | 2|
30 |
31 |
--------------------------------------------------------------------------------
/Sets/TreeSetTest.java:
--------------------------------------------------------------------------------
1 | //package myPackage;
2 | import java.util.Scanner;
3 | import java.util.Set;
4 | import java.util.TreeSet;
5 | public class TreeSetTest
6 | {
7 | //main method
8 | public static void main (String[] args)
9 | {
10 | //Syntax: Set nameofSet = new TreeSet()
11 | Set t = new TreeSet();
12 |
13 | //To append to a Set
14 | t.add(5);
15 | t.add(8);
16 | t.add(5);
17 | t.add(9);
18 | System.out.println(t);//print 5, 8, 9
19 | t.add(-8);
20 | t.remove(8);
21 |
22 | //clear an entire Set
23 | //t.clear();
24 |
25 | //check if empty
26 | //t.isEmpty()
27 |
28 | //get the length of the Set
29 | //t.size();
30 |
31 | //Check if element exists within the Set
32 | boolean m = t.contains(5);
33 | System.out.println(m);
34 | System.out.println(t);
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Classes/Inheritance/Cat.java:
--------------------------------------------------------------------------------
1 | public class Cat extends Animal
2 | {
3 | //Here Dog is the Base Class and the Cat is the Derived Class
4 | //Whenever we inherit and want to use the functions within that Class
5 | //WEEE MUST IMPLEMENT THE CONSTRUCTOR of the DErived class or else the functions
6 | //within the dog class will not work
7 |
8 | private int food;
9 |
10 | public Cat(String name, int age, int food)
11 | {
12 | //We must call the super class constructor using this implementation or else it will error
13 | super(name, age);
14 | this.food=food;
15 | }
16 |
17 | //We want to override the speak method
18 | @Override
19 | public void speak()
20 | {
21 | System.out.println("called from Dog");
22 | System.out.println("I am "+getName()+" and I am "+ getAge()+ " years old");
23 | }
24 |
25 | public void eat(int x)
26 | {
27 | this.food -= x;
28 | }
29 |
30 | public int getFood(){return food;}
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/Maps/HashTable/HashTable.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class HashTable {
4 | static void log(Object o)
5 | {
6 | System.out.print(o);
7 | }
8 |
9 | static void logln(Object o)
10 | {
11 | System.out.println(o);
12 | }
13 |
14 | public static void main(String[] args) {
15 | Hashtable licenplates = new Hashtable<>();
16 | Enumeration people;
17 | String output;
18 |
19 | licenplates.put("David", new String("6543ML"));
20 | licenplates.put("Tracy", new String("6UN274"));
21 | licenplates.put("Bob", new String("37KU42"));
22 |
23 | //Retrieve All License Plates
24 | people = licenplates.keys();
25 |
26 | while(people.hasMoreElements()) {
27 | output = (String) people.nextElement();
28 | System.out.println(output + ": " + licenplates.get(output));
29 | }
30 |
31 |
32 | //Outputs the number of elements within the hashtable
33 | logln(licenplates.size());
34 | }
35 | }
--------------------------------------------------------------------------------
/Lists/CustType.java:
--------------------------------------------------------------------------------
1 | import java.util.ArrayList;
2 | import java.util.List;
3 |
4 | public class custtypeasargs
5 | {
6 | public static void main(String [] args)
7 | {
8 | String [] firstNames = {"Omar", "Angela", "Nouhaila", "Noor", "Alan"};
9 | String [] lastNames = {"Belkady", "Cao", "Bahtat", "Zalila", "Ngo"};
10 |
11 | List users = new ArrayList();
12 |
13 |
14 | for(int j=0;j=gridisl.length || y<0 || y>=gridisl[x].length || gridisl[x][y] == '0' )
22 | return;
23 | gridisl[x][y] = '0';
24 | //recursive calls
25 | bFSCalling(gridisl, x+1, y);//up
26 | bFSCalling(gridisl, x-1, y);//down
27 | bFSCalling(gridisl, x, y-1);//left
28 | bFSCalling(gridisl, x, y+1);//right
29 | }
30 | }
--------------------------------------------------------------------------------
/Conditionals/WhileLoopFreeMemICU.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class WhileLoopFreeMemICU
4 | {
5 | public static void main (String[] args) {
6 | /*REMEMBER FOR LOOPING ICU METHOD
7 | -I:Initialization
8 | -C: Condition to Check true:false
9 | -U: Update else it will be an infinite loop and you do not want that
10 | */
11 | System.out.print("Guess the password:\n");
12 |
13 | String password = "passpass";
14 | Scanner scanner = new Scanner(System.in);
15 | String guessed = scanner.nextLine();
16 | int myIter =0;
17 |
18 |
19 | while(!guessed.equals(password))
20 | {
21 | System.out.print("Wrong pass you mong, guess the pass again: ");
22 | guessed=scanner.nextLine();
23 | }
24 |
25 | System.out.println("Congratulations you're not a mong!");
26 |
27 | //When finishin with a scanner REMEMBER
28 | scanner.close();
29 | //This frees memory and prevents a memory leak
30 | }
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/OOPClss/GlovoApp/src/com/glovo/model/Customer.java:
--------------------------------------------------------------------------------
1 | package com.glovo.model;
2 |
3 | public class Customer {
4 | private String name;
5 | private String phoneNumber;
6 | private String address;
7 |
8 |
9 | public Customer(String name, String phoneNumber, String address) {
10 | this.name = name;
11 | this.phoneNumber = phoneNumber;
12 | this.address = address;
13 | }
14 |
15 | public String getName() {
16 | return name;
17 | }
18 |
19 | public String getPhoneNum() {
20 | return phoneNumber;
21 | }
22 |
23 | public void setPhoneNum(String phoneNumber) {
24 | this.phoneNumber = phoneNumber;
25 | }
26 |
27 | public String getAddress() {
28 | return address;
29 | }
30 |
31 | public void setAddress(String address) {
32 | this.address = address;
33 | }
34 |
35 | @Override
36 | public String toString() {
37 | return String.format(
38 | "Customer Name: %s, Phone Number: %s, Address: %s",
39 | name, phoneNumber, address
40 | );
41 |
42 | }
43 | }
--------------------------------------------------------------------------------
/ParentClassMethodsPLUSSuper/User.java:
--------------------------------------------------------------------------------
1 | public abstract class User
2 | {
3 | private String firstName;//fieldA
4 | private String lastName;//fieldB
5 |
6 | public static void log(Object o)
7 | {
8 | System.out.print(o);
9 |
10 | }
11 |
12 | public static void logln(Object o)
13 | {
14 | System.out.println(o);
15 | }
16 |
17 | //Remember this is an abstract class which means
18 | //we will not be invoking the constructor directly
19 | //Which means to not call it within our calling program
20 | //But in our Student Class
21 | //I create a User Constructor
22 | public User(String fName, String lName)
23 | {
24 | //Remember fieldName=parameterName
25 | //NOTTT parameterName=fieldName
26 | firstName=fName;
27 | lastName=lName;
28 |
29 |
30 | }
31 |
32 | public final void sayHello()
33 | {
34 | logln(firstName+ " " + lastName);
35 | }
36 | }
37 |
38 | //Remember this is an abstract class which means
39 | //we will not be invoking the constructor directly
40 | //Which means to not call it within our calling program
41 | //But in our Student Class
42 |
--------------------------------------------------------------------------------
/Garbage_Collection/GarbageColl.java:
--------------------------------------------------------------------------------
1 | public class GarbageColl{
2 |
3 | String object_name;
4 |
5 | //My Constructor
6 | public GarbageColl(String object_name){
7 | this.object_name=object_name;
8 | }
9 |
10 | //This method is unreachable once Removed
11 | static void unReachableOnceRemoved()
12 | {
13 | //creating An Object
14 | GarbageColl javaLover = new GarbageColl("javaLover");
15 | showThis();
16 | }
17 |
18 | static void showThis()
19 | {
20 | //the 2nd object below I created will also becaome unreachable once remove
21 | GarbageColl assemblyLover = new GarbageColl("assemblyLover");
22 | }
23 |
24 | public static void main(String [] args)
25 | {
26 | //calling the showThis method
27 | showThis();
28 |
29 | //calling the garbage Collector method on it
30 | System.gc();
31 | }
32 |
33 | @Override
34 | /*Overriding the finalize method to seee which of my objects has been garbage collected*/
35 | protected void finalize() throws Throwable
36 | {
37 | System.out.println(this.object_name + " has been successfully garbage collected and handed to CLovers and PintosLovers");
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Switch/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.List;
2 | import java.util.ArrayList;
3 |
4 | public class MyAwesomeProg
5 | {
6 | public static void log(Object o)
7 | {
8 | System.out.print(o);
9 | }
10 |
11 | public static void logln(Object o)
12 | {
13 | System.out.println(o);
14 | }
15 |
16 | public static void main(String [] args)
17 | {
18 | Student d = new Student("Daniela", "Ennen");
19 | d.currentSubs=d.currentSubs.Silver;
20 |
21 | //To output I do this
22 | logln(d.currentSubs);
23 |
24 | switch(d.currentSubs)
25 | {
26 | case Platinum:
27 | logln("Outstanding customer. We highly value your business and thank you for trusting us.");
28 | break;
29 |
30 | case Gold:
31 | logln("You have been an awesome addition to our business. We appreciate the numerous visits a year");
32 | break;
33 |
34 | case Silver:
35 | logln("We appreciate that you have shown interest in our business and would like to offer you a free service.");
36 | break;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/OOPClss/Generics/Car.java:
--------------------------------------------------------------------------------
1 | public class Car {
2 | private int year;
3 | private String make;
4 | private String model;
5 | private String color;
6 |
7 | public Car(int year, String make,String model,String color)
8 | {
9 | this.year=year;
10 | this.make=make;
11 | this.model=model;
12 | this.color=color;
13 | }
14 |
15 | public int getYear(){
16 | return year;
17 | }
18 |
19 | public void setYear(int year){
20 | this.year=year;
21 | }
22 |
23 | public String getMake(){
24 | return make;
25 | }
26 |
27 | public void setMake(String make){
28 | this.make=make;
29 | }
30 | public String getModel(){
31 | return model;
32 | }
33 |
34 | public void setModel(String model){
35 | this.model=model;
36 | }
37 |
38 |
39 | public String getColor(){
40 | return color;
41 | }
42 |
43 | public void setColor(String color){
44 | this.color=color;
45 | }
46 |
47 | @Override
48 | public String toString() {
49 | return year + " " + make + " " + model + " (" + color + ")";
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/Solid_Principles/Liskov_Substitution_Principle/README.md:
--------------------------------------------------------------------------------
1 | ```
2 | "Let φ(x) be a property provable about objects x of type T. Then φ(y) should be true for objects y of Type S, where S is a subtype of T"
3 | This is saying to regard parameter passed as an object(x) has a type T. Then we have another object which carries the type
4 | S. Well S is a subtype of T. If we pass an object of type T and it outputs true then it should also output true for the type S because it is a subset of T.
5 | ```
6 |
7 | ```
8 | φ(x) is a function where x is the parameter of the function and φ(y) is a function with a different parameter y. S and T in this case are just objects.
9 | ```
10 |
11 |
12 | ### How To Know If We Are Violating This Principle
13 | ```
14 | Say That I have a Base Class X and a Class Y where Y is a derived class Of X. Well Class X has a function,
15 | which means every subclass of it must override it, this tells me that Class X is abstract. Soon though you found the class Y cannot do the desired functionality as the function in class X or isn't even used in the derived class Y. In other words, you override it but . Then you know you have violated this principle.
16 | ```
17 |
18 |
--------------------------------------------------------------------------------
/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | file:/D:/course%20Materials/Spring16/CSC2303/2_Laboratories/lab9_Collections%20lab%20skeleton%20application/CollectionsSampleApplicationSkeleton/src/students/StudentCollection.java
8 | file:/D:/course%20Materials/Spring16/CSC2303/2_Laboratories/lab9_Collections%20lab%20skeleton%20application/CollectionsSampleApplicationSkeleton/src/LMS/StudentSystem.java
9 | file:/D:/course%20Materials/Spring16/CSC2303/2_Laboratories/lab9_Collections%20lab%20skeleton%20application/CollectionsSampleApplicationSkeleton/src/students/Student.java
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Casting/Implicitcasting.java:
--------------------------------------------------------------------------------
1 | //When the piece of code gets executed the Java compiler will check for the value stored in the variable x
2 | //which has a datatype of short. It will allocate 2 bytes of memory for the variable.
3 | //Then it will find a different memory location and try to allocate memory for the
4 | //another variable which we do not the know the name and this function is anonymous.
5 | //This variable will be an integer, then java will copy the value of x into that memory
6 | //space and it will add the two numbers together. This process is called implicit casting it
7 | //is also referred to as automatic conversion.
8 | //Whenever we have a value that can be converted to a bigger data type,
9 | //casting will take place implicitly or automatically.
10 | //Therefore byte can be converted to short and then a short can be automatically converted to an int.
11 | //Then an int can easily be converted to a long. all the work.
12 |
13 |
14 | public class Implicitcasting
15 | {
16 | public static void main(String [] args)
17 | {
18 | short x=1;//short = 2 bytes
19 | int y=x+2;//int = 4 bytes
20 | System.out.println(y);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Conditionals/DoWhile.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class DoWhile
4 | {
5 | public static void main (String[] args) {
6 | /*REMEMBER FOR LOOPING ICU METHOD
7 | -I:Initialization
8 | -C: Condition to Check true:false
9 | -U: Update else it will be an infinite loop and you do not want that
10 | */
11 | String password = "passpass";
12 | Scanner scanner = new Scanner(System.in);
13 | String guessed;
14 | do
15 | {
16 | System.out.println("This device is prompting you to enter the password to gain access");
17 | guessed = scanner.nextLine();
18 | }
19 | //Notice how guessed is declared then defined because if we didn't do that
20 | //error will be raised "guessed is not defined" as soon as we reach the while loop execution
21 |
22 |
23 | while(!guessed.equals(password));
24 | System.out.println("Congratulations you're not a mong!");
25 |
26 | //When finishin with a scanner REMEMBER
27 | scanner.close();
28 | //This frees memory and prevents a memory leak
29 | }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/Maps/LetterOccurence.java:
--------------------------------------------------------------------------------
1 | //This program calculates the number of letters in a string
2 |
3 | import java.util.*;
4 |
5 | public class LetterOccurence
6 | {
7 | public static void main (String[] args)
8 | {
9 | Map m = new HashMap<>();
10 | String str = "Hello My Name is Omar and I am super social";
11 | for(char x:str.toCharArray())//take the string and place it inside a character Array
12 | {
13 | //Now we will check how many times a character exists within the array
14 |
15 | //If it already exists have it update the value
16 | if(m.containsKey(x))
17 | {
18 | int old=(int)m.get(x);
19 | m.put(x,old+1);
20 | }
21 |
22 | //If it doesn't exist create a new key and give it a value of 1
23 | else
24 | {
25 | m.put(x,1);
26 | }
27 |
28 | }
29 | //Print the occurence of the letters to the console
30 | System.out.println(m);
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIII/src/com/glovo/model/Customer.java:
--------------------------------------------------------------------------------
1 | package com.glovo.model;
2 | import com.glovo.manageable.Manageable;
3 |
4 | public class Customer extends User implements Manageable{
5 |
6 | private String address;
7 | private String paymentInfo;
8 |
9 |
10 | public Customer(String name, String phoneNumber, String email, String password, String address,String paymentInfo) {
11 | super(name,phoneNumber,email,password);
12 | this.address = address;
13 | this.paymentInfo=paymentInfo;
14 | }
15 |
16 | @Override
17 | public void manageOrder(){
18 | System.out.println("Customer " + getName() + " viewing orders");
19 | }
20 |
21 | @Override
22 | public void manageProfile(){
23 | System.out.println("Customer " + getName() + " viewing Profile");
24 | }
25 |
26 |
27 |
28 | public String getAddress() {
29 | return address;
30 | }
31 |
32 |
33 | public String getPaymentInfo() {
34 | return paymentInfo;
35 | }
36 | @Override
37 | public String toString() {
38 | return(super.toString() + " and its address: "+this.address+" and his payment info is: "+this.paymentInfo);
39 | }
40 | }
--------------------------------------------------------------------------------
/OOPClss/GlovoAppPartIIII/src/com/glovo/model/Customer.java:
--------------------------------------------------------------------------------
1 | package com.glovo.model;
2 | import com.glovo.manageable.Manageable;
3 |
4 | public class Customer extends User implements Manageable{
5 |
6 | private String address;
7 | private String paymentInfo;
8 |
9 |
10 | public Customer(String name, String phoneNumber, String email, String password, String address,String paymentInfo) {
11 | super(name,phoneNumber,email,password);
12 | this.address = address;
13 | this.paymentInfo=paymentInfo;
14 | }
15 |
16 | @Override
17 | public void manageOrder(){
18 | System.out.println("Customer " + getName() + " viewing orders");
19 | }
20 |
21 | @Override
22 | public void manageProfile(){
23 | System.out.println("Customer " + getName() + " viewing Profile");
24 | }
25 |
26 |
27 |
28 | public String getAddress() {
29 | return address;
30 | }
31 |
32 |
33 | public String getPaymentInfo() {
34 | return paymentInfo;
35 | }
36 | @Override
37 | public String toString() {
38 | return(super.toString() + " and its address: "+this.address+" and his payment info is: "+this.paymentInfo);
39 | }
40 | }
--------------------------------------------------------------------------------
/Polymorphism/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | /*
2 | Now because both Student and Teacher extend User we can say that every
3 | Student and Teacher is a User.
4 | THE OPPOSITE HOWEVER IS NOT ALWAYS TRUE.
5 | */
6 |
7 |
8 | import java.util.List;
9 | import java.util.ArrayList;
10 |
11 | public class MyAwesomeProg
12 | {
13 | public static void log(Object o)
14 | {
15 | System.out.print(o);
16 | }
17 |
18 | public static void logln(Object o)
19 | {
20 | System.out.println(o);
21 | }
22 |
23 | public static void main(String [] args)
24 | {
25 | Student m = new Student();
26 | m.major= "Biology";
27 | m.firstName = "Nathan";
28 | m.lastName = "Higgins";
29 | m.sayHello();
30 |
31 | Teacher c = new Teacher();
32 | c.firstName = "chauntelle";
33 | c.lastName = "o\'loughlin";
34 |
35 | //Since both these classes we created instances of,
36 | //extended User we will append them to a list of Type
37 | //User
38 | List acadUsers = new ArrayList();
39 | acadUsers.add(c);
40 | acadUser.add(m);
41 |
42 | //Create a for Each for every User of Instance t in acadUsers
43 | for(User t: acadUsers)
44 | {
45 | t.sayHello();
46 | }
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/RetCustObj/MyAwesomeProg.java:
--------------------------------------------------------------------------------
1 | import java.util.*;
2 |
3 | public class MyAwesomeProg
4 | {
5 | public static void log(Object o)
6 | {
7 | System.out.print(o);
8 | }
9 |
10 | public static void logln(Object o)
11 | {
12 | System.out.println(o);
13 | }
14 |
15 | public static void main(String [] args)
16 | {
17 |
18 | User myself = new User();
19 | myself.setFirstName("Omar ");
20 | myself.setLastName("Belkady");
21 |
22 |
23 |
24 | User her = new User();
25 | her.setFirstName("Bent ");
26 | her.setLastName("Al3ahira");
27 |
28 |
29 | List users = new ArrayList();
30 | users.add(myself);
31 | users.add(him);
32 |
33 | //Creating a user named Search
34 | User recherche = new User();
35 | recherche.setFirstName(“Bent”);
36 | recherche.setLastName(“Al3ahira”);
37 |
38 |
39 | //since this returns a user we can set it to a User object
40 | User located = User.searchForUser(users, recherche);
41 |
42 | //With this new user object created we will log it to the console.
43 | logln(located);//returns User[getFullName()=Bent Al3ahira]
44 | //The memory address of the object is passed by VALUE
45 |
46 | }
47 |
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/OOPClss/CollectionsSampleApplicationSkeleton (extract.me)/CollectionsSampleApplicationSkeleton/src/LMS/StudentSystem.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this template, choose Tools | Templates
3 | * and open the template in the editor.
4 | */
5 | package LMS;
6 |
7 | import students.Student;
8 | import students.StudentCollection;
9 |
10 |
11 | /**
12 | *
13 | * @author mourhir
14 | */
15 | public class StudentSystem {
16 |
17 | public static StudentCollection studentColl = new StudentCollection();
18 |
19 | public static void main(String[] args) {
20 |
21 | //create more students and add to the collection
22 |
23 | // call the tostring
24 |
25 |
26 | //modify the gpa of one of the students make it 3.5
27 |
28 |
29 | //call the tostring to double check the modifiation
30 |
31 | //find all students with gpa 4.0 and display them
32 |
33 | //sort alphabetically
34 |
35 | //call the tostring
36 |
37 | //sort based on GPA
38 |
39 | //call the tostring
40 |
41 | //remove one of the students added above
42 |
43 | //call the tostring
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------