Question: Can someone add comments that explain how the algorithm works and what data processing it is doing? 1.Create Class class Customer{ int custNo; String name;

Can someone add comments that explain how the algorithm works and what data processing it is doing?

1.Create Class class Customer{ int custNo; String name; String add; String doj; double price; } 2. Create Lists of Customer objects to store data List listpastjobs; List listfuturejobs; List listalljobs; 3. Store data from file while(!eof) { Customer cust = new Customer(File pastCutomers.read) listpastjobs.add(cust) } while(!eof) { Customer cust = new Customer(File futureCutomers.read) listfuturejobs.add(cust) }

4.Assign Initial indexes as 0 int i =0, j = 0; 5. Run the loop to merge the two lists while(i!=listpastjobs.size() && j! = listfuturejobs.size()) { if(listfuturejobs.get(j).custNo < listpastjobs.get(i).custNo) { listalljobs.add(listfuturejobs.get(j)); j++; } else if(listfuturejobs.get(j).custNo > listpastjobs.get(i).custNo) { listalljobs.add(listpastjobs.get(i)); i++; } else if(listfuturejobs.get(j).custNo < listpastjobs.get(i).custNo) { listalljobs.add(listfuturejobs.get(j)); j++;i++; } }

6. Store the listalljobs in a new file for(int i =0; i< listalljobs.size;i++) { File allCustomers.write(listalljobs.get(i)); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!