To develop skills in using the looping constructs in Java Homework Help

COP2253: Java Programming

Programming Project #6

Don't use plagiarized sources. Get Your Custom Essay on
To develop skills in using the looping constructs in Java Homework Help
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT! Just from $10/Page
Order Essay

Course.java

Transcript.java

TranscriptTest.java

Project Objectives:

To develop skills in using the decision constructions in Java

To develop skills in using the looping constructs in Java

To learn to use ArrayList in Java.

To develop programs that use more than one class and have multiple objects

Project Requirements:

Develop a simple grade transcript program. We will have two classes, a Course class representing an individual course that a student has taken and a Transcript class that will combine several Course objects and calculate an overall grade point average (GPA). We will also have two test classes, one for the Course class and one for the Transcript class.

Design and build a Course class. This will have three instance variables. There will be a courseID variable that will hold the course identification number. We will use the standard State of Florida numbering system (this course is “COP 2253?). We will have a letterGrade variable that will hold the assigned course grade. We will also have a numberGrade variable that will hold a numeric equivalent to the letterGrade. The class should have a constructor, accessors for the instance variables, a method to compute the numeric grade, a method to update the grade, and a method to convert the state of the object to a string. Using the UML, the class diagram looks like this:

Course

– courseID : String

– letterGrade : String

– numberGrade : double

+ Course( String, String )

+ getCourseID( ) : String

+ getLetterGrade( ) : String

+ getNumericGrade( ) : double

– computeGrade()

+ updateGrade( String )

+ toString( )  : String

The constructor will assign the first parameter to the variable courseID and the second parameter to the variable letterGrade. The constructor will then call the method computeGrade() to convert the letter grade to a numeric equivalent and store it in the variable numberGrade.

The class will have three accessor methods getCourseID(), getLetterGrade(), and getNumericGrade() that will return the value of each respective instance variable.

The method computeGrade() handles the conversion of the letter grade to a numeric equivalent and saves it in the instance variable numberGrade. The letter grades will range from “A” to “F”. The letter grades have numeric values ranging from 4.0 for an “A” to 0.0 for an “F”. We may also have a “+” or a “-” after some letter grades. The “+” can be appended to B’s, C’s, and D’s and increases the value of the letter grade by 0.3 points. A “-” appended to A’s, B’s, and C’s decreases the value of the letter grade by 0.3 points. There are no “A+”, ‘D-“, “F+” or “F-” grades. Use the switch statement to determine which of the set of letter grades we have. Use the if { … } else { … } construction to handle the modification of the basic numeric grade with the “+” and “-‘ modifiers. There will be 11 possible valid grades.

The class will have a method updateGrade(String) that takes a new letter grade value as a String parameter, and updates the letterGrade and numberGrade variables accordingly. numberGrade can be updated by calling the computeGrade() method as done in the constructor. Note that we can call methods of a class from within the class; in this case, we do not use the dot (.) operator. Methods which are useful to other methods are called utility methods, and do not need to be public if they will only be called from within the class. In this case, computeGrade() is a utility method.

The method toString() allows us to access the state of the object in a printable or readable form. It converts the variables to a single string that is neatly formatted. Look at pages 23 and 24 of the text for a discussion of escape sequences. These are characters that you can insert into your strings and, when printed, will format the display neatly. You can insert an escape sequence for the tab character and get a tabular form when printing.  This tab character is ‘t’. Your class will have a toString() method that concatenates courseID, letterGrade, and numberGrade separated by tab characters and returns this new string. When you try to print an object, the toString() method will be implicitly called, which in this case, will print a string that will look something like:
COP 2253       A-        3.7

Build a Transcript class that will store information about the courses taken (Course Objects) by one specific student. It should include a studentID and studentName. It should also include an ArrayList (You must use an ArrayList, not an array) to hold information about each course (course object) that the student has completed.

Build a TranscriptTest class to test your application. Your test class should not require any interaction with the user. It should verify the correct operation of the constructor and all methods in the Transcript class.

Specific Requirements for the Transcript Class

The transcript class should have a constructor with two parameters. The first is an integer containing the student’s ID and the second is a String containing the student’s name.

There should be a method to allow the aIDition of a course to the transcript. The two parameters for the aIDCourse method will be (1) the courseID and (2) the letterGrade.

There should be a method to allow the updating of a course already in the transcript. Notice that updating a course means changing the letter grade. The parameters for the updateCourse method are also (1) the courseID and (2) the letterGrade. Notice that the updating of a specific course requires a search through the ArrayList to find the desired course. Anytime a search is done, the possibility exists that the search will be unsuccessful. It is often difficult to decide what action should be taken when such an “exception” occurs. Since exception handling is not covered until later in this textbook, we will make some arbitrary decisions for this project. If the course to be updated is not found, you will take the simplest action possible and do nothing. Do not print an error message to the screen. Simply leave the transcript unchanged.

The transcript class needs a method called getGPA to return the student’s GPA. You should implement a method called calculateGPA that will go through the array of courses and make the appropriate calculation. The calculateGPA method should never be called from outside the class, so it should be made private. Recall that the Course class maintains a numeric grade indicating GPA points.

There should also be a method to return information about a specific course. It should return a single String object in the same format described for the Course class:
COP 2253       A-        3.7

Again, the possibility exists that the search for a specific class will fail. In this instance, you should return a string containing a message similar to this:
COP 2253 not found.

The final method needed is a toString method. It should return the transcript information in a single String object. It should use the following format:
ID :  12345
Name : John Doe
GPA : 4.0
COP 2253        A        4.0
COP 3022        A        4.0
COP 3530        A        4.0

Notice that a newline character ‘n’ can be inserted into the miIDle of a string.
Ex.
int age = 30;
String temp = “John Doe n is ” + age + “n” + ” years old”;

The output would be:
John Doe
is 30
years old

Notice also that the ‘n’ is a single character and could actually go inside single or double quotes, depending on the circumstances.

Here is a UML diagram for the Transcript class as describe above. Notice that you may aID private instance variables and methods as needed. For all public methods use exactly the name given below. Remember that calculateGPA should be private.

Transcript

– courses : ArrayList<Course>

– studentID : int

– studentName : String

+ Transcript( int, String )

+ aIDCourse( String, String )

+ updateCourse( String, String )

– calculateGPA( )

+ getGPA( ) : double

+ getCourse( ) : String

+ toString( ) : String

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.