Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Prove the full, typed (Not accpet photo) , currently (can run in eclipse software) Java code according the Project Introductionblew, thank you so much.

Please Prove the full, typed(Not accpet photo) , currently (can run in eclipse software) Java code according the Project Introductionblew, thank you so much.

(Hint: the Project code must have the four java file: DAO.java file, LOGIN.java file, TICKETSGUI.java file, and TICKETSJTABLE.java file)

Introduction

1. Tasks:

I. Create Database tables

Create needed dbase tables (3)

*Creating your table(s) name using your first initial_ first four letters of your last name followed by whatever. Use the following credentials for connectivity

url = "jdbc:mysql://www.papademas.net:3306/tickets?autoReconnect=true&useSSL=false";

username = "fp411";

password = "411";

II. Create Java files for the UI/UX

Create Login screen (user vs admin password)

Create ticket screen

Include menu items and other GUI elements as options for user vs admin Decide on the functionality of your program -What does the user need to do? -What does the admin need to do?

III. Create a Java file for database connectivity / CRUD implementations

Functions your CRUD methods should perform:

-Inserting a ticket into the database with some ticketnum -Update record (fields?) / by ticketnum

-Delete (purge) record / by ticketnum. Include a popup message dialog box asking the user

if it is okay to delete the record. Show the ticket number in question in the popup box area.

- View record(s) / by ticketnum(s)

- Close a ticket / by ticketnum

IV. Run your app and snapshot the following for credit

1.Please insert at least 5 tickets into the DB. Include a record with your name into the DB.

2.Update your record by changing your ticket description.

3.Show a view of your updated ticket.

4.Delete your ticket from the DB.

5.Close two existing tickets.

6.Lastly, show a table view of all of your tickets.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Java file requirement and tips

Stuggest Java structure blew:

image text in transcribed

The whole code must have four java file blew:

1.DAO.java file

Tip:

The Dao.java can do a lot of the CRUD work for you with methods you define inside the file.

So far functionality is described as follows:

A getConnection() method is defined and useful to call anytime, anywhere in your program to have a connection to your underlying database.

Call it anytime to work some query statements as follows..

Connection connect = Dao.getConnection();

A createTables() method that creates a users table and tickets table. Supplied for you are queries that create two tables, jpapa_tickets and jpapa_users. These tables can be used as shareable tables for practice. Feel free to use/adjust the supplied query statements to include not only your own table names but any desired additional fields if you desire so your own tables are created appropriately.

***For turning in finalized work, of course please adjust any table name in any of the files to your own names to reflect your own works. Otherwise points will be dimished as a result if not.

Finally an addUsers() method that is called at the end of createTables() method takes the file you see in the snapshot above called userlist.csv and inserts each record into the users table. You can use this feature if you like or something else to get some users into your users table. Modify the user list if you like that consists of a username (Col. 1) and password (Col. 2) to names your familiar with. Make sure also no matter what add at least your name in and a password to your users table.

Finish up with Dao.java file with some CRUD methods of your own like a delete function and an update function. Call these functions where deemed appropriate in your code.

2.LOGIN.java file

Tip:

This is your starter file which authenticates users both admin and regular users.

For the first time you use the app, please enter in the hard coded admin credentials in the file namely admin and admin1 respectively for the user name and password. After the admin is authenticated the ticketsGUI window appears and any of your tables are created if necessary.

Further check out the conditional logic for the loginButton eventHandler which nicely checks over credentials and passes the user name of a regular user (verified against the user table using prepared statements) or denotes a user as Admin in the ticketsGui.java window that triggers on a successful login. Any unsuccessful login fires up a pop up message. Try it out!

Of course once you know your users table has been created or your testing the sample users table out, feel free to login with the credentials listed in the userlist file or just

connect to the server via MySQLWorkbench to gain access to table record data.

3.TICKETSGUI.java file

Tips:

Run thru some of the menus that have event handling put in place already for various sub menus. For example Open a ticket and View a ticket. Then exit. These should all work. But wait.

Should a regular user for example see everyones tickets or just there own? Adjust for that.

Also should a regular user see the Admin menu or its sub menu features? Not at all. Adjust for that as well.

A quick and simple suggestion to at least block out the views of regular users would be to set the visibility off if the user is not an admin.

Finish the sub menus in the actionPerformed event where you see comments towards the end of the event handler namely where it says

/*

* continue implementing any other desired sub menu items (like for

* update and delete sub menus for example) with similar syntax &

* logic as shown above*

*/

Note coding sub menu items in the event handler can follow any order. Order in other words does not matter, what matters how you handle events fired by a menu selection.

The main thing when coding any menu items is to just use the name of your sub menu object you create or that has been created already in code

ex. for the following

else if (e.getSource() == someMenuItem)

you would include for someMenuItem your sub menu object name and code in your action for when the user chooses that particular menu item.

Finally a nice little goodie or easter egg has been provided in the file. The code below

retrieves the id of any id that was just auto incremented as a result of an insert!! Very cool and useful indeed. You can show the auto generated id to the console or via a dialog message box and/or use it for some query.

Example: take the ticket id number generated and add that id on some insert to some other table along with any data for later referencing.

// retrieve ticket id number newly auto generated upon record insertion

ResultSet resultSet = null;

resultSet = statement.getGeneratedKeys();

int id = 0;

if (resultSet.next()) {

id = resultSet.getInt(1); // retrieve first field in table

}

// display results if successful or not to console / dialog box

if (result != 0) {

System.out.println("Ticket ID : " + id + " created successfully!!!");

JOptionPane.showMessageDialog(null, "Ticket id: " + id + " created");

} else {

System.out.println("Ticket cannot be created!!!");

}

4.TICKETSJTABLE.java file

Tip:

Nothing to do here everything works automatically pulling your metadata and placing that into the JTable to set up column structure and the grabbing of row data is accomplished automatically as well. Unless you want to tweak the table that is up to you. Check this site for awesome tweaks for sure!

https://docs.oracle.com/javase/tutorial/uiswing/components/table.html

After your code work is pretty much complete, please include a 3rd table of choice and what interaction you would like that table to contain. Perhaps run some report to show verification of table data from your new table. Example tables can be a location table, ticket history table, some table to hold analytics (current vs. past?) for quick queries, etc.

v Tickets SP18 v (default package) Dao.java JLogin.java ticketsGUI.java ticketsJTable.java ? ?JRE System Library [JavaSE-18] Referenced Libraries userlist.csv v Tickets SP18 v (default package) Dao.java JLogin.java ticketsGUI.java ticketsJTable.java ? ?JRE System Library [JavaSE-18] Referenced Libraries userlist.csv

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

What is the purpose of having a detailed event budget?

Answered: 1 week ago