联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2020-06-13 11:30

JAVA Coursework (30 marks)

Suppose you need to process course information. You should design a

Course class, and Test class to handle course information.

1. Course class(20 marks)

The Course class should be able to create course, add and drop the student

name, scores, get the students and the number of students in a course, clear

all the students from a course, calculate average score and sort the average

score, and so on.

The Course class should include the following methods at least.

addStudent():

Function: add student and score

The array size should be automatically increased by creating a new larger

array and copy the contents of the current array to it when the arrays is full.

An exception will be thrown when score is negative and tip information is

displayed in caller.

dropStudent():

Function: drop student and score

The array contents should be automatically arranged when removing the

student from the course.

getAverage(): get each student average score

getSortStudent():get the sorted average score

setInformation():set the student information(name, score)

getNumberOfstudent: Return the number of students

getStudents(); Return to students

clear( ): Remove all students information from the course

toString(): override toString() to return course name, the number of

students, and created date.

compareTo(); override compareTo(), compare two course teaching hours,

return 1, 0,-1 when first one is bigger than, equal to, less than the second

one

2. Test class (10 marks)

Create 2 courses (Math, Physics), 3 students and scores for each courses as

shown below.

Math Physics

Jack 88 79

John 90 82

Mark 84 73

1. Print the all courses names, student name, and student score

2: Print each student average score

3. Sort each student average score and print them out

4. Set one student information and print updated student information

5. Drop one student and print updated student information

Assessment scheme

1: Implement and verify each method function

2: Good code structure: comments, identification, concise

Note

Java code can be named in your name(Pinyin)_ID .java format. Send me

your code before the deadline (June 16, 18.pm).


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp