1. Create a class named Student. Three private data fields for Student include an integer studentId, a String name, and a double finalMarks and one public final data field SIZE (5) that holds the maximum size of the array. Methods include a constructor that requires values for all three StudentId, name and finalMarks data fields, as well as get and set methods for each of these three data fields. Write a program named DemoStudent that declares an array of five Student objects. Using a loop, set each ID number to 9999, each name to XYZ and each marks value to zero. Display the Student objects. Save the files as Student.java and DemoStudent1.java. Modify the DemoStudent1 class so each Student has a successive ID number from 101 through 105, name XYZ that remains same and a marks value that ranges from 55 to 95 increasing by 10 for each successive Student. Save the file as DemoStudent2.java.  2. Next, modify the program that allows you to store an array that can hold any number of Student objects up to 5. Prompt the user for text input using JOptionPane.showInputDialog that asks "Do you want to Add objects (Press A) or Quit (Press Q)??” If user decides to quit, then, just exit. While the user decides to Add objects, call an addOption () method which proceed as follows:  Generate an error message if the array is full. Otherwise, prompt the user for an ID number. If the ID number already exists in the array, issue an error message. Otherwise, prompt the user for a name value and a marks value and add the new object to the array. (For this portion, you can use Scanner class). Finally, display all Student objects using display() method.  If number of objects in the array is two or more, call display_sorted() method which asks the user about choice of sorting objects by studentId or by name and then, display the student Objects in Sorted Order  Save the application as DemoStudent3.java.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

1. Create a class named Student. Three private data fields for Student include an integer studentId,
a String name, and a double finalMarks and one public final data field SIZE (5) that holds the
maximum size of the array. Methods include a constructor that requires values for all three
StudentId, name and finalMarks data fields, as well as get and set methods for each of these three
data fields. Write a program named DemoStudent that declares an array of five Student objects.
Using a loop, set each ID number to 9999, each name to XYZ and each marks value to zero.
Display the Student objects. Save the files as Student.java and DemoStudent1.java.
Modify the DemoStudent1 class so each Student has a successive ID number from 101 through
105, name XYZ that remains same and a marks value that ranges from 55 to 95 increasing by 10
for each successive Student. Save the file as DemoStudent2.java. 
2. Next, modify the program that allows you to store an array that can hold any number of Student
objects up to 5. Prompt the user for text input using JOptionPane.showInputDialog that asks "Do
you want to Add objects (Press A) or Quit (Press Q)??”
If user decides to quit, then, just exit. While the user decides to Add objects, call an addOption ()
method which proceed as follows:
 Generate an error message if the array is full. Otherwise, prompt the user for an ID number. If
the ID number already exists in the array, issue an error message. Otherwise, prompt the user
for a name value and a marks value and add the new object to the array. (For this portion, you
can use Scanner class). Finally, display all Student objects using display() method.
 If number of objects in the array is two or more, call display_sorted() method which asks the
user about choice of sorting objects by studentId or by name and then, display the student
Objects in Sorted Order
 Save the application as DemoStudent3.java.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 7 steps with 9 images

Blurred answer
Knowledge Booster
Passing Array as Argument
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage