Question
https://www.youtube.com/watch?feature=player_embedded&v=VbuLXze6xf Create a 3 layer application in Java, where the top layer is the User Interface, the middle layer is the business layer, and the
https://www.youtube.com/watch?feature=player_embedded&v=VbuLXze6xf
Create a 3 layer application in Java, where the top layer is the User Interface, the middle layer is the business layer, and the bottom layer is the database connectivity.
The user interface will present a GUI to the user, asking them to enter some information, and to interact with the stored data. Refer to your previous assignments. You can use your code or start from scratch. (The exact functionality provided to the user is deliberately vague here.)
Create a connection to a relational database using SQLite or MySQL.
Create a single database table to hold information. Go back to the previous assignments, and re-use your classes, or modify them as you like. Recall that you will create the DB only once. You can just comment out the code that creates it if you like. Some people find a way to detect if the DB is already there. Thats fine, but not required.
These requirements are taken from the previous assignment. This time the user is to be presented with a GUI that allows these things to be done. So the data is not hard coded, the user will fill in a GUI click a button to interact with the DB. When you retrieve the data from the database it should populate the GUI to demonstrate that it is working.
Demonstrate the insertion of a record into the database. Create a method in the Data layer that takes a Person as a parameter, and puts that data in the database. Insert several records.
Demonstrate the retrieval of information from the database. Use SQL Select statements.
Write a method called getPerson that returns a Person object. This method retrieves the data for a Person from the database. We also need to pass a parameter to identify what person. You can use name if you like, or if you find it easier to use the database generated ID thats fine too. This method returns the object that represents that person. This will require that you extract the data that is returned from the database, and call the Person constructor. Note that this is the data-exchange between the relational database and the business layer.
Write a method called findAllPeople that returns an ArrayList of objects containing all the people in the database.
Write a method called deletePerson that removes a person from the database. The parameters will be first name and last name. Print out on the console the data from the record that is being deleted. Use your findAllPeople method to verify that that person has been removed from the database. Consider what this method should return. Suppose the person is not found, should the method return that information somehow?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started