Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. You need to implement a program that synchronizes two arrays of data, where the arrays are updated based on each other, after the operation

image text in transcribed

3. You need to implement a program that synchronizes two arrays of data, where the arrays are updated based on each other, after the operation is complete the two arrays would have the same data. The arrays containing the copies of the data have two rows: one for a flag A or B, and the other contains the data. If the flags in both arrays are A then the data will not be copied. If the flag is in one array and B in the second, the corresponding entry will be copied to the second array, A to B. But if the flag is B the data will be copied from the second array to the first array and the flag would be set to A to indicate that the data is synchronized. a. Create a class called Data b. Define the variable that will hold an array of data as a member of the Data class c. Create two instances of the Data class and initialize their array variables with the data given below. Array X A A B A 75 70 60 5 81 75 Array Y B B A B B 75 80 10 65 15 20 d. Create a class called Synchronizer, with a static method synchronize that takes two instances of the Data class and synchronizes their data arrays. The method will update the appropriate array based on the A, B flags. Pass the instance for Array X as a first parameter and the instance for Array Y as a second. e. Create the client class to test your code f. The program should output: i. The data is now synchronized." if the arrays had different values. ii. OR The data is already synchronized." if the arrays were already identical

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_2

Step: 3

blur-text-image_3

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

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

7. Explain the role of popular culture in stereotyping.

Answered: 1 week ago