You are on page 1of 43

Login Window

//Import Package:
import java.sql.*;
import javax.swing.JOptionPane;

//Coding for Sign In:


String user=t1.getText();
String pwd=new String(p1.getPassword());

try
{
Class.forName("java.sql.Driver");

Page 1 of 43
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/legerit
","root","123");
Statement st=(Statement)con.createStatement();
String q="Select * from signup";
ResultSet rs=st.executeQuery(q);
while(rs.next())
{
String us=rs.getString("usernm");
String password=rs.getString("pass");
if((user.equals(us))&&(pwd.equals(password)))
{
new I4().setVisible(true);
this.setVisible(false);
}
}
con.close();
st.close();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}

//Coding for Sign Up:


new I3().setVisible(true);
this.setVisible(false);

Page 2 of 43
Create New Account Window

//Import Package:
import java.sql.*;
import javax.swing.JOptionPane;

//Coding form Confirm:


String fn=t2.getText();
String ln=t3.getText();
Page 3 of 43
int age=Integer.parseInt(t4.getText());
String un=t7.getText();
String pd=p2.getText();
try
{
Class.forName("java.sql.DriverManager");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/legerit
","root","123");
Statement st=(Statement)con.createStatement();
String q="INSERT INTO signup values('"+fn+"','"+ln+"',"+age+",'"+un+"','"+pd+"')";
int executeUpdate = st.executeUpdate(q);
con.close();
st.close();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}

//Coding for Sign in:


new I2().setVisible(true);
this.setVisible(false);

//Coding for Exit:


System.exit(0);

Page 4 of 43
Sign In Window

//Import Package:
import java.sql.*;
import javax.swing.JOptionPane;

//Coding for Sign In:


String user=usnm.getText();
String pwd=new String(pw.getPassword());

try
{
Class.forName("java.sql.Driver");

Page 5 of 43
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/legerit
","root","123");
Statement st=(Statement)con.createStatement();
String q="Select * from signup";
ResultSet rs=st.executeQuery(q);
while(rs.next())
{String us=rs.getString("usernm");
String password=rs.getString("pass");
if((user.equals(us))&&(pwd.equals(password)))
{
new I4().setVisible(true);
this.setVisible(false);
}
}
con.close();
st.close();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}

//Coding for Exit:


System.exit(0);

Page 6 of 43
Information Window

//Coding for Next:


new I5().setVisible(true);
this.setVisible(false);

//Coding for Exit:


System.exit(0);

Page 7 of 43
Procedure Window

//Coding for Exit:


System.exit(0);

//Coding for Next:

new I6().setVisible(true);
this.setVisible(false);

Page 8 of 43
Order Window

//Import Package:
import java.sql.*;
import javax.swing.table.DefaultTableModel;

//Coding for Add to cart:


String cbook="";
int i=0;
if(com.getSelectedIndex()==0)
cbook="Is Everyone Hanging Out Without Me ? Mindy Kaling";
else if(com.getSelectedIndex()==1)
cbook="Me Talk Pretty One Day David Sedaris";
else if(com.getSelectedIndex()==2)
cbook="The Ultimate Hitch Hiker's Guide To Galaxy Douglas Adams ";
else if(com.getSelectedIndex()==3)
cbook="One More Thing B.J. Novak";
else if(com.getSelectedIndex()==4)
Page 9 of 43
cbook=" Where'd You GO,Bernadete Maria Sampler";
else if(com.getSelectedIndex()==5)
cbook=" Bossy Pants Tina Fey";
else if(com.getSelectedIndex()==6)
cbook=" Hyperbole & a half Allie Broch";
else if(com.getSelectedIndex()==7)
cbook=" I Feel Bad About My Neck Nora Ephron";
else if(com.getSelectedIndex()==8)
cbook=" lamb Christopher Mooe";
else if(com.getSelectedIndex()==9)
cbook=" Yes Please Amy Poehler";
else if(com.getSelectedIndex()==10)
cbook="Paddler Your Own Canoe Nick Offerman";
else if(com.getSelectedIndex()==11)
cbook=" Bitter Is The New Black Jen Lancaster";
else if(com.getSelectedIndex()==12)
cbook=" Youth In Revolt C.D. Paye";
else if(com.getSelectedIndex()==13)
cbook=" How Not To Date Judy Mc Guire";
else if(com.getSelectedIndex()==14)
cbook=" Anchor Boy Jay Ornate";
else if(com.getSelectedIndex()==15)
cbook=" The Sellout Paul Beauty";
else if(com.getSelectedIndex()==16)
cbook=" Little Vicories JasonGay";
else if(com.getSelectedIndex()==17)
cbook=" Is It Just Me? Miranda Hart";
else if(com.getSelectedIndex()==18)
cbook=" The Eyre Affair Jasper Fforde";
else if(com.getSelectedIndex()==19)

