Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(please use JAVA) A group of friends decide to run the Banff, Alberta, Marathon. Their names, times (marathon completion time in minutes), and number of

(please use JAVA)

A group of friends decide to run the Banff, Alberta, Marathon. Their names, times (marathon completion time in minutes), and number of years participated are given below:

image text in transcribed

Extend the AddressBook class from Problem 1(please see bottom) to store the additional data. Now, write a method to find the fastest runner. Print the name, address, and his/her time (in minutes) on three separate lines. Find the second fastest runner. Print the name, address, his/her time (in minutes), and the difference in time with the fastest runner.Compute the average time of completion taken by these runners. Finally, print the name and number of years participated for each runner if the runners time of completion is equal to or better than the average time of completion.

image text in transcribed

(please use JAVA)

PROBLEM 1 BELOW:

Create a class named AddressBook that has the following field names:firstName, middleName, lastName, homeAddress, businessPhone, homePhone, cellphone, skypeId, facebookId, and personalWebSite. Use appropriate data types to store the values for these fields in AddressBook objects.Create appropriate get and set methods to retrieve and assign values to these names. For example, getMiddleName(viveAddressBook) should return the middle name of the person Vive. Similarly, vive.setPersonalWebsite(url) should set the personal website of the person Vive to the specified URL object.Using the get and set methods, create a comparison method compareNames(name1, name2)that compares the first, middle, and last names of strings name1 and name2. Assume that name1and name2 follow the following format: FirstName M. LastName.Test your program for correct, partially correct (e.g., name string without the middleName), and incorrect inputs (e.g., phone number containing special characters)

1 Elena Brandon 3411 2 Thomas Molson 273 2 3 Hamilton Winn 278 5 4 Suzie Sarandin 3297 5 Philip Winne 4459 6 Alex Trebok 2753 7 Emma Pivoto 275 8 John Lenthen 243 1 9 James Lean 334 1 10 Jane Ostin 412 11 Emily Car 393 12 Daniel Hamshire 2994 13 Neda Bazdar 3433 14 Aaron Smith 3176 15 Kate Hen 265 8 BanffMarathonRunner Attributes + private int time + private int years Operations + public BanffMarathonRunner(String fn, String In, int min, int yr) + public int getTime + public int getYears + public static Banff Marathon Runner getFastestRunner(Banff MarathonRunner[] runners) + public static BanffMarathonRunner getSecondFastestRunner(BanffMarathonRunner[] runners) + public static double getAverage Time(Banff MarathonRunner[] runners) + public static String getAbove AverageRunners(BanffMarathonRunner[] runners) + public void setTime(int time) + public void setYears(int years) 1 Elena Brandon 3411 2 Thomas Molson 273 2 3 Hamilton Winn 278 5 4 Suzie Sarandin 3297 5 Philip Winne 4459 6 Alex Trebok 2753 7 Emma Pivoto 275 8 John Lenthen 243 1 9 James Lean 334 1 10 Jane Ostin 412 11 Emily Car 393 12 Daniel Hamshire 2994 13 Neda Bazdar 3433 14 Aaron Smith 3176 15 Kate Hen 265 8 BanffMarathonRunner Attributes + private int time + private int years Operations + public BanffMarathonRunner(String fn, String In, int min, int yr) + public int getTime + public int getYears + public static Banff Marathon Runner getFastestRunner(Banff MarathonRunner[] runners) + public static BanffMarathonRunner getSecondFastestRunner(BanffMarathonRunner[] runners) + public static double getAverage Time(Banff MarathonRunner[] runners) + public static String getAbove AverageRunners(BanffMarathonRunner[] runners) + public void setTime(int time) + public void setYears(int years)

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

Guidelines for Informative Speeches?

Answered: 1 week ago