CSc 4710/6710 Database Systems
Fall 2011
Homework 3
Due: October 16, 2011 (Sunday)

Implement an Java application for an online bookstore. The database schema for the application is given below:

drop table books cascade constraints;
create table books (
  isbn char(10),
  author varchar2(100) not null,
  title varchar2(128) not null,
  price number(7,2) not null,
  subject varchar2(30) not null,
  primary key (isbn)
);
drop table members cascade constraints;
create table members (
  fname varchar2(20) not null,
  lname varchar2(20) not null,
  address varchar2(50) not null,
  city varchar2(30) not null,
  state varchar2(20) not null,
  zip number(5) not null,
  phone varchar2(12),
  email varchar2(40),
  userid varchar2(20),
  password varchar2(20),
  creditcardtype varchar2(10) 
    check(creditcardtype in ('amex','visa')),
  creditcardnumber char(16),
  primary key (userid)
);
drop table orders cascade constraints;
create table orders (
  userid varchar2(20) not null,
  ono number(5),
  received date not null,
  shipped date,
  shipAddress varchar2(50),
  shipCity varchar2(30),
  shipState varchar2(20),
  shipZip number(5),
  primary key (ono),
  foreign key (userid) references members
);
drop table odetails cascade constraints;
create table odetails (
  ono number(5),
  isbn char(10),
  qty number(5) not null,
  price number(7,2) not null,
  primary key (ono,isbn),
  foreign key (ono) references orders,
  foreign key (isbn) references books
);
drop table cart cascade constraints;
create table cart (
  userid varchar2(20),
  isbn char(10),
  qty number(5) not null,
  primary key (userid,isbn),
  foreign key (userid) references members,
  foreign key (isbn) references books
);

Sample Data for the books table. This project will be developed in stages. In the first stage, which is due on October 16th, the following menu system should be implemented.

$ java OnlineBookStore

**********************************************************************
***                                                                ***
***             Welcome to the Online Book Store                   ***
***                                                                ***
**********************************************************************

                         1. Member Login

                         2. New Member Registration

                         q. Quit



Type in your option: 2

Welcome to the Online Book Store
       New Member Registration


Enter first name: Raj
Enter last name: Sunderraman
Enter street address: 123 Main Street
Enter city: Atlanta
Enter state: GA
Enter zip: 30303
Enter phone: 555-1212
Enter email address: raj@cs.gsu.edu
Enter userID: raj
Enter password: raj
Do you wish to store credit card information(y/n): y
Enter type of Credit Card(amex/visa): amex
Enter Credit Card Number: 121212121212121
Invalid Entry
Enter Credit Card Number: 12121212121212
Invalid Entry
Enter Credit Card Number: 1212121212121212

You have registered successfully.
Name:                Raj Sunderraman
Address:             123 Main Street
City:                Atlanta GA 30303
Phone:               555-1212
Email:               raj@cs.gsu.edu
UserID:              raj
Password:            raj
CreditCard Type:     amex
CreditCard Number:   12121212121212
Press Enter to go back to Menu


**********************************************************************
***                                                                ***
***             Welcome to the Online Book Store                   ***
***                                                                ***
**********************************************************************

                         1. Member Login

                         2. New Member Registration

                         q. Quit



Type in your option: 1

Enter userID: raj
Enter password: raj

**********************************************************************
***                                                                ***
***                       Welcome to Online Book Store             ***
***                            Member Menu                         ***
***                                                                ***
**********************************************************************

                     1. Browse by Subject

                     2. Search by Author/Title/Subject

                     3. View/Edit Shopping Cart

                     4. Check Order Status

                     5. Check Out

                     6. One Click Check Out

                     7. View/Edit Personal Information

                     8. Logout



Type in your option: 8

You have successfully logged out!
Press enter to go back to Menu