Page 10 of 43
cbook=" I Am America(And So Can You!) Stephen Colbert";
else if(com.getSelectedIndex()==20)
cbook=" The Matian Andy Weir";
else if(com.getSelectedIndex()==21)
cbook=" Running With Scissors Augusten Buroughs";
else if(com.getSelectedIndex()==22)
cbook=" Food : A Love story jim Gaffigan";
else if(com.getSelectedIndex()==23)
cbook=" Lucky Jim Kingsley Amis";
else if(com.getSelectedIndex()==24)
cbook=" How to Be a Woman Caitlin Morna";
else if(com.getSelectedIndex()==25)
cbook=" Insane City Dave Barry";
else if(com.getSelectedIndex()==26)
cbook=" Good Omens Terry Pratcheet";
else if(com.getSelectedIndex()==27)
cbook="Me & Earl & the Dying Girl Jesse Andrew";
else if(com.getSelectedIndex()==28)
cbook=" Seriously.....I'm Kidding Ellen De Geners";
else if(com.getSelectedIndex()==29)
cbook=" Not That Kind of girl Lena Dunhan";

String comedy= cbook;


new I7().setVisible(true);
I7.c1.setText(comedy);
I7.c1.setVisible(false);
this.setVisible(false);

Page 11 of 43
//Coding for Show:

DefaultTableModel model=(DefaultTableModel)tab1.getModel();
int rows=model.getRowCount();
if(rows>0) {
for(int i=0;i<rows;i++) {
model.removeRow(0);
}
}
String query="Select title,author,book_id from books where genre='comedy'";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/legerit
","root","123");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(query);
while(rs.next()) {
String btitle=rs.getString("title");
String bauthor=rs.getString("author");
String bbook_id=rs.getString("book_id");
//System.out.println(btitle+"/"+bauthor+"/"+bbook_id);
model.addRow(new Object[]{btitle,bauthor,bbook_id});
}
} catch(Exception e) {
JoptionPane.showMessageDialog(this, e.getMessage());
}

Page 12 of 43
//Coding for Next:

new I7().setVisible(true);
this.setVisible(false);

Page 13 of 43
Order Window

//Import Package:
import java.sql.*;
import javax.swing.table.DefaultTableModel;

//Coding for Add to cart:

String hbook="";int i=0;


if(ho.getSelectedIndex()==0)
hbook="It Stephenking";
else if(ho.getSelectedIndex()==1)
hbook="Piercing Ryu Muakami";
else if(ho.getSelectedIndex()==2)

Page 14 of 43
hbook="The Exorcist William Peter Blatty";
else if(ho.getSelectedIndex()==3)
hbook="Ghost Story Peter Straub";
else if(ho.getSelectedIndex()==4)
hbook="American Psycho Bret Easton Ellis";
else if(ho.getSelectedIndex()==5)
hbook="Hell House Richard Matheson";
else if(ho.getSelectedIndex()==6)
hbook="Dracula Bram Stoker ";
else if(ho.getSelectedIndex()==7)
hbook=" The Handmaid's Tale Margaret Atwood";
else if(ho.getSelectedIndex()==8)
hbook="The Best of H.P. Lovecraft H.P. Lovecraft ";
else if(ho.getSelectedIndex()==9)
hbook="The Best of H.P. Lovecraft2 H.P. Lovecraft ";
else if(ho.getSelectedIndex()==10)
hbook="The Turn of the Screw Henry James ";
else if(ho.getSelectedIndex()==11)
hbook="House of leaves Mark Z.Danielewski ";
else if(ho.getSelectedIndex()==12)
hbook="The Haunting of Hill House Shirley Jackson ";
else if(ho.getSelectedIndex()==13)
hbook=" The Silence of the lambs Ira Levin";
else if(ho.getSelectedIndex()==14)
hbook=" The Silence of the lambs2 Ira Levin";
else if(ho.getSelectedIndex()==15)
hbook=" The Amityville Horror Jay Anson";
else if(ho.getSelectedIndex()==16)
hbook=" The Trial Franz Kafka";
else if(ho.getSelectedIndex()==17)

