Project 4 SOlution

$30.00

Category: Tag:

Description

This programming project involves writing a program to manage a student database. The interface to the program should be a GUI that looks similar to the following:

A combo box should allow the user to select one of the four database actions shown. The database should be implemented as a HashMap, with the ID field as the key and a student record consisting of a name and major as the value. The operation should be performed when the user clicks the Process Request button. If the user attempts to insert a key that is already in the database an error message should be displayed using a JOptionPane message dialog box. If the user attempts to delete, find or update a record that is not in the database, a message should also be displayed. After each successful operation is completed a JOptionPane window should be displayed confirming the success. In the case of a successful Find request, a window should pop up containing the student’s ID, name, major and current GPA. When the user selects the Update request, the following JOptionPane windows should be displayed to gather information about a course that has just been completed:

1

This program must consist of two classes.

  1. The first class should define the GUI and handle the database interactions.

  1. The second class named Student, should define the student record. It must have instance variables for the student name, major and two variables that are used to compute the GPA. A variable that contains the total number of credits completed and a second variable that contains the total quality points, which are the numeric value of the grade received in a course times the number of credit hours. It should not contain the student ID. The class should have the following three methods:

    1. A constructor that is used when new student records are created. It should accept the name and major as parameters and initialize the fields that are used to compute the GPA to zero.

    1. The second method courseCompleted should accept the course grade and credit hours and update the variables used to compute the GPA. It will be called when an Update request is made.

    1. The third method should override toString and return a labeled string containing the student name, major and GPA.

Finally when a student has not yet completed any course, the GPA should be displayed as 4.0.

The google recommended Java style guide, provided as link in the week 2 content, should be used to format and document your code. Specifically, the following style guide attributes should be addressed:

Header comments include filename, author, date and brief purpose of the program. In-line comments used to describe major functionality of the code.

Meaningful variable names and prompts applied. Class names are written in UpperCamelCase.

Variable names are written in lowerCamelCase. Constant names are in written in All Capitals.

Braces use K&R style.

In addition the following design constraints should be followed:

Declare all instance variables private Avoid the duplication of code

Also any exceptions thrown by nonnumeric inputs should be properly handled

Test cases should be supplied in the form of table with columns indicating the input values, expected output, actual output and if the test case passed or failed. This table should contain 4 columns with appropriate labels and a row for each test case. Note that the actual output should be the actual results you receive when running your program and applying the input for the test record. Be sure to select enough different scenarios to completely test the program.

Note: All code should compile and run without issue.

2

Submission requirements

Deliverables include all Java files (.java) and a single word (or PDF) document. The Java files should be named appropriately for your applications. The word (or PDF) document should include screen captures showing the successful compiling and running of each of the test cases. Each screen capture should be properly labeled clearly indicated what the screen capture represents. The test cases table should be included in your word or PDF document and properly labeled as well.

Submit your files to the Project 4 assignment area no later than the due date listed in your LEO classroom. You should include your name and P4 in your word (or PDF) file submitted (e.g. firstnamelastnameP4.docx or firstnamelastnameP4.pdf).

Grading Rubric:

The following grading rubric will be used to determine your grade:

Attribute

Meets

Does not meet

GUI Class

40 points

0 points

Defines the GUI.

Does not defines the GUI.

Provides a combo box to allow

Does not provide a combo box

the user to select one of the

to allow the user to select one

four database actions including

of the four database actions

insert, update, delete and find.

including insert, update, delete

and find.

The database is implemented as

a HashMap, with the ID field as

The database is not

the key and a student record

implemented as a HashMap,

consisting of a name and major

with the ID field as the key and

as the value.

a student record consisting of a

name and major as the value.

The operation is performed

when the user clicks the Process

The operation is not performed

Request button.

when the user clicks the Process

Request button.

If the user attempts to insert a

key that is already in the

If the user attempts to insert a

database an error message is

key that is already in the

displayed using a JOptionPane

database an error message is

message dialog box.

not displayed using a

JOptionPane message dialog

If the user attempts to delete,

box.

find or update a record that is

If the user attempts to delete,

find or update a record that is

3

not in the database, a message

not in the database, a message

is displayed.

is not displayed.

After each successful operation

After each successful operation

is completed a JOptionPane

is completed a JOptionPane

window is displayed confirming

window is not displayed

the success.

confirming the success.

In the case of a successful Find

In the case of a successful Find

request, a window pops-up

request, a window does not

containing the student’s ID,

pop-up containing the student’s

name, major and current GPA.

ID, name, major and current

GPA.

When the user selects the

Update request, a JOptionPane

When the user selects the

windows is displayed to gather

Update request, a JOptionPane

information about a course that

window is not be displayed to

has just been completed

gather information about a

including the grade and number

course that has just been

of credits.

completed including the grade

and number of credits.

Code does not Compile.

Student class

40 points

0 points

Defines the student record.

Does not define the student

record.

Contains instance variables for

the student name, major and

Does not contains instance

two variables that are used to

variables for the student name,

compute the GPA.

major and two variables that

are used to compute the GPA.

Contains a variable

representing the total number

Does not contain a variable

of credits completed

representing the total number

of credits completed

Contains a variable representing

the total quality points, which

Does not contain a variable

are the numeric value of the

representing the total quality

grade received in a course times

points, which are the numeric

the number of credit hours.

value of the grade received in a

course times the number of

The class should not should

credit hours.

contain the student ID.

The class contains the student

Contains a constructor that is

ID.

used when new student records

4

are created. It should accept the

Does not contains a constructor

name and major as parameters

that is used when new student

and initialize the fields that are

records are created. It should

used to compute the GPA to

accept the name and major as

zero.

parameters and initialize the

fields that are used to compute

Contains a method

the GPA to zero.

courseCompleted that accepts

the course grade and credit

Does not contains a method

hours and update the variables

courseCompleted that accepts

used to compute the GPA.

the course grade and credit

hours and update the variables

courseComplete is called when

used to compute the GPA.

an Update request is made.

courseComplete is not called

Contains an overridden toString

when an Update request is

method that returns a labeled

made.

string containing the student

name, major and GPA.

Does not contains an

overridden toString method

Calculates and displays a GPA of

that returns a labeled string

4.0 for students who have not

containing the student name,

yet completed any course.

major and GPA.

Does not calculate or display a

GPA of 4.0 for students who

have not yet completed any

course.

Code does not Compile.

Test Cases

10 points

0 points

Test cases are supplied in the

No test cases were provided.

form of table with columns

indicating the input values,

expected output, actual output

and if the test case passed or

failed.

Enough scenarios selected to

completely test the program.

Test cases were included in the

supporting word or PDF

documentation.

Documentation and Style guide

10 points

0 points

5

Screen captures were provided

and labeled for compiling your

code, and running each of your

test cases.

Header comments include

filename, author, date and brief

purpose of the program.

In-line comments used to

describe major functionality of

the code.

Meaningful variable names and

prompts applied.

Class names are written in

UpperCamelCase.

Variable names are written in

lowerCamelCase.

Constant names are in written

in All Capitals.

Braces use K&R style.

Declare all instance variables

private.

Avoids the duplication of code.

Any exceptions thrown by

nonnumeric inputs are properly

handled.

No documentation included.

Java style guide was not used to prepare the Java code.

All instance variables not declared private.

Duplication of code was not avoided.

any exceptions thrown by nonnumeric inputs are not properly handled

6


error: Content is protected !!