Question: I am trying to convert this C++ code into java. void Account_List::insert_in_order_balance(int v, string n, double b) { node * temp = new node( v,

I am trying to convert this C++ code into java.

void Account_List::insert_in_order_balance(int v, string n, double b) { node * temp = new node( v, n, b); if(head== NULL) head=temp; else if (temp->balance > head->balance) { temp->next = head; head= temp; return; } else { node * t1 = head; node * t2 = t1->next; while (t2 != NULL && temp->balance < t2->balance) { t1= t2; t2= t2->next; } temp->next = t2; t1->next = temp; } } void Account_List::remove(string n) { while(head!= NULL && head->name == n) { node * temp = head; head = head->next; delete temp; } if (head ==NULL) return; else { node * temp1 = head; node * temp2 = head->next; while (temp2 !=NULL) { if (temp2->name == n) { node * temp = temp2; temp2 = temp2->next; temp1->next = temp2; delete temp; } else { temp1 = temp2; temp2 = temp2->next; } } }

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!