INFO5100 Assignment 6 Solved

35.00 $

Category:

Description

Rate this product

Homework 6

Question 1

For the class,

public class Student { private int id;

private String name; private double gpa; private Date dateOfBirth;

}

Write Custom Sorting by implementing the following comparators
  1. NameComparator: Student objects should be sorted in ascending order by ‘name’ field of the object;
  2. GpaComparator: Student objects should be sorted in descending order by ‘gpa’ field of the object;
  3. DateOfBirthComparator: Student objects should be sorted in ascending order by ‘dateOfBirth’ field of the object;
Then in the main method, create a List of Student objects and print the list of
objects 3 times with the following logic.

1. Sort by ascending order of ‘name’
2. Sort by descending order of ‘gpa’
3. Sort by ascending order of ‘dateOfBirth’

Question 2

Write a class called 'DrivingLicenseApplication' to read input from the keyboard which
take dateOfBirth of Date datatype. If the age is below 16 (For example 14), then throw
and catch and exception which prints the message.
The age of the applicant is 14 which is too early to apply for a driving license
  • Assignment6-kzdgyo.zip