Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Java class Student { private String name; private long id; private String courses[] = new String[5]; private int marks[] = new int[5]; public Student(String

Using Java image text in transcribed

class Student { private String name; private long id; private String courses[] = new String[5]; private int marks[] = new int[5]; public Student(String name, long id) { this.name = name; this.id = id; } public void addCourseAndMarks(String course, int mark) { for(int i=0; i 

Consider the Student class we had in homework#1 (you can use the Java code provided as the solutions of homework# 1). Modify the Student class such that we can sort an array of Student objects using the Arrays.sort() method of Java. We want to sort Students based on the number of courses they have in an ascending order(from the least number of courses to the most). After you modify the Student class, in the main0 method create an array of 3 Students, set values for each student as you wish using constructor or setter methods), pass your array to Arrays.sort0 to sort it. Then, go over the array of students and call display) for each student to see the sorted results

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions