Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question
100%

please do in java

firstname_lastname_assignment_6.zip
├── library
│   └── docs
│   └── StudentGrades.java

Folder Structure

Your project will contain three sub-directories:

  1. library
  2. test

In the library directory, create the StudentGrades class. In the test directory, create the test application (Part 1). 

StudentGrades Class

Write a class encapsulating the concept of Student Grades. Use the class diagram above as well as the specific requirements below to develop your class:

Class Members

  • The attribute grades will store grades for students.
  • StudentGrades(int) -  Initializes grades to a new array with the specified number of elements. The grade values are zero.
  • StudentGrades(int[]) - Initializes grades to the specified array. Ensure that the reference to the grades is not accessible outside of the class.
  • copyArray(int[]) : int[] - Returns a copy of the specified array.
  • getGrades() : int[] - Returns a copy of the grades.
  • setGrades(int[]) : void - Sets the grades. Ensure that the reference to the grades is not accessible outside of the class.
  • getSortedGrades() : int[] - Returns a new array containing the values of the grades attribute sorted in ascending order.
  • getHighestGrade() : int - Returns the value of the highest grade in the grades.
  • getAverageOfGrades() : double - Returns the mean average of the values in the grades array.
    • Formula: (grades[0] + grades[1] + …. grades[n]) / number of elements in array
  • The toString will return a String representation of the class in the following format:

toString Format

===================
Student Grade
===================
1 {first element value}
2 {second element value}
...
n {nth element value}
Example
===================
Student Grade
===================
1 79 2 54
...
n 82
Class Diagram
Student Grades
-grades: int[]
+StudentGrades (numberOfStudents : int)
+StudentGrades (grades: int[])
-copyArray(toCopy: int[]): int[]
+getGrades() int[]
+ setGrades (grades int[]): void
+getSorted Grades(): int[]
+getHighestGrade(): int
+getAverageOfGrades(): double
+toString(): String
expand button
Transcribed Image Text:Class Diagram Student Grades -grades: int[] +StudentGrades (numberOfStudents : int) +StudentGrades (grades: int[]) -copyArray(toCopy: int[]): int[] +getGrades() int[] + setGrades (grades int[]): void +getSorted Grades(): int[] +getHighestGrade(): int +getAverageOfGrades(): double +toString(): String
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education