Assignment 1 - Intermediate Java Programming | COP 3804, Assignments of Java Programming

Material Type: Assignment; Class: Intermediate Java Programming; Subject: Computer Programming; University: Florida International University; Term: Spring 2007;

Typology: Assignments

Pre 2010

Uploaded on 03/11/2009

koofers-user-bj9
koofers-user-bj9 🇺🇸

5

(1)

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
COP 3804 Homework1
Due on May 17th 2007 in Class. (This document is 2 pages long)
Problem
A customer (instructor) wants a programmer (student) to write a program that allows entering the
names and exams grades for students in the class, compute the average of each student’s exams
grades and the corresponding letter grade, and finally display in alphabetical order the students’
names along with the grades, computed averages and letter grades.
Description
You need to present two solutions to this problem:
a) The first solution takes into account the use of an array to store the students’ information. You
need to define:
- A class Grade with fields to store the name (firstname, lastname) and an array of numbers
representing the grades for the exams. This class needs to provide methods to retrieve and
modify the values of those fields. Also, methods for obtaining the average and the letter
grade associated to it need to be implemented (refer to the syllabus for a scale to compute
the letter grades). Alternatively, you can choose to have the average and the letter grade as
fields; however, this will introduce redundant information.
- An array of Grade objects to store the information for all students.
- A utility class GradeSorter to sort the array in alphabetical order. A sort method that takes
an array of Grade objects need to be implemented in this class.
The main method of the class that will mark the beginning of the program should have the
following sequence:
- Define a Scanner class related to System.in to get the input from the user.
- Ask the user and read the number of students in the class and the number of exams.
- Create an array of references to Grade objects based on the number of students in the class.
- Do an iteration in which the user is asked to enter the names and the grades for the
students. As part of the iteration process, objects of class Grade need to be created.
- Call the sort method in GradeSorter class (in case the sort method is static) or object (in
case the sort method is not static) to sort the array of Grade objects.
- Do an iteration in which the required output is generated.
b) The second solution is the same as in a), except that instead of an array of Grade objects, you
have to use an instance of the class ArrayList, available in java.util package, to store the students’
information (the field that stores the grades for each student may still be a regular array;
nevertheless, you can also use another instance of the generic class ArrayList to store those
grades).
pf2

Partial preview of the text

Download Assignment 1 - Intermediate Java Programming | COP 3804 and more Assignments Java Programming in PDF only on Docsity!

COP 3804 Homework

Due on May 17th^ 2007 in Class. (This document is 2 pages long)

Problem

A customer (instructor) wants a programmer (student) to write a program that allows entering the names and exams grades for students in the class, compute the average of each student’s exams grades and the corresponding letter grade, and finally display in alphabetical order the students’ names along with the grades, computed averages and letter grades.

Description

You need to present two solutions to this problem:

a) The first solution takes into account the use of an array to store the students’ information. You need to define:

  • A class Grade with fields to store the name (firstname, lastname) and an array of numbers representing the grades for the exams. This class needs to provide methods to retrieve and modify the values of those fields. Also, methods for obtaining the average and the letter grade associated to it need to be implemented (refer to the syllabus for a scale to compute the letter grades). Alternatively, you can choose to have the average and the letter grade as fields; however, this will introduce redundant information.
  • An array of Grade objects to store the information for all students.
  • A utility class GradeSorter to sort the array in alphabetical order. A sort method that takes an array of Grade objects need to be implemented in this class.

The main method of the class that will mark the beginning of the program should have the following sequence:

  • Define a Scanner class related to System.in to get the input from the user.
  • Ask the user and read the number of students in the class and the number of exams.
  • Create an array of references to Grade objects based on the number of students in the class.
  • Do an iteration in which the user is asked to enter the names and the grades for the students. As part of the iteration process, objects of class Grade need to be created.
  • Call the sort method in GradeSorter class (in case the sort method is static) or object (in case the sort method is not static) to sort the array of Grade objects.
  • Do an iteration in which the required output is generated.

b) The second solution is the same as in a), except that instead of an array of Grade objects, you have to use an instance of the class ArrayList , available in java.util package, to store the students’ information (the field that stores the grades for each student may still be a regular array; nevertheless, you can also use another instance of the generic class ArrayList to store those grades).

What to submit and How

1. A report containing the following: a. A front page showing your name, the course details, and the homework number. b. A section with the following contract:

I ________________ (write down your name), certify that this work is the sole result of my own effort, and I understand the consequences of engaging in academic misconduct as defined in the university academic policies.

c. A brief section describing the solution to the problem: especially what classes were defined and what/how methods were implemented. You need to provide the algorithm of any interesting method you’ve created (the algorithm needs to be in pseudocode). d. A small help section explaining how to run the program. e. A JavaDoc section of your code.

2. A zipped file containing the source code (the project).

You have two options to give the report and the zipped file to me: a. Send them by email. To make sure I receive the email before the class starts, send it the night before and double check with me next day. Or either, b. Bring a diskette or CD to hand in at the beginning of the class on the due date. You can also print the report.

Notes

This program is to be done individually. Refer to the syllabus on academic misconduct.

Sample inputs as well as expected output will be posted on the website.

Grading

Report – 25%

Code – 75% (Special attention will be paid to comments in the code.)