Page 15 of 43
hbook="Blood Meridian Cormac McCarthy ";
else if(ho.getSelectedIndex()==18)
hbook="Book of Blod Clive Barker ";
else if(ho.getSelectedIndex()==19)
hbook="Heart-Shaped Box Joe Hill ";
else if(ho.getSelectedIndex()==20)
hbook=" Carrion Comfort Dan Simmons ";
else if(ho.getSelectedIndex()==21)
hbook="The Complete Tales and Poems Edgar Allan Pe ";

String horror= hbook;


String comedy=c1.getText();
new I8().setVisible(true);
I8.c2.setText(comedy);
I8.c3.setText(horror);
I8.c2.setVisible(false);
I8.c3.setVisible(false);
this.setVisible(false);

//Coding for Show:


DefaultTableModel model=(DefaultTableModel)tab2.getModel();
int rows=model.getRowCount();
if(rows>0)
{
for(int i=0;i<rows;i++)
{
model.removeRow(0);
}
}
String query="Select title,author,book_id from books where genre='horror'";
try

Page 16 of 43
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/legerit
","root","123");
Statement stmt=(Statement)con.createStatement();
ResultSet rs=stmt.executeQuery(query);
while(rs.next())
{
String btitle=rs.getString("title");
String bauthor=rs.getString("author");
String bbook_id=rs.getString("book_id");
//System.out.println(btitle+"/"+bauthor+"/"+bbook_id);
model.addRow(new Object[]{btitle,bauthor,bbook_id});
}
}
catch(Exception e)
{
JoptionPane.showMessageDialog(this, e.getMessage());
}

//Coding for Next:

new I8().setVisible(true);
this.setVisible(false);

//Coding for Back:

new I6().setVisible(true);
this.setVisible(false);

Page 17 of 43
Order Window

//Import Package:
import java.sql.*;
import javax.swing.table.DefaultTableModel;

//Coding for Add to cart:


String kbook=" ";int i=0;
if(kido.getSelectedIndex()==0)
kbook="Dont's let the piegon Drive the bus Mo Willems";
else if(kido.getSelectedIndex()==1)
kbook=" Where the Wild Things Are Maurice Sendak ";
else if(kido.getSelectedIndex()==2)
kbook="The Snowy Day Ezra Jack Keats ";
Page 18 of 43
else if(kido.getSelectedIndex()==3)
kbook=" Goodnight Moon Margaret Wise Brown";
else if(kido.getSelectedIndex()==4)
kbook="Blueberries for Sal Robert McCloskey. ";
else if(kido.getSelectedIndex()==5)
kbook="Little Bear Else Holmelund Minarek, ";
else if(kido.getSelectedIndex()==6)
kbook="Owl Moon Jane Yolen ";
else if(kido.getSelectedIndex()==7)
kbook=" Alexander and the Terrible, Horrible, No Good, Very Bad Day Judith
Viorst";
else if(kido.getSelectedIndex()==8)
kbook=" All-of-a-Kind Family Sydney Taylor";
else if(kido.getSelectedIndex()==9)
kbook="Amelia Bedelia Peggy Parish";
else if(kido.getSelectedIndex()==10)
kbook="The Arrival Shaun Tan ";
else if(kido.getSelectedIndex()==11)
kbook=" Big Red Lollipop Rukhsana Khan";
else if(kido.getSelectedIndex()==12)
kbook="The Borrowers Mary Norton ";
else if(kido.getSelectedIndex()==13)
kbook=" Caps for Sale Esphyr Slobodkina";
else if(kido.getSelectedIndex()==14)
kbook="Chains Laurie Halse Anderson ";
else if(kido.getSelectedIndex()==15)
kbook="Curious George H.A. Rey ";
else if(kido.getSelectedIndex()==16)
kbook="Freight Train Donald Crews ";
else if(kido.getSelectedIndex()==17)

Page 19 of 43
kbook="Frog and Toad Are Friends Arnold Lobel ";
else if(kido.getSelectedIndex()==18)
kbook="George and Martha James Marshall ";
else if(kido.getSelectedIndex()==19)
kbook="Go, Dog. Go! P.D. Eastman ";
else if(kido.getSelectedIndex()==20)
kbook="Grandfather’s Journey Allen Say ";
else if(kido.getSelectedIndex()==21)
kbook="Green Eggs and Ham Dr. Seuss ";
else if(kido.getSelectedIndex()==22)
kbook="Hatchet Gary Paulsen ";
else if(kido.getSelectedIndex()==23)
kbook="Holes Louis Sachar ";
else if(kido.getSelectedIndex()==24)
kbook="The Invention of Hugo Cabret Brian Selznick ";
else if(kido.getSelectedIndex()==25)
kbook="Jumanji Chris Van Allsburg ";
else if(kido.getSelectedIndex()==26)
kbook="The Lion and the Mouse Jerry Pinkney ";
else if(kido.getSelectedIndex()==27)
kbook="The Little Prince Antoine de Saint-Exupéry ";
else if(kido.getSelectedIndex()==28)
kbook="Madeline Ludwig Bemelmans ";
else if(kido.getSelectedIndex()==29)
kbook="Matilda Roald Dahl ";
else if(kido.getSelectedIndex()==30)
kbook="My Father’s Dragon Ruth Stiles Gannett ";
else if(kido.getSelectedIndex()==31)
kbook="My Name is Yoon Helen Recorvits ";
else if(kido.getSelectedIndex()==32)

Page 20 of 43
kbook="One Crazy Summer Rita Williams-Garcia ";
else if(kido.getSelectedIndex()==33)
kbook="Pink and Say Patricia Polacco ";
else if(kido.getSelectedIndex()==34)
kbook="Rickshaw Girl Mitali Perkins ";
else if(kido.getSelectedIndex()==35)
kbook="Rumpelstiltskin Paul O. Zelinsky ";
else if(kido.getSelectedIndex()==36)
kbook="The Snowy Day Ezra Jack Keats ";
else if(kido.getSelectedIndex()==37)
kbook="The Story of Ferdinand Munro Leaf ";

String kids= kbook;


String horror=c3.getText();
String comedy=c2.getText();
new I9().setVisible(true);
I9.c4.setText(comedy);
I9.c5.setText(horror);
I9.c6.setText(kids);
I9.c4.setVisible(false);
I9.c5.setVisible(false);
I9.c6.setVisible(false);
this.setVisible(false);

Page 21 of 43
//Coding for Show:
DefaultTableModel model=(DefaultTableModel)tab3.getModel();
int rows=model.getRowCount();
if(rows>0)
{
for(int i=0;i<rows;i++)
{
model.removeRow(0);
}
}
String query="Select title,author,book_id from books where genre='Kids'";
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/legerit
","root","123");
Statement stmt=(Statement)con.createStatement();
ResultSet rs=stmt.executeQuery(query);
while(rs.next())
{
String btitle=rs.getString("title");
String bauthor=rs.getString("author");
String bbook_id=rs.getString("book_id");
//System.out.println(btitle+"/"+bauthor+"/"+bbook_id);
model.addRow(new Object[]{btitle,bauthor,bbook_id});
}
}
catch(Exception e)
{
JoptionPane.showMessageDialog(this, e.getMessage());
}
//Coding for Next:
new I9().setVisible(true);
this.setVisible(false);

//Coding for Back:

new I7().setVisible(true);
this.setVisible(false);

Page 22 of 43
Order Window

//Import Package:
import java.sql.*;
import javax.swing.table.DefaultTableModel;

//Coding for Add to cart:

String ccbook="";int i=0;


