Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help please with the sort and average question * Retrieve a list, sorted in increasing order, * the information objects of all stored passengers. *

image text in transcribedimage text in transcribed

help please with the sort and average question

* Retrieve a list, sorted in increasing order, * the information objects of all stored passengers. * Hints: * 1. Override the compareTo' method in PassengerInfo class. * 2. Look up the Arrays.sort method in Java API. * @return A sorted list of information objects of all passengers. public PassengerInfo[] getSortedPassengerInfo() { /** * Retrieve the average ticket paid by all passengers in flight with id 'id'. * @param id id of some flight * @return average ticket paid by all passengers in a flight with id 'id' * @throws IdNotFoundException if id is not an existing flight id */ public double getAverageTicketAmount (Integer id) throws IdNotFoundException { @Test public void test_getSortedPassenger Info_normal() { addFlights(); addPassengers(); PassengerInfo[] sorted = db.getSortedPassengerInfo(); PassengerInfo[] expected = { new PassengerInfo("Heeyeon", 10, 2000), new PassengerInfo("Sunhye" 30, 2577), new PassengerInfo("Jiyoon" 50, 2577), new PassengerInfo("Yuna" 50, 990), new PassengerInfo("Suyeon" 70, 2577), new PassengerInfo("Jaebin" , 70, 2000), new PassengerInfo("Jihye" , 70, 990), assertEquals(7, sorted.length); assertArray Equals(expected, sorted)

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Develop successful mentoring programs. page 400

Answered: 1 week ago