Question: Create a Java program that: uses relational databases queries a database with the Structured Query Language (SQL) connects to a database with Java Database Connectivity

Create a Java program that:

uses relational databases

queries a database with the Structured Query Language (SQL)

connects to a database with Java Database Connectivity (JDBC)

inserts, updates, and deletes data in a relational database

Prep Readings:

ZyBooks chpt 1 15, Additional Slides

Background Information:

Write a Java program that creates a grade book for a class. The program should be able to display all grades for a given student. It should allow the instructor to add a new grade (such as Homework 4: 100) or modify an existing grade.

Project Requirements:

The database has one table called Student.The student table has 3 attributes

Student name varchar(50)

Student id - int

Assignment varchar (50)

Grade int

Optional Create two tables. Student and Assignment

This option will require writing joins to access the DB data.

Student table attributes

Student name varchar(50)

Student id - int

Assignment table attribute

sid int (foreign key to Student table)

Assignment varchar (50)

Grade int

Create a CreateGradeBook database in derby. Use the CreateDB example in the book as your guide. Once created the DB should persist. If built in the classroom, it may not after reboot due to the Freeze program.

Create Student Class (make adjusted as needed if using two tables)

NOTE: All data must be retrieved from the database as needed, no use of Arrays, ArrayList or any other type of collection or storage construct is allowed.

Instance Variables

String: studentName

int: studentID

Static int: nextStudentID

Constructors default and parameterize constructors

Accessor and mutator methods for Students name and id.

MethodsaddGradeTakes in two parameters

String assignment

int grade

Adds a grade to the db.

Each entry must include name, studentID, assignment and grade. (Make required modification if using two tables)

displayGrades

returns a String that list all the students grades

Example output is

Joe Smith ID#: 1234

Assignment

Grade

Homework 1

89

Project 2

97

Midterm 1

78

findGrade

Takes in Assignment text

Returns a nicely formatted String representing the assignment and grade.

If assignment not found return Not Found.

modifyGrade

Takes in Assignment text and new assignment grade

Changes that assignment grade.

calculateAvg returns a double representing the average of all grades. Note all grades have the same weight.

GradeBookTester

Creates at least 4 Student objects.

Test all methods in the Student class.

Any output should be nicely formatted

No user input required, either hard code the input or use a file.

If a file is used include the file in your submission zip file.

Submission Requirements: Your project must be submitted using the instructions below. Any submissions that do not follow the stated requirements will not be graded.

1. You should have 2 files for this assignment:

Student.java

GradeBookTester.java

Input file (optional)

2. Remember to compile and run your program one last time before you submit it. If your program will not compile, the graders will not be responsible for trying to test it.

3. Follow the submission requirements posted on elearning.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!