if(clab.getSelectedIndex()==0)
ccbook="State of the Union Addresses of John Quincy Adams John Quincy
Adams";
else if(clab.getSelectedIndex()==1)
Page 23 of 43
ccbook="State of the Union Addresses of John Adams John Adams";
else if(clab.getSelectedIndex()==2)
ccbook="Fenimore Cooper's Literary Offences Mark Twain";
else if(clab.getSelectedIndex()==3)
ccbook="The Deerslayer James Fenimore Cooper ";
else if(clab.getSelectedIndex()==4)
ccbook="Barchester Towers Anthony Trollope";
else if(clab.getSelectedIndex()==5)
ccbook="The Belton Estate Anthony Trollope";
else if(clab.getSelectedIndex()==6)
ccbook="Aaron Trow Anthony Trollope";
else if(clab.getSelectedIndex()==7)
ccbook="Autobiography of Anthony Trollope Anthony Trollope";
else if(clab.getSelectedIndex()==8)
ccbook="The Way of All Flesh Samuel Butler";
else if(clab.getSelectedIndex()==9)
ccbook="Tom Tiddler's Ground Charles Dickens";
else if(clab.getSelectedIndex()==10)
ccbook="The God of Small Arundhati Roy";
else if(clab.getSelectedIndex()==11)
ccbook="Ramayan C.Rajagopalachari";
else if(clab.getSelectedIndex()==12)
ccbook="Train to pakistan Kushwant Singh";
else if(clab.getSelectedIndex()==13)
ccbook="Talkative Man R.K. Narayan";
else if(clab.getSelectedIndex()==14)
ccbook="The World of Nagaraj R.K.Narayan";
else if(clab.getSelectedIndex()==15)
ccbook="Lord of the Flies William Golding";
else if(clab.getSelectedIndex()==16)

Page 24 of 43
ccbook=" Lorna Doone R.D. Blackmore";
else if(clab.getSelectedIndex()==17)
ccbook="Jamaica Inn Daphne du Maurie";
else if(clab.getSelectedIndex()==18)
ccbook="Kidnapped Robert Louis Stevenson";
else if(clab.getSelectedIndex()==19)
ccbook="Treasure Island Robert Louis Stevenson";
else if(clab.getSelectedIndex()==20)
ccbook="The Call of the Wild Jack London";
else if(clab.getSelectedIndex()==21)
ccbook="Charlotte’s Web E.B. White";
else if(clab.getSelectedIndex()==22)
ccbook="The Wind in the Willows Kenneth Grahame";
else if(clab.getSelectedIndex()==23)
ccbook="Moonfleet J. Meade Falkner";
else if(clab.getSelectedIndex()==24)
ccbook="Oliver Twist Charles Dickens";
else if(clab.getSelectedIndex()==25)
ccbook="A Tale of Two Cities Charles Dickens";
else if(clab.getSelectedIndex()==26)
ccbook="Brideshead Revisited Evelyn Waugh";
else if(clab.getSelectedIndex()==27)
ccbook="The Mayor of Casterbridge Thomas Hardy";
else if(clab.getSelectedIndex()==28)
ccbook="Don Quixote Cervantes";
else if(clab.getSelectedIndex()==29)
ccbook="Alice’s Adventures in Wonderland Lewis Carroll";
else if(clab.getSelectedIndex()==30)
ccbook="The Picture of Dorian Gray Oscar Wilde";
else if(clab.getSelectedIndex()==31)

Page 25 of 43
ccbook="Nineteen–Eighty Four George Orwell";
else if(clab.getSelectedIndex()==32)
ccbook="To Kill a Mockingbird Harper Lee";
else if(clab.getSelectedIndex()==33)
ccbook="Tinker Tailor Soldier Spy John le Carré";
else if(clab.getSelectedIndex()==34)
ccbook="Animal Farm George Orwell";
else if(clab.getSelectedIndex()==35)
ccbook="Anne of Green Gables L.M. Montgomery";

String classic= ccbook;


String kids= c6.getText();
String horror=c5.getText();
String comedy=c4.getText();
new I10().setVisible(true);
I10.c7.setText(comedy);
I10.c8.setText(horror);
I10.c9.setText(kids);
I10.c10.setText(classic);
I10.c7.setVisible(false);
I10.c8.setVisible(false);
I10.c9.setVisible(false);
I10.c10.setVisible(false);
this.setVisible(false);

//Coding for Show:

DefaultTableModel model=(DefaultTableModel)tab4.getModel();

Page 26 of 43
int rows=model.getRowCount();
if(rows>0)
{
for(int i=0;i<rows;i++)
{
model.removeRow(0);
}
}
String query="Select title,author,book_id from books where genre='Classic'";
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/legerit
","root","123");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(query);
while(rs.next())
{
String btitle=rs.getString("title");
String bauthor=rs.getString("author");
String bbook_id=rs.getString("book_id");
//System.out.println(btitle+"/"+bauthor+"/"+bbook_id);
model.addRow(new Object[]{btitle,bauthor,bbook_id});
}
}
catch(Exception e)
{
JoptionPane.showMessageDialog(this, e.getMessage());
}

