Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CIST 2 3 7 2 Java Programming II LUAB # 9 ( 5 0 Points ) Business Objects In this lab, you will be working

CIST 2372
Java Programming II
LUAB #9(50 Points)
Business Objects
In this lab, you will be working with Business Objects and DBs.
1.) Create a class called Student This class will not be tied to the Database, yet. The Smient class shoula have the these properties: sid - int or String firstiame-String lastVame-Sring email-Sting gea-double
Include all the set and get finctions as needed. Include 2 constructors, an empty constructor, and one that takes all properties. Include a display0 method that prints out all properties. Use a main to instantiate and test out this Student class. (Itint: No database calls in this class, yet.)
Testing Code in Main 0 method
Student_s1= new Student(4, "Frank', "Jones", "Ji(@yahoo.com", 3.2);
s1 displav0:
2.) Modify 1.) from above. Add a new Method called selecipBo that tikes only one argument, SID. When a user calls this method, it should SELECT from the database that Student and get all the Student's data from the database, and put this data into the appropriate properties. (fint: You will use an SOL Select statement here.) Test out this method in the main.
Testing Code in Maino method =>
Sindent s1= new Student0:
S1 saleciDR(4); Ilaccessing DB
s1 disolav0: Idisplays all data fiom DB for student with id=4
3.) Modify 2.) from above. This time we are add another method called insecUDB0. This method will take all 5 data elements as arguments. This method will then Insert this infomation imto the Smolent mble, as well as fill up the object with the data provided. (H) Tint: You will use an SQL Insert statement here.)
Terting Code in Nhino merthod
Student s2=new Studento:
sqinserin:(33, "Frank, Mayes",
timayes@yahoo.com;3.3);
S2 disolay0:
4.) Lastly add 2 fimctions to your Student class, Hpedated 3.9 and dethe.RBO. These finctions will update and delete student data in the database.
Taxing Code in Mmint metiod
Student 53= new Studanto:
Siselactid: (6) :
S B : 0 :
And
Student 54= new Student 0 :
SA GeleatDP (T):
Ichange any property in the student object 54
The example below changes the lastname.
llbut you could change email, or gpa as well
S4 setl astname("Smith");
ISA mpdatamB: 0 ; send any changes to the DB S4 nndateDB(0:
image text in transcribed

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

Step: 3

blur-text-image

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

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions