Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Create a class named AddressBook that has the following field names: firstName, middleName, lastName, homeAddress, businessPhone, homePhone, cellphone, skypeId, facebookId, and personalwebSite. Use appropriate

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

1. 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 name1 and 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). Attributes +private String businessPhone +private String cel Phone +private String facebookld + private String firstName + private String homeAddress +private String homePhone + private String lastName + private String middleName +private String personalWebSite + private String skypeld +public AddressBook(String fn, String mn, String In, String homeAddress, String businessPhone, String homePhone, String cellPhone, String skypeld, String facebookld, String personalWebSite) + public AddressBook(String fn) + public AddressBook(String fn, String mn) +public AddressBook(String fn, String mn, String In) + public static String compareNames(String namel, String name2) +public String getBusinessPhoneO + public String getCellPhoneO +public String getFacebookldo + public String getFirstNameO +public String getHomeAddressO +public String getHomePhone0 +public String getLastName) + public String getMiddleName public String getPersonalWebSite0 + public String getSkypeld0 + public void +public void setCellPhone(String cellPhone) +public void setFacebookld(String facebookld) +public void setFirstName(String firstName) +public void setHomePhone(String homePhone) + public void setLastName(String lastName) + public void setMiddleName(String middleName) +public void setPersonalWebSite(String personalWebsite) + public void setskypeld (String skypeld) A group of AU friends decide to run the Banff, Alberta, Marathon. Their names, times (marathon completion time in minutes), and number of years participated are given below: 1 Elena Brandon 341 1 2 Thomas Molson 273 2 3 Hamilton Winn 278 5 4 Suzie Sarandin329 7 445 9 275 3 275 4 243 1 3341 412 1 393 4 12 Daniel Hamshire 2994 343 3 317 6 265 8 5Philip Winne 6 Alex Trebok 7Emma Pivoto 8John Lenthen 9 James Lean 10 Jane Ostin 11Emily Car 13 Neda Bazdar 14 Aaron Smith 15Kate Hen Extend the AddressBook class from Problem 1 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 runner's time of completion is equal to or better than the average time of completion. BanffMarathonRunner a Attributes +private int time +private int years Operations public BanffMarathonRunner(String fn, String In, int min, int yr) +public int getTime0) +public int getYears() public static BanffMarathonRunner getFastestRunner(BanffMarathonRunner[] runners) public static BanffMarathonRunner getSecondFastestRunner(BanffMarathonRunner[] runners) +public static double getAverageTime(BanffMarathonRunner[] runners) +public static String getAboveAverageRunners(BanffMarathonRunner[] runners) +public void setTime(int time) +public void setYears(int years) Solve the following problem using a program: Suppose you save $100 each month into a savings account with an annual interest rate of 5%. Thus, the monthly interest rate is 0.05/12-0.00417 After the first month, the value in the account becomes 100(10.00417) 100.417 After the second month, the value in the account becomes (100 100.417)(10.00417) 201.252 And after the third month, the value in the account becomes (100 201.252) * (1 0.00417)- 302.507 and so on. Write a program that randomly generates monthly savings amounts for the 15 runners in Problem 4. Each monthly saving should be in the range of $100 to $800. Extend the AddressBook class to store the monthly savings generated by the random number generator. Then, display the final account value for each of the 15 runners. EmployeeSavings a Attributes + private double accountValue + private double[] monthlyInterests + private double[] monthlySavings +public static final double ANNUAL_INTEREST_RATE Operations + public double getAccountValue0) + public double[] calculateInterests) +public double[] generateMonthlySavings) +public double[] getMonthlyInterests) public double[] getMonthlySavings0 +public EmployeeSavings(String fn, String In) public EmployeeSavings(String fn, String In, double[] d1, double[] d2) +public static String getReport(EmployeeSavings arr)

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

What is a composite material?

Answered: 1 week ago