Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help please java . Part 2: Practice Exercises (Time: 90 minutes) Exercise 4: Perform the following: - In the CircleArrayTest class, add a static method

help please java .
image text in transcribed
Part 2: Practice Exercises (Time: 90 minutes) Exercise 4: Perform the following: - In the CircleArrayTest class, add a static method called get.4verageArea (Circle circles/]) that returns the average area of all circles. Use the enhanced for loop. - In the main method get and print the average circle area. - Add an instance method called enlarge0 that takes a double scaleFactor as parameter and if it is greater than 1 , it multiplies the radius of the circle by this scaleFactor. If the scaleFactor is less than or equal to 1 it does nothing. - Add a static method called scaleUp (Circle ci roles [1) that enlarges cach circle in the circles array using a random number between 2 and 9 inclusive. - Use the above methods to scaleUp all the circles in your CircleArrayTest. Print the average area after the update. Exercise 5: In this excreise, create a package called event to store the following classes. A class called Student that has three fuelds: a student name, birth date and a list of important events. For the birthDate copy the Date class given at the end of this document to the cvents pachage. For the events field use an Arraytist of type Event, where Event is a class to be created to store the event's title and date. The following class diagram shows the different classes and their association. 1. Create the Event class as described in the class diagram and add all setters and getters. 2. Create the studient class as deseribed in the class diagram. Add all the getters and for the name field add a setter. 3. Write an addevent method that adds an event to the list of events. It should only add the event if it is not null. 4. Add a getEvent () method that searches the events list for an event with a title equal to the parameter value. Note: The string comparison should be made while ignoring the letter case (i.e. use the equals Ignorecase () method). The method should return null if the string is not found. Consult the Java API to explore the equals Ignorecase0 of the String class. 5. Add an overloaded getEvent () method that retums a list of all the Events in a given Month that is passed as a parameter. 6. Add a costring () method that returns a formatted String that contains the student name and all his/her events. Let the method compose the string to begin with the student name and birthDate in one line, and then a tabular list of all his/her events (a date and a title, each in a line). 7. Create a package called test and store the following StudentTest class in this package. Modify the Studentrest class to test the Student class methods: (addEvent O \& getEvent(O)

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

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions