CS357: Database Systems Implementation
Homework Assignment 1 -- Database Clients
| Given: |
Wednesday, 23 January |
| Due Date: |
Wednesday, 30 January
|
1. Write a JDBC program to create and populate the GRADEPOINTS
table, as defined in Exercise 4.21 of the text. Note
that integers are the only numeric values that can be stored
in a SimpleDB database. Therefore you should multiply the
points by 10 and store those integers in the GRADEPOINTS table.
2. Write a JDBC program to request a student's name, and to print
out the GPA of that student. Use the definition of GPA from
Exercise 4.21(a) of the text. You can assume that there will be
at most one such student having the specified name. If there is
no student with that name, print "No such student". If that
student has taken
no courses, say so. Note that SimpleDB's version of SQL cannot do
arithmetic calculations, so you will need to do any arithmetic in Java.
Also, don't forget to divide the gradepoints by 10,
because of how you stored them in GRADEPOINTS. (HINT: Use two
queries. First determine if the student exists; then retrieve the
course data.)
For each problem, you should hand in a printout of your code. This is all that I want you to hand in. You are responsible for testing your code and making sure that it
works, but I don't want to see that. Instead, if you
feel that your code does not work, write a note on it saying what goes
wrong. (If your code doesn't work and you don't write me a note about it, I will grade it more harshly.)
All problems should be submitted by 5PM of
the due date. If I am not in my office, place the homework in my
mailbox in Fulton 460.