diff --git a/README.md b/README.md new file mode 100644 index 0000000..83c66b0 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# HacktoberFest2021-2 +A beginner-friendly project to help you in open-source contributions. Made specifically for contributions in HACKTOBERFEST 2021. Please leave a star ⭐ to support...… diff --git a/bookstore/bookdata.db b/bookstore/bookdata.db new file mode 100644 index 0000000..e9dc3b6 Binary files /dev/null and b/bookstore/bookdata.db differ diff --git a/bookstore/file1.py b/bookstore/file1.py new file mode 100644 index 0000000..f1cab2c --- /dev/null +++ b/bookstore/file1.py @@ -0,0 +1,60 @@ +import sqlite3 +con = sqlite3.connect('bookdata.db') +cur = con.cursor() + +def add(): + while (True): + try: + myid = int(input("Enter Id:\t")) + myname = input("Enter Title:\t ") + myauthor = input("Enter Author:\t ") + mymarks = int(input("Enter Price:\t ")) + cur.execute("INSERT INTO booklist(Book_id, Title, Author, Price) VALUES (?,?,?,?);",(myid, myname, myauthor, mymarks)) + con.commit() + print("You Succesfully Added data") + except: + print("You Entered some wrong Data ") + + user_choice2 = "" + while (user_choice2 != "c" and user_choice2 != "q"): + print("Press q to quit and c to If you want add more data") + user_choice2 = input("Enter") + if user_choice2 == "q": + exit() + elif user_choice2 == "c": + continue + else: + print(f" you write wrong \n{ user_choice2} is a not vaild optaion") + +def display(): + print("Book_id\t Title\t Author\t Price\n") + vv = cur.execute("SELECT * FROM booklist") + for i in vv: + print(i[0], "\t", i[1], "\t====>>", i[2], "\t", i[3]) + con.close() + +def Updating(): + print("here you can change price of any book") + user = input("Enter Title Which you want to update:") + cur.execute("SELECT price FROM booklist WHERE title='" +user+ "';") + record = cur.fetchone() + print(f"The old price of {user} book is {record}") + user2 = input("Now Enter new price :") + con.execute("UPDATE booklist SET price='"+user2+"' WHERE title='"+user+"' ") + con.commit() + print("Record updated sucessfully") + + +if __name__ == '__main__': + print("hello to VIVEK bookstroe database \nEnter Your choice ") + take = int(input("1 for Add \t 2 for Name of Books \t 3 for updating price\nYour choice:\t")) + if take==1 : + print(add()) + elif take==2 : + print(display()) + elif take == 3 : + print(Updating()) + else: + print("Error !!!. You entered wrong data ") + + diff --git a/bookstore/file4.py b/bookstore/file4.py new file mode 100644 index 0000000..5c13a6d --- /dev/null +++ b/bookstore/file4.py @@ -0,0 +1,34 @@ +import sqlite3 +con = sqlite3.connect("bookdata.db") +cur = con.cursor() +print("Welcome to VIVEK Bookstrore.") +while True: + + value = input("Enter book Title :") + sql = cur.execute("SELECT price FROM booklist WHERE title='" + value + "';") + record = cur.fetchone()[0] + if record == None: + print(f"Sorry sir currently not avilable! \nWe will try to get {value} book for you Next time") + else: + print(f"Yes Sir, we have it in stock. It costs Rs{record}. Would you like to take it?") + ask = int(input("1 for yes and 2 for No :")) + if ask == 1: + copies = int(input("How many copies :")) + print("Sure. Anything else, Sir?") + user_choice2 = "" + while (user_choice2 != "Yes" and user_choice2 != "No"): + user_choice2 = int(input("Enter :")) + if user_choice2 == "No": + amount =sum( record * copies) + print( f"Book Title :\t{value}\nPrice of Book:\t{record}\nTotal amount:\t{amount}\nThank you Sir, Visit again. Have a good day") + + elif user_choice2 == "Yes": + continue + + else: + print(f"you write wrong \n Yes & No is a not vaild optaion") + elif ask == 2: + print(f"Thanks for asking {value} book ") + + + diff --git a/find_word.java b/find_word.java new file mode 100644 index 0000000..f4e3f10 --- /dev/null +++ b/find_word.java @@ -0,0 +1,27 @@ +// WAP enter a sentence form keyboard and also find all the words in that +// sentence with starting character as vowel +import java.util.Scanner; +class Assginment2 +{ + public static void main(String[] arg) + { + String store="\n"; + char vowel=a; + Scanner sc=new Scanner(System.in); + System.out.print("Enter a string : "); + String take=sc.nextLine(); + String[] arr=take.split(" "); + for (String s : arr) + { + System.out.println(s); + int le=s.length(); + String[] arr2=new String[le]; + arr2= + if (arr2[0]==vowel) + { + store+=s; + } + } + System.out.println("These are the words which start with vowel : "+store); + } +}