Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please show ALL work to explain and show each step to how to get the answer Instructions: AccountList: Node: testList: 1. Add and implement the

Please show ALL work to explain and show each step to how to get the answer

Instructions:

image text in transcribed

AccountList:

image text in transcribed

Node:

image text in transcribed

testList:

image text in transcribed

1. Add and implement the following method in class AccountList. This method will create an instance of node and insert it to the linkedlist in decreasing order of account balance. void insert_in_order_balance (int v, string n, double b) 2. Add and implement the following method in class AccountList. This method will delete the accounts (node) in the linkedlist that have the same name as the parameter. In other words. If an account name matches the parameter, this account should be removed from the linkedlist. void remove (string name) The whole program has been written for you. Your job is to add these two methods to AccountList.java. Submission: modified AccountList.java public class AccountList private node head; public AccountList() { this.head= null; } public void addFront (int n, String s, double b) { node newNode = new node(n, s. b); newNode. next = head; head = newNode; 1 public void listallo { node temp = head; while(temp != null) C System.out.println(temp.account_number + "" temp. balance); temp = temp.next; } + temp.name ] public boolean updateBalance(int act, double newb) { node temp = head; while(temp != null) { if(temp.account_number--act) { temp. balance = newb; return true; } else temp = temp.next; } return false; } public void insert_in_order_balance(int n, String s, double b) { 1/ your code goes here ] public void remove(String name) { // your code goes here ] ) public class node public public int account_number; public String name; public double balance; public node next; public node(int account_number, String name, double balance) { this.name = name; this.account_number = account_number; this.balance = balance; this.next = null; } } public class testList { public public static void main(String[] args) { AccountList AL = new AccountList(); AL.insert_in_order_balance (1001, "John Kelly", 2000); AL.insert_in_order_balance (3003, "Jane Smith", 100); AL.insert_in_order_balance (2002, "James Smith", 200); AL.insert_in_order_balance (4004, "John Smith", 1300); System.out.println("Before remove operation:"); AL. listAll(); AL.remove("James Smith"); System.out.println(" After remove operation:"); AL. listAll(); } } /* if your classes are implemented correctly, you should see: Before remove operation: 1001 John Kelly 2000.0 4004 John Smith 1300.0 2002 James Smith 200.0 3003 Jane Smith 100.0 After remove operation: 1001 John Kelly 2000.0 4004 John Smith 1300.0 3003 Jane Smith 100.0 */

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

2. Employees and managers participate in development of the system.

Answered: 1 week ago