//Coding for Next:


new I10().setVisible(true);
this.setVisible(false);

//Coding for Back:


new I8().setVisible(true);
this.setVisible(false);

Page 27 of 43
Order Window

//Import Package:
import java.sql.*;
import javax.swing.table.DefaultTableModel;

//Coding for Add to cart:


String cbook=" ", bbook="";
if(biol.getSelectedIndex()==0)
bbook=" Steve Jobs (Hardcover) Walter Isaacson ";
else if(biol.getSelectedIndex()==1)

Page 28 of 43
bbook="The Diary of a Young Girl Anne Frank";
else if(biol.getSelectedIndex()==2)
bbook="Unbroken: A World War II Story of Survival, Resilience, and Redemption
Laura Hillenbrand";
else if(biol.getSelectedIndex()==3)
bbook="John Adams David McCullough";
else if(biol.getSelectedIndex()==4)
bbook="Bossypants (Kindle Edition) Tina Fey ";
else if(biol.getSelectedIndex()==5)
bbook="The Immortal Life of Henrietta Lacks (Hardcover) Rebecca Skloot";
else if(biol.getSelectedIndex()==6)
bbook="Into the Wild Jon Krakauer";
else if(biol.getSelectedIndex()==7)
bbook="I Am Malala: Malala Yousafzai";
else if(biol.getSelectedIndex()==8)
bbook="Night (The Night Trilogy #1) Elie Wiesel ";
else if(biol.getSelectedIndex()==9)
bbook="Benjamin Franklin: An American Life Walter Isaacson";
else if(biol.getSelectedIndex()==10)
bbook="Yes Please (Hardcover) Amy Poehler";
else if(biol.getSelectedIndex()==11)
bbook="Catherine the Great: Portrait of a Woman (Hardcover) Robert K. Massie";
else if(biol.getSelectedIndex()==12)
bbook="Angela's Ashes (Frank McCourt, #1) Frank McCourt";
else if(biol.getSelectedIndex()==13)
bbook="The Glass Castle (Paperback) Jeannette Walls";
else if(biol.getSelectedIndex()==14)
bbook="Surely You're Joking, Mr. Feynman!: Adventures of a Curious Character
(Paperback) Richard Feynman";
else if(biol.getSelectedIndex()==15)

Page 29 of 43
bbook="Team of Rivals: The Political Genius of Abraham Lincoln (Paperback) Doris
Kearns Goodwin ";
else if(biol.getSelectedIndex()==16)
bbook="Alexander Hamilton (Paperback) Ron Chernow ";
else if(biol.getSelectedIndex()==17)
bbook="The Rise of Theodore Roosevelt (Paperback) Edmund Morris";
else if(biol.getSelectedIndex()==18)
bbook="The Autobiography of Benjamin Franklin (Paperback) Benjamin Franklin";
else if(biol.getSelectedIndex()==19)
bbook="I Know Why the Caged Bird Sings (Mass Market Paperback) Maya
Angelou";
else if(biol.getSelectedIndex()==20)
bbook="Wild: From Lost to Found on the Pacific Crest Trail (Hardcover) Cheryl
Strayed";
else if(biol.getSelectedIndex()==21)
bbook="Dreams from My Father: A Story of Race and Inheritance (Paperback)
Barack Obama ";
else if(biol.getSelectedIndex()==22)
bbook="The Hiding Place: The Triumphant True Story of Corrie Ten Boom
(Paperback) Corrie ten Boom";
else if(biol.getSelectedIndex()==23)
bbook="Eat, Pray, Love (Paperback) Elizabeth Gilbert";
else if(biol.getSelectedIndex()==24)
bbook="Elon Musk: Inventing the Future (Hardcover) Ashlee Vance";
else if(biol.getSelectedIndex()==25)
bbook="Washington: A Life (Hardcover) Ron Chernow ";
else if(biol.getSelectedIndex()==26)
bbook="Is Everyone Hanging Out Without Me? (And Other Concerns) Mindy Kaling
";
else if(biol.getSelectedIndex()==27)

Page 30 of 43
bbook="The Wright Brothers (Hardcover) David McCullough";
else if(biol.getSelectedIndex()==28)
bbook="Tuesdays with Morrie (Paperback) Mitch Albom ";
else if(biol.getSelectedIndex()==29)
bbook="Narrative of the Life of Frederick Douglass (Paperback) Frederick
Douglass";
else if(biol.getSelectedIndex()==30)
bbook="Theodore Rex (Paperback) Edmund Morris";

String biography= bbook;


String classic= c10.getText();
String kids= c9.getText();
String horror=c8.getText();
String comedy=c7.getText();
new I11().setVisible(true);
I11.c11.setText(comedy);
I11.c12.setText(horror);
I11.c13.setText(kids);
I11.c14.setText(classic);
I11.c15.setText(biography);
I11.c11.setVisible(false);
I11.c12.setVisible(false);
I11.c13.setVisible(false);
I11.c14.setVisible(false);
I11.c15.setVisible(false);
this.setVisible(false);

Page 31 of 43
//Coding for Show:
DefaultTableModel model=(DefaultTableModel)tab5.getModel();
int rows=model.getRowCount();
if(rows>0)
{
for(int i=0;i<rows;i++)
{
model.removeRow(0);
}
}
String query="Select title,author,book_id from books where genre='biography'";
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/legerit
","root","123");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(query);
while(rs.next())
{
String btitle=rs.getString("title");
String bauthor=rs.getString("author");
String bbook_id=rs.getString("book_id");
//System.out.println(btitle+"/"+bauthor+"/"+bbook_id);
model.addRow(new Object[]{btitle,bauthor,bbook_id});
}
}
catch(Exception e)

Page 32 of 43
{
JoptionPane.showMessageDialog(this, e.getMessage());
}

//Coding for Place Order:


new I11().setVisible(true);
this.setVisible(false);

//Coding for Back:

new I9().setVisible(true);
this.setVisible(false);

Page 33 of 43
Place Order Window

//Coding for Exit:


System.exit(0);

//Coding for Next:


new I12().setVisible(true);
String biography=c15.getText();
String classic= c14.getText();
String kids= c13.getText();
String horror=c12.getText();
String comedy=c11.getText();

Page 34 of 43
I12.coml.setText(comedy);
I12.horl.setText(horror);
I12.kidl.setText(kids);
I12.clal.setText(classic);
I12.biogl.setText(biography);
this.setVisible(false);

//Coding for Back:

new I10().setVisible(true);
this.setVisible(false);

Page 35 of 43
Ordered Window

//Coding for Place Order:

new I13().setVisible(true);
this.setVisible(false);
String a,b,c,d,e;
a=coml.getText();
b=horl.getText();
c=kidl.getText();
d=clal.getText();
e=biogl.getText();
int i = 0;
if(a.equals(" "))
i=0;
else
i++;
if(b.equals(" "))
i=0;
else
i++;
if(c.equals(" "))
Page 36 of 43
i=0;
else
i++;
if(d.equals(" "))
i=0;
else
i++;
if(e.equals(" "))
i=0;
else
i++;

I13.values.setText(""+i);
I13.values.setVisible(false);

//Coding for Back:

new I11().setVisible(true);
this.setVisible(false);

Page 37 of 43
Finalize Order Window

//Coding for Place Order:


int cost,ship,total;
int i=Integer.parseInt(values.getText());
cost=150*i;
ship=100;
String a=add.getText();
total=cost+ship;
co.setText(""+cost);
sh.setText(""+ship);
tl.setText(""+total);
Page 38 of 43
if(a.equals(""))
JOptionPane.showMessageDialog(null, " Please Enter Your Adress");
else
JOptionPane.showMessageDialog(null, "Thank you. Your Order Will Be
Delivered In 5 Days");

//Coding for Exit:


System.exit(0);

//Coding for Back:

new I6().setVisible(true);
this.setVisible(false);

Page 39 of 43
TABLE USED IN MYSOL

Page 40 of 43
RECORD OF BOOKS WITH BOOK_ID,TITLE, AUTHOR NAME AND GENRE

Page 41 of 43
Page 42 of 43
RECORD OF PERSON HAVING ACCOUNT ON OUR PROGRAMME

Page 43 of 43

You might also like