Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Asked this question before and got a helpful explanation but couldnt understand the last few steps and there wasnt attached code to follow, could you

Asked this question before and got a helpful explanation but couldnt understand the last few steps and there wasnt attached code to follow, could you please attatch working code? - thank you

Just need some help please at the moment i can only get it to output the time recorded without the datum, in java using intellij, thanks

Task 3/4: Checkpoint 39

Modify the class Recorder to allow both the time (as it currently does) and a datum (an int) to be recorded. To do this, the event array will now store objects containing both a String and an int rather than Strings.

Run the program. The output produced should be: Event recorded at 10:53, datum = 45 Record of Wombat Detection events at [100,100] Event number 0 was recorded at 10:53 Event number 1 was recorded at 10:59 Event number 2 was recorded at 11:05 Event number 3 was recorded at 12:59 Event number 4 was recorded at 13:59 Event number 5 was recorded at 14:06

Modify the program from Task 2 as follows:

Change the value of EVENT_MAX to 10 (a maximum of 10 events can then be stored)

Add another class called EventInformation containing: - A private instance variable called eventTime (a String) - A private instance variable called eventDatum (an int). The purpose of the variable is to store additional information related to the event. For example, a wombats identifying number. - A constructor which takes a String and an integer as parameters and assigns them to the respective instance variables. - Accessor (getter) methods for the two instance variables.

Add the following code to the beginning of main in order to test the new class: EventInformation e = new EventInformation("10:53", 45); System.out.println("Event recorded at " + e.getEventTime() + ", datum = " + e.getEventDatum());

Remove the code just added to the start of main for testing your new class and modify the program as follows:

Change the declaration of event to be an array of EventInformation

Change the header of the method recordEvent to: public void recordEvent(String time, int datum) { ...

Change recordEvent so that it stores the values of time and datum in an EventInformation object, a reference to which is stored in an element of event.

Modify the first 3 calls to recordEvent in the main method so that an event datum of 20 is also passed as an actual parameter, and modify the last 3 calls to include an event datum of 10.

Change the method printEvents so that both the time and datum are printed (see example output below). Run the program. The output produced should be: Record of Wombat Detection events at [100,100] Event number 0 was recorded at 10:53 with datum = 20 Event number 1 was recorded at 10:59 with datum = 20 Event number 2 was recorded at 11:05 with datum = 20 Event number 3 was recorded at 12:59 with datum = 10 Event number 4 was recorded at 13:59 with datum = 10 Event number 5 was recorded at 14:06 with datum = 10

Once you are satisfied that your program produces the correct output press the check button.

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

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

What is the growth rate of GDP per capita?

Answered: 1 week ago