國外某所大學的java作業題

來源:互聯網
上載者:User

 

Student Application

Create a base class Student that has Student ID (int), Student’s name (String), student’s address (String), and letterGrade (char). Now create classes UnderGradStudent, GradStudent and NonDegreeStudent that inherit from Student.

 

The UnderGradStudent has additional properties such as major (String), year (freshman, sophomore, etc), exam1Score (double), exam2Score (double), and exam3Score (double).

 

GradStudent has properties such as department (String), advisor (Person), thesisGrade (char) and examScore (double).

 

The NonDegreeStudent has properties such as creditHours (int), assignScore (double) and examScore (double). Create constructor, accessor, mutator methods for all these classes.

 

Letter Grade for each student type is to be computed as follows:

1.  UnderGradStudent:  gpa is computed based on the following information

Graded activity

Maximum Score

Weight

Exam1Score

50

25%

Exam2Score

100

45%

Exam3Score

250

30%

 

TotalScore

LetterGrade

>=85

A

>=70

B

>=60

C

< 60

F

 

2.  GradStudent: 

ThesisGrade

ExamScore

LetterGrade

A

 Does not matter

A

B

>= 90

A

B

>= 80

B

B

< 80

C

C

>=80

C

C

< 80

F

 

3.  NonDegreeStudent: 

Graded activity

Maximum Score

Weight

AssgnScore

250

25%

ExamScore

100

75%

 

TotalScore

LetterGrade

>=80

A

>=70

B

>=55

C

< 55

F

Now write a driver program to do the following:

 

1.  Accept input for new Students

2.  Accept advisor details for an advisor and then list the names of all Students who have the same advisor.  You will use the method in the Person class for this functionality.

3.  List the name of the Students along with their letter grade.

4.  Display student information for all the students that are there in the system.

5.  Exit the system after writing all information to a file. //寫檔案

 

The Person class is as described below:

It contains four instance variables: one each for the name, area, title, andyearsOfEmployment.  It should have appropriate constructors andaccessor and
mutator methods. In addition, it should have a method to check if two persons are the same.  This method will accept another person object as a parameter and check if the calling object and the parameter object both have the same name,
area, title and yearsOfEmployment.  If so, the method should return true, else it returns false.  The GradStudent class definition should include a Person type as an instance variable.

 

See sample .jar (and .dat) program provided.

 

To execute the jar file

·         Download the .jar file and the .dat file. Put them in the same folder.  At the command prompt type injava –jar StudentApp.jar.

·         This will enable you to see how the application should work.

 

StudentApp.jar:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.