Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookstore #193

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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...…
Binary file added bookstore/bookdata.db
Binary file not shown.
60 changes: 60 additions & 0 deletions bookstore/file1.py
Original file line number Diff line number Diff line change
@@ -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 ")


34 changes: 34 additions & 0 deletions bookstore/file4.py
Original file line number Diff line number Diff line change
@@ -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 ")



27 changes: 27 additions & 0 deletions find_word.java
Original file line number Diff line number Diff line change
@@ -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);
}
}