Question: This is the Programmatic Database Setup if it is also needed, this is already completed. please look below to see TASK. TASK: Once the 2
This is the Programmatic Database Setup if it is also needed, this is already completed. please look below to see TASK.


TASK: Once the 2 Data Access Objects (DAOs) have been created and tested (Screenshot of them i attached below)
The task in this step is to implement at least 2 GUIs for the DAOs that you have implemented and tested in the previous task. One of your GUI must be for a DAO/table without foreign keys and one for a DAO/table with foreign keys.
The GUIs must have full CRUD capabilities for the table to which it is linked and the data entered on the form must be validated.
import sqlite3 # Connect to database conn = sqlite3.connect('AntiqueHotel.db') # Create cursor c = conn.cursor() # Create table c.execute('''CREATE TABLE Guests (guest_id INTEGER PRIMARY KEY AUTO INCREMENT, first_name VARCHAR (50) NOT NULL, last_name VARCHAR (50) NOT NULL, email VARCHAR (50) NOT NULL, phone VARCHAR (50) NOT NULL, credit card_no VARCHAR (50) NOT NULL)) # Create table. c.execute('''CREATE TABLE Reservations (reservation_id INTEGER PRIMARY KEY AUTOINCREMENT, guest_id INTEGER NOT NULL, check_in_date DATETIME NOT NULL, check_out_date DATETIME NOT NULL, number_of_rooms INTEGER NOT NULL, number_of_adults INTEGER NOT NULL, number_of_infants INTEGER NOT NULL, number_of_children INTEGER NOT NULL, promo_code VARCHAR (20) NOT NULL, staff_id INTEGER NOT NULL, FOREIGN KEY (guest_id) REFERENCES Guests (guest_id), FOREIGN KEY(staff_id) REFERENCES Staff (staff_id))'*') # Create table c.execute('''CREATE TABLE Staff (staff_id INTEGER PRIMARY KEY AUTOINCREMENT, first_name VARCHAR(51) NOT NULL, last_name VARCHAR (51) NOT NULL, email VARCHAR(51) NOT NULL, phone VARCHAR (50) NOT NULL)''') #Create table. c.execute('''CREATE TABLE Rooms (room_id INTEGER PRIMARY KEY AUTO INCREMENT, room_number INTEGER NOT NULL, room_type VARCHAR(51) NOT NULL, additional_bed_charge DECIMAL NOT NULL)) # Commit changes. conn.commit() # Close connection conn.close() The above code is a python script that is used to programmatically create the SQLite database and all its tables. The script first connects to the database and creates a cursor to execute the commands. It then creates four tables Guests, Reservations, Staff and Rooms and adds the required fields to each table. Lastly, it commits the changes and closes the connection to the database.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
