Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

CSE 215: Programming Language II

Sec – 2 & 3, Faculty: SvA


Programming Assignment # 1, Marks: 100
Deadline: 26.02.2018
Instruction:
1. Use A4 sized papers
2. Answer everything using a pen. Pencil is not allowed.
3. Write your answers on both sides of the papers. If you leave any side then you will be
penalized.
4. Use a separate paper on top of your answer script that must include course name,
section number, current semester, your name, your ID, Homework number. Use the
format provided in the forum.

Problem Statement
Suppose that you need to develop a computer program using Java to maintain all sorts of
students‟ records for your CSE215 class. The course management will be as follows:

 A maximum of 35 students in a class.


 A particular student‟s name, ID, his total score and finally his/her grade should be saved.

The following methods should work as mentioned:

 void main(String[] args): Complete the code as directed by the comments


inside. (20 points)
 void input(String[] studentNames, int[] studentID): This method
should take as an input two empty arrays and fill them up after taking inputs from user. (5
points)
 void updateScore(double[] scores, double totalExamScore):
This method should take as an input a double variable that is the total score of any
particular exam. Inside the method, you should be able to input score of students for any
particular exam after verifying that the score is valid based on the totalExamScore.
(10 points)
 double maxScore(double[] scores): This method should take an array of
double values and return the maximum double value among them. (5 points)
 char calculateGrade(double score, double[] gradeScale): This
method takes the score as double value and an array that contains the threshold values for
each letter grades. According to the gradeScale array‟s scores, calculate the grade
output it. (10 points)
 int[] sort(int[] studentID): This method takes an integer array that
contains the students‟ IDs and create another integer array that stores the index values of
the array after sorting the input array in ascending order. (10 points)
 int[] sort(double scores): This method takes a double array that contains the
students‟ scores and create another integer array that stores the index values of the array
after sorting the input array in ascending order. (10 points)

Complete the code in CourseManagement.java that has been given to you and answer the
following questions based on your analysis of the work.

1. There are two methods, both named as „sort‟. Which object-oriented feature allowed you
to do that? Describe briefly. (5 points)
2. Here information of the students is stored into separate arrays and everything is
maintained according to the index number only. What could be a challenge if you want to
modify any information of a student or add/remove a student from the class record? (5
points)
3. In the code in CourseManagement.java three ways have been adopted for inserting
comments. How are they different? (5 points)
4. The initial version of CourseManagement.java contains 4 errors. What type of errors are
these? Explain briefly why these errors occurred and how you can remove them. (5
points)
5. There are 10 points for coding style.

Note: You have to follow the standard threshold scores for each grade as per NSU‟s grading
policy while taking input for double[] gradeScale.

Submission
 Theoretical questions (1-4) need to be submitted at the beginning of theory classes of each section
on 26th February, 2018.
 The CourseManagement.java file need to be emailed to [email protected]
with the subject line: “[CSE215] Programming Assignment 1 submission”. Please make
sure you use these specific words for correct filtering. In the body of the email include
your full name, ID, and Section number. The deadline for submitting this 11:59 PM on
25 February, 2018.

You might also like