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/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 @@ + 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; + } + + +} + diff --git a/README.md b/README.md index 910ff0f..72dd6ab 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ # 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 +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 -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.