From fdba2b072e62624ffd3d39785c9f7a757c0f6844 Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:40:57 +0530 Subject: [PATCH 01/15] Add files via upload --- user.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 user.java diff --git a/user.java b/user.java new file mode 100644 index 0000000..13fb19d --- /dev/null +++ b/user.java @@ -0,0 +1,44 @@ +package Buffer; + +import java.util.ArrayList; + +public class user { + private String email; + private String name; + private String surname; + private double phoneNumber; + + public user(String email, String name, double phoneNumber,String surname) { + this.email = email; + this.name = name; + this.phoneNumber = phoneNumber; + this.surname = name; +} + +public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(double phoneNumber) { + this.phoneNumber = phoneNumber; + } + + +} + From 1103994d3bc35b9c07811239f98cbb0b07fe0392 Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:43:26 +0530 Subject: [PATCH 02/15] Add files via upload --- Main.java | 185 ++++++++++++++++++++++++++++++++++++++++++++++++++ event.java | 29 ++++++++ feedback.java | 19 ++++++ logins.java | 22 ++++++ pQueue.java | 137 +++++++++++++++++++++++++++++++++++++ signUp.java | 18 +++++ 6 files changed, 410 insertions(+) create mode 100644 Main.java create mode 100644 event.java create mode 100644 feedback.java create mode 100644 logins.java create mode 100644 pQueue.java create mode 100644 signUp.java diff --git a/Main.java b/Main.java new file mode 100644 index 0000000..f478836 --- /dev/null +++ b/Main.java @@ -0,0 +1,185 @@ +package Buffer; +import java.util.HashMap; +import java.util.Map; +import java.util.Scanner; + +public class Main { + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner sc=new Scanner(System.in); + + int ch,a,b,x,d,f,h,j,n,m; + + String u,p,c,z,menu,ch1,menu1; + boolean flag = false; + String uorg="Anushree"; + String porg="saga123"; + //signUp s=new signUp(); + logins l=new logins(); + pQueue pQ=new pQueue(); + System.out.println("Select Your Role "); + System.out.println("1]Admin\n2]User"); + a=sc.nextInt(); + switch(a) + { + case 1: + do { + System.out.println("Enter your username and password"); + u=sc.next(); + System.out.println("Enter your Password"); + p=sc.next(); + if(u.equals(uorg)&& p.equals(porg)) + { + System.out.println("Welcome Admin"); + flag=true; + } + else + System.out.println("Wrong pasword or username please try again"); + + } + while(flag==false); + do { + System.out.println("HELLO ADMIN!"); + System.out.println("**********************MENU*******************"); + System.out.println("1]View planned events\n2]Append event list"); + m=sc.nextInt(); + switch(m) + { + + case 1: + + pQ.dispadmin(); + break; + + + case 2: + + + pQ.addJan(); + + + break; + } + System.out.println("Return back to menu?"); + menu1=sc.next(); + } + + while(menu1.equals("yes")); + + break; + + + case 2: + do{ + System.out.println("Press 1 to login and 2 to Signup"); + ch=sc.nextInt(); + + switch(ch) + { + case 1: + + while(true) { + System.out.println("Enter username: "); + String usernames = sc.next(); + System.out.println("Enter password: "); + String passwords= sc.next(); + if (l.authenticate(usernames, passwords)) { + System.out.println("Authentication successful! Welcome, " + usernames + "!"); + break; + } else { + System.out.println("Invalid username or password. Please try again."); + } + + } + do { + System.out.println("WELCOME!"); + System.out.println("Please select one of the following preferences"); + System.out.println("1]View the Events\n2]Do give us your feedback\n3]We accept donations"); + int logch=sc.nextInt(); + switch(logch) + { + case 1: + pQ.displayPQ(); + + break; + case 2: + + System.out.println("Please provide your rating (1-5): "); + int rating = sc.nextInt(); + + + sc.nextLine(); + System.out.println("Please provide your comments: "); + String comments = sc.nextLine(); + + feedback feedback = new feedback(rating, comments); + + + System.out.println("\nThank you for your feedback:"); + feedback.displayFeedback(); + break; + case 3: + System.out.println("Would you like to donate cash? (yes/no)"); + String response = sc.next(); + double amount,donations=10000; + if (response.equals("yes")) { + // If yes, prompt for the amount + System.out.println("How much would you like to donate?"); + amount = sc.nextDouble(); + System.out.println("Thank you for donating Rs. " + amount); + donations=donations+amount; + // Here you can proceed with further actions like processing the donation + } else if (response.equals("no")) { + System.out.println("Thank you for considering!"); + } else { + System.out.println("Invalid response. Please enter 'yes' or 'no'."); + } + System.out.println("Donations received uptil now "+donations); + + + + break; + } + System.out.println("Return back to menu?"); + menu=sc.next(); + + }while(menu.equals("yes")); + + break; + case 2: + + System.out.println("Welcome to the Sign-up Page"); + Boolean continues=true; + while (continues) { + System.out.println("Enter username: "); + String username = sc.next(); + + System.out.println("Enter password: "); + String password = sc.next(); + + boolean success = l.signUp(username, password); + System.out.println("Do you want to sign up another user? (yes/no): "); + String input = sc.next(); + if (input.equals("no")) { + continues= false; + } + } + break; + } + System.out.println("Do you wish to continue?"); + ch1=sc.next(); + } while(ch1.equalsIgnoreCase("yes")); + + + + + + } + System.out.println("THANKYOU!DO VISIT AGAIN"); + } +} + + + + + diff --git a/event.java b/event.java new file mode 100644 index 0000000..729200f --- /dev/null +++ b/event.java @@ -0,0 +1,29 @@ +package Buffer; + +public class event implements Comparable{ + int date; + String name; + String location; + public event(int date,String name,String location) { + this.name=name; + this.date = date; + this.location=location; + } + + @Override + public int compareTo(event o) { + // TODO Auto-generated method stub + if(dateo.date) + return 1; + return 0; + } + + public String toString() + { + String result="Event:" +name+" Date-"+date+" Location-"+location; + return result; + } +} + diff --git a/feedback.java b/feedback.java new file mode 100644 index 0000000..f4947b1 --- /dev/null +++ b/feedback.java @@ -0,0 +1,19 @@ +package Buffer; + +public class feedback { + + private int rating; + private String comments; + + // Constructor + public feedback(int rating, String comments) { + this.rating = rating; + this.comments = comments; + +} + public void displayFeedback() { + System.out.println("Rating: " + rating); + System.out.println("Comments: " + comments); +} +} + diff --git a/logins.java b/logins.java new file mode 100644 index 0000000..00b496a --- /dev/null +++ b/logins.java @@ -0,0 +1,22 @@ +package Buffer; + +public class logins extends signUp{ + /* public void authenticate(String usernames, String passwords) { + // Check if the username exists in the HashMap + if (users.containsKey(usernames)) { + //String p=users.get(usernames); + //if(p.equals(passwords)) + //{ + //System.out.println("login succuessful!"); + //} + }*/ + public boolean authenticate(String username, String password) { + if (users.containsKey(username)) { + return users.get(username).equals(password); + } + return false; + } + + + } + diff --git a/pQueue.java b/pQueue.java new file mode 100644 index 0000000..f70a651 --- /dev/null +++ b/pQueue.java @@ -0,0 +1,137 @@ +package Buffer; +import java.util.*; +import Buffer.event; + +public class pQueue { + static ArrayList cleanupdrive11List=new ArrayList<>(); + static ArrayList treeplantationdrive20List=new ArrayList<>(); + static PriorityQueue pqJan=new PriorityQueue<>(); + + public static void addJan(){ + Scanner sc=new Scanner(System.in); + String b; + String a; + String z; + String y; + int x; + int c; + + + + + do { + System.out.println("Do you wish to insert more events say yes or no"); + a=sc.next(); + if(a.equals("yes")) + { + System.out.println("Enter the event"); + z=sc.next(); + System.out.println("Enter the date"); + x=sc.nextInt(); + System.out.println("Enter the location"); + y=sc.next(); + + pqJan.add(new event(x,z,y)); + + } + }while (a.equals("yes")); + dispadmin() ; + } + public static void displayPQ() { + pqJan.add(new event(11,"Cleanup-Drive","Bhusari Colony")); + pqJan.add(new event(20,"Tree Plantation Drive","ARAI ")); + Scanner sc=new Scanner(System.in); +Iterator itr=pqJan.iterator(); +System.out.println("Following are the events "); + while(itr.hasNext()) + { + System.out.println(pqJan.poll().toString()); + } +System.out.println("Do you wish to register for any of these"); +String choice=sc.next(); + if(choice.equalsIgnoreCase("yes")) + { + System.out.println("Please enter the event number"); + int event=sc.nextInt(); + if(event==1) { + System.out.println("Enter email: "); + String email = sc.next(); + System.out.println("Enter name: "); + String name = sc.next(); + System.out.println("Enter surname: "); + String surname = sc.next(); + System.out.println("Enter phone number: "); + double phoneNumber = sc.nextDouble(); + user user1=new user(email, name, phoneNumber,surname); + cleanupdrive11List.add(user1); + System.out.println("Person registered successfully!"); + } + else if(event==2) { + System.out.println("Enter email: "); + String email = sc.next(); + System.out.println("Enter name: "); + String name = sc.next(); + System.out.println("Enter surname: "); + String surname = sc.next(); + System.out.println("Enter phone number: "); + double phoneNumber = sc.nextDouble(); + user user1=new user(email, name, phoneNumber,surname); + treeplantationdrive20List.add(user1); + System.out.println("Person registered successfully!"); + } + } + +} + +public static void displayCleanup() { + cleanupdrive11List.add(new user("anush.bomble@gmail.com","Anu",34567765,"Bobde")); + cleanupdrive11List.add(new user("anu.bomble@gmail.com","Anushree",345678765,"Bomble")); + Iterator list= cleanupdrive11List.iterator(); + System.out.println("Following are the names of registered people for Cleanup Drive "); + while(list.hasNext()) + { + user n=(user) list.next(); + System.out.println(n.toString()); + } +} + +public String toString(String email, String name, double phoneNumber,String surname) +{ + + return "Email: " + email + ", Name: " + name + ", Phone Number: " + phoneNumber + ", Surname: " + surname; + + +} +public static void displayTreeplatation() { + treeplantationdrive20List.add(new user("anush.bomble@gmail.com","Anu",34567765,"Bobde")); + treeplantationdrive20List.add(new user("anu.bomble@gmail.com","Anushree",345678765,"Bomble")); + Iterator list= treeplantationdrive20List.iterator(); + System.out.println("Following are the names of registered people for Tree Plantation Drive "); + while(list.hasNext()) + { + + user n=(user) list.next(); + System.out.println(n.toString()); + } +} + +public static void dispadmin() { + pqJan.add(new event(11,"Cleanup-Drive","Bhusari Colony")); + pqJan.add(new event(20,"Tree Plantation Drive","ARAI ")); + Scanner sc=new Scanner(System.in); +Iterator itr=pqJan.iterator(); +System.out.println("Following are the events "); +while(itr.hasNext()) +{ + System.out.println(pqJan.poll().toString()); +} +} +} + + + + + + + + diff --git a/signUp.java b/signUp.java new file mode 100644 index 0000000..f328c6d --- /dev/null +++ b/signUp.java @@ -0,0 +1,18 @@ +package Buffer; +import java.util.HashMap; +import java.util.*; +public class signUp { + public HashMap users=new HashMap<>(); + public boolean signUp(String username, String password) +{ + if (users.containsKey(username)) { + System.out.println("Username already exists. Please choose a different username."); + return false; + } else { + users.put(username, password); + System.out.println("Sign-up successful! You can now log in with your credentials."); + return true; + } + } +} + From f4e6eef81678ad1e6be956b881b03470c09eea74 Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:44:47 +0530 Subject: [PATCH 03/15] Update README.md From 2368f9f12643d85d56c858370582e9cae116923e Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:50:32 +0530 Subject: [PATCH 04/15] Delete Main.java --- Main.java | 185 ------------------------------------------------------ 1 file changed, 185 deletions(-) delete mode 100644 Main.java diff --git a/Main.java b/Main.java deleted file mode 100644 index f478836..0000000 --- a/Main.java +++ /dev/null @@ -1,185 +0,0 @@ -package Buffer; -import java.util.HashMap; -import java.util.Map; -import java.util.Scanner; - -public class Main { - public static void main(String[] args) { - // TODO Auto-generated method stub - Scanner sc=new Scanner(System.in); - - int ch,a,b,x,d,f,h,j,n,m; - - String u,p,c,z,menu,ch1,menu1; - boolean flag = false; - String uorg="Anushree"; - String porg="saga123"; - //signUp s=new signUp(); - logins l=new logins(); - pQueue pQ=new pQueue(); - System.out.println("Select Your Role "); - System.out.println("1]Admin\n2]User"); - a=sc.nextInt(); - switch(a) - { - case 1: - do { - System.out.println("Enter your username and password"); - u=sc.next(); - System.out.println("Enter your Password"); - p=sc.next(); - if(u.equals(uorg)&& p.equals(porg)) - { - System.out.println("Welcome Admin"); - flag=true; - } - else - System.out.println("Wrong pasword or username please try again"); - - } - while(flag==false); - do { - System.out.println("HELLO ADMIN!"); - System.out.println("**********************MENU*******************"); - System.out.println("1]View planned events\n2]Append event list"); - m=sc.nextInt(); - switch(m) - { - - case 1: - - pQ.dispadmin(); - break; - - - case 2: - - - pQ.addJan(); - - - break; - } - System.out.println("Return back to menu?"); - menu1=sc.next(); - } - - while(menu1.equals("yes")); - - break; - - - case 2: - do{ - System.out.println("Press 1 to login and 2 to Signup"); - ch=sc.nextInt(); - - switch(ch) - { - case 1: - - while(true) { - System.out.println("Enter username: "); - String usernames = sc.next(); - System.out.println("Enter password: "); - String passwords= sc.next(); - if (l.authenticate(usernames, passwords)) { - System.out.println("Authentication successful! Welcome, " + usernames + "!"); - break; - } else { - System.out.println("Invalid username or password. Please try again."); - } - - } - do { - System.out.println("WELCOME!"); - System.out.println("Please select one of the following preferences"); - System.out.println("1]View the Events\n2]Do give us your feedback\n3]We accept donations"); - int logch=sc.nextInt(); - switch(logch) - { - case 1: - pQ.displayPQ(); - - break; - case 2: - - System.out.println("Please provide your rating (1-5): "); - int rating = sc.nextInt(); - - - sc.nextLine(); - System.out.println("Please provide your comments: "); - String comments = sc.nextLine(); - - feedback feedback = new feedback(rating, comments); - - - System.out.println("\nThank you for your feedback:"); - feedback.displayFeedback(); - break; - case 3: - System.out.println("Would you like to donate cash? (yes/no)"); - String response = sc.next(); - double amount,donations=10000; - if (response.equals("yes")) { - // If yes, prompt for the amount - System.out.println("How much would you like to donate?"); - amount = sc.nextDouble(); - System.out.println("Thank you for donating Rs. " + amount); - donations=donations+amount; - // Here you can proceed with further actions like processing the donation - } else if (response.equals("no")) { - System.out.println("Thank you for considering!"); - } else { - System.out.println("Invalid response. Please enter 'yes' or 'no'."); - } - System.out.println("Donations received uptil now "+donations); - - - - break; - } - System.out.println("Return back to menu?"); - menu=sc.next(); - - }while(menu.equals("yes")); - - break; - case 2: - - System.out.println("Welcome to the Sign-up Page"); - Boolean continues=true; - while (continues) { - System.out.println("Enter username: "); - String username = sc.next(); - - System.out.println("Enter password: "); - String password = sc.next(); - - boolean success = l.signUp(username, password); - System.out.println("Do you want to sign up another user? (yes/no): "); - String input = sc.next(); - if (input.equals("no")) { - continues= false; - } - } - break; - } - System.out.println("Do you wish to continue?"); - ch1=sc.next(); - } while(ch1.equalsIgnoreCase("yes")); - - - - - - } - System.out.println("THANKYOU!DO VISIT AGAIN"); - } -} - - - - - From 9bc383dff926444a8807bd7d1d860e051c197679 Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:50:49 +0530 Subject: [PATCH 05/15] Delete event.java --- event.java | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 event.java diff --git a/event.java b/event.java deleted file mode 100644 index 729200f..0000000 --- a/event.java +++ /dev/null @@ -1,29 +0,0 @@ -package Buffer; - -public class event implements Comparable{ - int date; - String name; - String location; - public event(int date,String name,String location) { - this.name=name; - this.date = date; - this.location=location; - } - - @Override - public int compareTo(event o) { - // TODO Auto-generated method stub - if(dateo.date) - return 1; - return 0; - } - - public String toString() - { - String result="Event:" +name+" Date-"+date+" Location-"+location; - return result; - } -} - From 616d21ca80dc0da174f43817158e86553a59d014 Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:51:04 +0530 Subject: [PATCH 06/15] Delete feedback.java --- feedback.java | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 feedback.java diff --git a/feedback.java b/feedback.java deleted file mode 100644 index f4947b1..0000000 --- a/feedback.java +++ /dev/null @@ -1,19 +0,0 @@ -package Buffer; - -public class feedback { - - private int rating; - private String comments; - - // Constructor - public feedback(int rating, String comments) { - this.rating = rating; - this.comments = comments; - -} - public void displayFeedback() { - System.out.println("Rating: " + rating); - System.out.println("Comments: " + comments); -} -} - From 3e1d111ee6fe82b951154517880cb57119e941ac Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:51:16 +0530 Subject: [PATCH 07/15] Delete logins.java --- logins.java | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 logins.java diff --git a/logins.java b/logins.java deleted file mode 100644 index 00b496a..0000000 --- a/logins.java +++ /dev/null @@ -1,22 +0,0 @@ -package Buffer; - -public class logins extends signUp{ - /* public void authenticate(String usernames, String passwords) { - // Check if the username exists in the HashMap - if (users.containsKey(usernames)) { - //String p=users.get(usernames); - //if(p.equals(passwords)) - //{ - //System.out.println("login succuessful!"); - //} - }*/ - public boolean authenticate(String username, String password) { - if (users.containsKey(username)) { - return users.get(username).equals(password); - } - return false; - } - - - } - From 66d34a59a03ace8b5ad523b9cda2ab01e8c08917 Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:51:32 +0530 Subject: [PATCH 08/15] Delete pQueue.java --- pQueue.java | 137 ---------------------------------------------------- 1 file changed, 137 deletions(-) delete mode 100644 pQueue.java diff --git a/pQueue.java b/pQueue.java deleted file mode 100644 index f70a651..0000000 --- a/pQueue.java +++ /dev/null @@ -1,137 +0,0 @@ -package Buffer; -import java.util.*; -import Buffer.event; - -public class pQueue { - static ArrayList cleanupdrive11List=new ArrayList<>(); - static ArrayList treeplantationdrive20List=new ArrayList<>(); - static PriorityQueue pqJan=new PriorityQueue<>(); - - public static void addJan(){ - Scanner sc=new Scanner(System.in); - String b; - String a; - String z; - String y; - int x; - int c; - - - - - do { - System.out.println("Do you wish to insert more events say yes or no"); - a=sc.next(); - if(a.equals("yes")) - { - System.out.println("Enter the event"); - z=sc.next(); - System.out.println("Enter the date"); - x=sc.nextInt(); - System.out.println("Enter the location"); - y=sc.next(); - - pqJan.add(new event(x,z,y)); - - } - }while (a.equals("yes")); - dispadmin() ; - } - public static void displayPQ() { - pqJan.add(new event(11,"Cleanup-Drive","Bhusari Colony")); - pqJan.add(new event(20,"Tree Plantation Drive","ARAI ")); - Scanner sc=new Scanner(System.in); -Iterator itr=pqJan.iterator(); -System.out.println("Following are the events "); - while(itr.hasNext()) - { - System.out.println(pqJan.poll().toString()); - } -System.out.println("Do you wish to register for any of these"); -String choice=sc.next(); - if(choice.equalsIgnoreCase("yes")) - { - System.out.println("Please enter the event number"); - int event=sc.nextInt(); - if(event==1) { - System.out.println("Enter email: "); - String email = sc.next(); - System.out.println("Enter name: "); - String name = sc.next(); - System.out.println("Enter surname: "); - String surname = sc.next(); - System.out.println("Enter phone number: "); - double phoneNumber = sc.nextDouble(); - user user1=new user(email, name, phoneNumber,surname); - cleanupdrive11List.add(user1); - System.out.println("Person registered successfully!"); - } - else if(event==2) { - System.out.println("Enter email: "); - String email = sc.next(); - System.out.println("Enter name: "); - String name = sc.next(); - System.out.println("Enter surname: "); - String surname = sc.next(); - System.out.println("Enter phone number: "); - double phoneNumber = sc.nextDouble(); - user user1=new user(email, name, phoneNumber,surname); - treeplantationdrive20List.add(user1); - System.out.println("Person registered successfully!"); - } - } - -} - -public static void displayCleanup() { - cleanupdrive11List.add(new user("anush.bomble@gmail.com","Anu",34567765,"Bobde")); - cleanupdrive11List.add(new user("anu.bomble@gmail.com","Anushree",345678765,"Bomble")); - Iterator list= cleanupdrive11List.iterator(); - System.out.println("Following are the names of registered people for Cleanup Drive "); - while(list.hasNext()) - { - user n=(user) list.next(); - System.out.println(n.toString()); - } -} - -public String toString(String email, String name, double phoneNumber,String surname) -{ - - return "Email: " + email + ", Name: " + name + ", Phone Number: " + phoneNumber + ", Surname: " + surname; - - -} -public static void displayTreeplatation() { - treeplantationdrive20List.add(new user("anush.bomble@gmail.com","Anu",34567765,"Bobde")); - treeplantationdrive20List.add(new user("anu.bomble@gmail.com","Anushree",345678765,"Bomble")); - Iterator list= treeplantationdrive20List.iterator(); - System.out.println("Following are the names of registered people for Tree Plantation Drive "); - while(list.hasNext()) - { - - user n=(user) list.next(); - System.out.println(n.toString()); - } -} - -public static void dispadmin() { - pqJan.add(new event(11,"Cleanup-Drive","Bhusari Colony")); - pqJan.add(new event(20,"Tree Plantation Drive","ARAI ")); - Scanner sc=new Scanner(System.in); -Iterator itr=pqJan.iterator(); -System.out.println("Following are the events "); -while(itr.hasNext()) -{ - System.out.println(pqJan.poll().toString()); -} -} -} - - - - - - - - From 694bc6eed8c03cac31e03a186ff597107fa4fd92 Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:51:43 +0530 Subject: [PATCH 09/15] Delete signUp.java --- signUp.java | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 signUp.java diff --git a/signUp.java b/signUp.java deleted file mode 100644 index f328c6d..0000000 --- a/signUp.java +++ /dev/null @@ -1,18 +0,0 @@ -package Buffer; -import java.util.HashMap; -import java.util.*; -public class signUp { - public HashMap users=new HashMap<>(); - public boolean signUp(String username, String password) -{ - if (users.containsKey(username)) { - System.out.println("Username already exists. Please choose a different username."); - return false; - } else { - users.put(username, password); - System.out.println("Sign-up successful! You can now log in with your credentials."); - return true; - } - } -} - From 4045dec62c0788667e8e7e32fbfa2c0fb1e41604 Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Mon, 29 Apr 2024 23:51:57 +0530 Subject: [PATCH 10/15] Delete user.java --- user.java | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 user.java diff --git a/user.java b/user.java deleted file mode 100644 index 13fb19d..0000000 --- a/user.java +++ /dev/null @@ -1,44 +0,0 @@ -package Buffer; - -import java.util.ArrayList; - -public class user { - private String email; - private String name; - private String surname; - private double phoneNumber; - - public user(String email, String name, double phoneNumber,String surname) { - this.email = email; - this.name = name; - this.phoneNumber = phoneNumber; - this.surname = name; -} - -public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public double getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(double phoneNumber) { - this.phoneNumber = phoneNumber; - } - - -} - From 504fed56d473035d63e0b12731a3ce68ccd2514e Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Tue, 30 Apr 2024 00:41:32 +0530 Subject: [PATCH 11/15] Create README.md --- 77-Community Event scheduler/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 77-Community Event scheduler/README.md diff --git a/77-Community Event scheduler/README.md b/77-Community Event scheduler/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/77-Community Event scheduler/README.md @@ -0,0 +1 @@ + From d2ab280b66a8c149969e18c05ecf9e8dfce70ffb Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Tue, 30 Apr 2024 00:44:31 +0530 Subject: [PATCH 12/15] Add files via upload --- 77-Community Event scheduler/Main.java | 185 +++++++++++++++++++++ 77-Community Event scheduler/event.java | 29 ++++ 77-Community Event scheduler/feedback.java | 19 +++ 77-Community Event scheduler/logins.java | 22 +++ 77-Community Event scheduler/pQueue.java | 137 +++++++++++++++ 77-Community Event scheduler/signUp.java | 18 ++ 77-Community Event scheduler/user.java | 44 +++++ 7 files changed, 454 insertions(+) create mode 100644 77-Community Event scheduler/Main.java create mode 100644 77-Community Event scheduler/event.java create mode 100644 77-Community Event scheduler/feedback.java create mode 100644 77-Community Event scheduler/logins.java create mode 100644 77-Community Event scheduler/pQueue.java create mode 100644 77-Community Event scheduler/signUp.java create mode 100644 77-Community Event scheduler/user.java diff --git a/77-Community Event scheduler/Main.java b/77-Community Event scheduler/Main.java new file mode 100644 index 0000000..f478836 --- /dev/null +++ b/77-Community Event scheduler/Main.java @@ -0,0 +1,185 @@ +package Buffer; +import java.util.HashMap; +import java.util.Map; +import java.util.Scanner; + +public class Main { + public static void main(String[] args) { + // TODO Auto-generated method stub + Scanner sc=new Scanner(System.in); + + int ch,a,b,x,d,f,h,j,n,m; + + String u,p,c,z,menu,ch1,menu1; + boolean flag = false; + String uorg="Anushree"; + String porg="saga123"; + //signUp s=new signUp(); + logins l=new logins(); + pQueue pQ=new pQueue(); + System.out.println("Select Your Role "); + System.out.println("1]Admin\n2]User"); + a=sc.nextInt(); + switch(a) + { + case 1: + do { + System.out.println("Enter your username and password"); + u=sc.next(); + System.out.println("Enter your Password"); + p=sc.next(); + if(u.equals(uorg)&& p.equals(porg)) + { + System.out.println("Welcome Admin"); + flag=true; + } + else + System.out.println("Wrong pasword or username please try again"); + + } + while(flag==false); + do { + System.out.println("HELLO ADMIN!"); + System.out.println("**********************MENU*******************"); + System.out.println("1]View planned events\n2]Append event list"); + m=sc.nextInt(); + switch(m) + { + + case 1: + + pQ.dispadmin(); + break; + + + case 2: + + + pQ.addJan(); + + + break; + } + System.out.println("Return back to menu?"); + menu1=sc.next(); + } + + while(menu1.equals("yes")); + + break; + + + case 2: + do{ + System.out.println("Press 1 to login and 2 to Signup"); + ch=sc.nextInt(); + + switch(ch) + { + case 1: + + while(true) { + System.out.println("Enter username: "); + String usernames = sc.next(); + System.out.println("Enter password: "); + String passwords= sc.next(); + if (l.authenticate(usernames, passwords)) { + System.out.println("Authentication successful! Welcome, " + usernames + "!"); + break; + } else { + System.out.println("Invalid username or password. Please try again."); + } + + } + do { + System.out.println("WELCOME!"); + System.out.println("Please select one of the following preferences"); + System.out.println("1]View the Events\n2]Do give us your feedback\n3]We accept donations"); + int logch=sc.nextInt(); + switch(logch) + { + case 1: + pQ.displayPQ(); + + break; + case 2: + + System.out.println("Please provide your rating (1-5): "); + int rating = sc.nextInt(); + + + sc.nextLine(); + System.out.println("Please provide your comments: "); + String comments = sc.nextLine(); + + feedback feedback = new feedback(rating, comments); + + + System.out.println("\nThank you for your feedback:"); + feedback.displayFeedback(); + break; + case 3: + System.out.println("Would you like to donate cash? (yes/no)"); + String response = sc.next(); + double amount,donations=10000; + if (response.equals("yes")) { + // If yes, prompt for the amount + System.out.println("How much would you like to donate?"); + amount = sc.nextDouble(); + System.out.println("Thank you for donating Rs. " + amount); + donations=donations+amount; + // Here you can proceed with further actions like processing the donation + } else if (response.equals("no")) { + System.out.println("Thank you for considering!"); + } else { + System.out.println("Invalid response. Please enter 'yes' or 'no'."); + } + System.out.println("Donations received uptil now "+donations); + + + + break; + } + System.out.println("Return back to menu?"); + menu=sc.next(); + + }while(menu.equals("yes")); + + break; + case 2: + + System.out.println("Welcome to the Sign-up Page"); + Boolean continues=true; + while (continues) { + System.out.println("Enter username: "); + String username = sc.next(); + + System.out.println("Enter password: "); + String password = sc.next(); + + boolean success = l.signUp(username, password); + System.out.println("Do you want to sign up another user? (yes/no): "); + String input = sc.next(); + if (input.equals("no")) { + continues= false; + } + } + break; + } + System.out.println("Do you wish to continue?"); + ch1=sc.next(); + } while(ch1.equalsIgnoreCase("yes")); + + + + + + } + System.out.println("THANKYOU!DO VISIT AGAIN"); + } +} + + + + + diff --git a/77-Community Event scheduler/event.java b/77-Community Event scheduler/event.java new file mode 100644 index 0000000..729200f --- /dev/null +++ b/77-Community Event scheduler/event.java @@ -0,0 +1,29 @@ +package Buffer; + +public class event implements Comparable{ + int date; + String name; + String location; + public event(int date,String name,String location) { + this.name=name; + this.date = date; + this.location=location; + } + + @Override + public int compareTo(event o) { + // TODO Auto-generated method stub + if(dateo.date) + return 1; + return 0; + } + + public String toString() + { + String result="Event:" +name+" Date-"+date+" Location-"+location; + return result; + } +} + diff --git a/77-Community Event scheduler/feedback.java b/77-Community Event scheduler/feedback.java new file mode 100644 index 0000000..f4947b1 --- /dev/null +++ b/77-Community Event scheduler/feedback.java @@ -0,0 +1,19 @@ +package Buffer; + +public class feedback { + + private int rating; + private String comments; + + // Constructor + public feedback(int rating, String comments) { + this.rating = rating; + this.comments = comments; + +} + public void displayFeedback() { + System.out.println("Rating: " + rating); + System.out.println("Comments: " + comments); +} +} + diff --git a/77-Community Event scheduler/logins.java b/77-Community Event scheduler/logins.java new file mode 100644 index 0000000..00b496a --- /dev/null +++ b/77-Community Event scheduler/logins.java @@ -0,0 +1,22 @@ +package Buffer; + +public class logins extends signUp{ + /* public void authenticate(String usernames, String passwords) { + // Check if the username exists in the HashMap + if (users.containsKey(usernames)) { + //String p=users.get(usernames); + //if(p.equals(passwords)) + //{ + //System.out.println("login succuessful!"); + //} + }*/ + public boolean authenticate(String username, String password) { + if (users.containsKey(username)) { + return users.get(username).equals(password); + } + return false; + } + + + } + diff --git a/77-Community Event scheduler/pQueue.java b/77-Community Event scheduler/pQueue.java new file mode 100644 index 0000000..f70a651 --- /dev/null +++ b/77-Community Event scheduler/pQueue.java @@ -0,0 +1,137 @@ +package Buffer; +import java.util.*; +import Buffer.event; + +public class pQueue { + static ArrayList cleanupdrive11List=new ArrayList<>(); + static ArrayList treeplantationdrive20List=new ArrayList<>(); + static PriorityQueue pqJan=new PriorityQueue<>(); + + public static void addJan(){ + Scanner sc=new Scanner(System.in); + String b; + String a; + String z; + String y; + int x; + int c; + + + + + do { + System.out.println("Do you wish to insert more events say yes or no"); + a=sc.next(); + if(a.equals("yes")) + { + System.out.println("Enter the event"); + z=sc.next(); + System.out.println("Enter the date"); + x=sc.nextInt(); + System.out.println("Enter the location"); + y=sc.next(); + + pqJan.add(new event(x,z,y)); + + } + }while (a.equals("yes")); + dispadmin() ; + } + public static void displayPQ() { + pqJan.add(new event(11,"Cleanup-Drive","Bhusari Colony")); + pqJan.add(new event(20,"Tree Plantation Drive","ARAI ")); + Scanner sc=new Scanner(System.in); +Iterator itr=pqJan.iterator(); +System.out.println("Following are the events "); + while(itr.hasNext()) + { + System.out.println(pqJan.poll().toString()); + } +System.out.println("Do you wish to register for any of these"); +String choice=sc.next(); + if(choice.equalsIgnoreCase("yes")) + { + System.out.println("Please enter the event number"); + int event=sc.nextInt(); + if(event==1) { + System.out.println("Enter email: "); + String email = sc.next(); + System.out.println("Enter name: "); + String name = sc.next(); + System.out.println("Enter surname: "); + String surname = sc.next(); + System.out.println("Enter phone number: "); + double phoneNumber = sc.nextDouble(); + user user1=new user(email, name, phoneNumber,surname); + cleanupdrive11List.add(user1); + System.out.println("Person registered successfully!"); + } + else if(event==2) { + System.out.println("Enter email: "); + String email = sc.next(); + System.out.println("Enter name: "); + String name = sc.next(); + System.out.println("Enter surname: "); + String surname = sc.next(); + System.out.println("Enter phone number: "); + double phoneNumber = sc.nextDouble(); + user user1=new user(email, name, phoneNumber,surname); + treeplantationdrive20List.add(user1); + System.out.println("Person registered successfully!"); + } + } + +} + +public static void displayCleanup() { + cleanupdrive11List.add(new user("anush.bomble@gmail.com","Anu",34567765,"Bobde")); + cleanupdrive11List.add(new user("anu.bomble@gmail.com","Anushree",345678765,"Bomble")); + Iterator list= cleanupdrive11List.iterator(); + System.out.println("Following are the names of registered people for Cleanup Drive "); + while(list.hasNext()) + { + user n=(user) list.next(); + System.out.println(n.toString()); + } +} + +public String toString(String email, String name, double phoneNumber,String surname) +{ + + return "Email: " + email + ", Name: " + name + ", Phone Number: " + phoneNumber + ", Surname: " + surname; + + +} +public static void displayTreeplatation() { + treeplantationdrive20List.add(new user("anush.bomble@gmail.com","Anu",34567765,"Bobde")); + treeplantationdrive20List.add(new user("anu.bomble@gmail.com","Anushree",345678765,"Bomble")); + Iterator list= treeplantationdrive20List.iterator(); + System.out.println("Following are the names of registered people for Tree Plantation Drive "); + while(list.hasNext()) + { + + user n=(user) list.next(); + System.out.println(n.toString()); + } +} + +public static void dispadmin() { + pqJan.add(new event(11,"Cleanup-Drive","Bhusari Colony")); + pqJan.add(new event(20,"Tree Plantation Drive","ARAI ")); + Scanner sc=new Scanner(System.in); +Iterator itr=pqJan.iterator(); +System.out.println("Following are the events "); +while(itr.hasNext()) +{ + System.out.println(pqJan.poll().toString()); +} +} +} + + + + + + + + diff --git a/77-Community Event scheduler/signUp.java b/77-Community Event scheduler/signUp.java new file mode 100644 index 0000000..f328c6d --- /dev/null +++ b/77-Community Event scheduler/signUp.java @@ -0,0 +1,18 @@ +package Buffer; +import java.util.HashMap; +import java.util.*; +public class signUp { + public HashMap users=new HashMap<>(); + public boolean signUp(String username, String password) +{ + if (users.containsKey(username)) { + System.out.println("Username already exists. Please choose a different username."); + return false; + } else { + users.put(username, password); + System.out.println("Sign-up successful! You can now log in with your credentials."); + return true; + } + } +} + diff --git a/77-Community Event scheduler/user.java b/77-Community Event scheduler/user.java new file mode 100644 index 0000000..13fb19d --- /dev/null +++ b/77-Community Event scheduler/user.java @@ -0,0 +1,44 @@ +package Buffer; + +import java.util.ArrayList; + +public class user { + private String email; + private String name; + private String surname; + private double phoneNumber; + + public user(String email, String name, double phoneNumber,String surname) { + this.email = email; + this.name = name; + this.phoneNumber = phoneNumber; + this.surname = name; +} + +public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(double phoneNumber) { + this.phoneNumber = phoneNumber; + } + + +} + From 9136f0f4ed1f20e2eac56a3fe49309ef2078529c Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Tue, 30 Apr 2024 00:46:17 +0530 Subject: [PATCH 13/15] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 910ff0f..f481b03 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,6 @@ Buffer is a Data Structures and Algorithms Project Series, in which students can 4. Custom Data structure This repository is created for all the teams to be able to upload their final project source code. While submitting, note that all the submission guidelines given are followed, and all the files are named appropiately. Also ensure that your README file contains the links of the progress reports and the drive link containing the video of the project. +Drive link for video and 15 days report: +https://drive.google.com/drive/folders/1zF1_s6SUqttUeKGlfqealKUvc9Lxzkbf?q=sharedwith:public%20parent:1zF1_s6SUqttUeKGlfqealKUvc9Lxzkbf + From 099e0fc6a6f19ce0b747d58094a9c106ed4d6083 Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Tue, 30 Apr 2024 00:46:38 +0530 Subject: [PATCH 14/15] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f481b03..738a2d4 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ Buffer is a Data Structures and Algorithms Project Series, in which students can 4. Custom Data structure This repository is created for all the teams to be able to upload their final project source code. While submitting, note that all the submission guidelines given are followed, and all the files are named appropiately. Also ensure that your README file contains the links of the progress reports and the drive link containing the video of the project. + Drive link for video and 15 days report: https://drive.google.com/drive/folders/1zF1_s6SUqttUeKGlfqealKUvc9Lxzkbf?q=sharedwith:public%20parent:1zF1_s6SUqttUeKGlfqealKUvc9Lxzkbf From 438a22cdf0c510de8eec026a93368048429574c4 Mon Sep 17 00:00:00 2001 From: khushiagr123 <106469130+khushiagr123@users.noreply.github.com> Date: Tue, 30 Apr 2024 00:48:35 +0530 Subject: [PATCH 15/15] Update README.md --- README.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/README.md b/README.md index 738a2d4..72dd6ab 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,7 @@ # Buffer-5.0 Buffer is a Data Structures and Algorithms Project Series, in which students can participate as mentees in teams of 2-4. Under Buffer 5.0, the themes on which students can create a project are: -1. Public Welfare -2. Tourism -3. College level applications -4. Custom Data structure - -This repository is created for all the teams to be able to upload their final project source code. While submitting, note that all the submission guidelines given are followed, and all the files are named appropiately. Also ensure that your README file contains the links of the progress reports and the drive link containing the video of the project. +Theme- Public Welfare Drive link for video and 15 days report: https://drive.google.com/drive/folders/1zF1_s6SUqttUeKGlfqealKUvc9Lxzkbf?q=sharedwith:public%20parent:1zF1_s6SUqttUeKGlfqealKUvc9Lxzkbf