You are the manager of the train depot. One of your tasks is to efficiently order...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You are the manager of the train depot. One of your tasks is to efficiently order the train cars so that it is easy to attach and detach them. In this assignment, you will implement Train Cars program that reads car details from the file called car.txt (given) and stores them in a Linked List data structure. Cars in the train are linked in a specific order. Each car in the train contains various materials that must be attached and detached in the most efficient manner possible. Each car (node of type Car) has a stop number, factory name, material name. " " Stop number - determines which stop the car must be detached, use this to order the train cars. They should be ordered either in increasing or decreasing stop numbers. Factory Name - name of the factory at which the car must be detached Material Name - name of the material being transported in the car. For example, the Jiffy Mix plant at stop 2 needs sugar, flour, cornmeal, etc. Write the program to perform each operation specified to get materials from source to destination efficiently. The train needs to be created as a linked list which has a car at each node. Your program needs to be menu based and have the following capabilities: " " Display all the train car details Attach a train car (given Factory Name, Stop Number, Material Name) Detach cars at factory (given Factory Name) " Search a train car (given Factory Name) Merge two train cars (given update.txt) Here is what the menu looks like Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Steps to follow 1. You will need to write the class Car.java that is used to create cars. The shell is given below: class Car { public String factory; public int stop; public String material; Car next; public Car(){ // default constructor } public Car(String fact, int s, String m){ // regular constructor sets next to null } public Car(String fact, int s, String m, Car next){ // regular constructor sets } } this next-next; Office Dictation 2. You will need to write the class Train.java that creates the linked list and offers methods to manage the linked list. It should have one variable called front of type Car that points to the beginning of the linked list. It should have two constructors, a default and a regular constructor. The regular constructor reads the car details from the file "car.txt" and creates the train. 3. The class Train.java creates and manages a linked list of cats and should implement the following methods: public Train(String carFile) throws FileNotFoundException //constructor: reads each train car details from the file into the LinkedList public void detach (String factoryName) //remove a car given factoryName, this should delete the node in the LinkedList. public void attach(String factoryName, int stopNumber, String materialName) // add a new car(node) to the LinkedList public void search(String factoryName) // search for cars that correspond the given factory name. Note there may be // more than one car so you may use helper method that follows public List<String> getCars (String factoryName) // material name lookup given factory name public void display Train Cars() // display all the train cars in sorted order public void merge(String update) // reads from update.txt and merges it with the new train car. Merge two LinkedLists, and should maintain the sorted order. 4. Read the given text file car.txt and split the input strings into 3 tokens using String tokens[]= inline split(","); tokens[0] is Factory Name, tokens[1] is Stop Number, tokens[2] is Material Name as a single string. The tokens[] should be passed to the LinkedList. 5. When the node is added to the Linked List, it should always be in the sorted order, i.e., if the stop number being added is less than the existing stop numbers in the LinkedList, add the node to the head of the Linked List. if the stop number being added is greater than the existing stop numbers in the LinkedList, add the node to the tail of the Linked List. Otherwise, add the node in the appropriate position of the stop number. Here is what the User Interface for the Train Cars should look like: Main menu: Should accept upper and lower case: Option d: display all car details Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Jiffy Mix 10 corn Jiffy Mix 10 sugar Option a: attach a car Note: when you attach the car, the car should be placed in the sorted order. Please enter your choice a Please enter the Factory Name Foster Farms Please enter the Stop Number 9 Please enter the Material Name meat Adding a new car - Foster Farms 9 meat Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search the train cars Enter M to Merge two train cars Enter Q to Quit Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Jiffy Mix 10 corn Jiffy Mix 10 sugar Office Dictation Option r: detach car at factory a. Given a factory name, all cars belonging to that factory must be detached Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Please enter your choice r Please enter the Factory Name Jiffy Mix The car is detached at Jiffy Mix After detaching the car, the display should look like Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Options: search a train car a. Given a factory name, all the materials belonging to the factory must be displayed Please enter your choice s Enter the Factory Name Cargill The material in the car is eggs Option m: merge two train cars Note: while merging the cars the order should be maintained. Please enter your choice m Displaying the existing cars Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Displaying the new cars Nestle 1 candy General Mills 3 baking products Mars 6 candy Smithfield foods 12 cheese Pepsi 20 drink mixes Displaying the merged car details Please enter your choice d Nestle 1 cereals Nestle 1 candy Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices General Mills 3 baking products Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Mars 6 candy Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Smithfield foods 12 cheese Pepsi 20 drink mixes Option q: quit Please enter your choice q Good Bye! Nestle, 1, candy Smithfield foods,12,cheese Pepsi, 20, drink mixes Mars, 6, candy General Mills, 3, baking products update.txt You are the manager of the train depot. One of your tasks is to efficiently order the train cars so that it is easy to attach and detach them. In this assignment, you will implement Train Cars program that reads car details from the file called car.txt (given) and stores them in a Linked List data structure. Cars in the train are linked in a specific order. Each car in the train contains various materials that must be attached and detached in the most efficient manner possible. Each car (node of type Car) has a stop number, factory name, material name. " " Stop number - determines which stop the car must be detached, use this to order the train cars. They should be ordered either in increasing or decreasing stop numbers. Factory Name - name of the factory at which the car must be detached Material Name - name of the material being transported in the car. For example, the Jiffy Mix plant at stop 2 needs sugar, flour, cornmeal, etc. Write the program to perform each operation specified to get materials from source to destination efficiently. The train needs to be created as a linked list which has a car at each node. Your program needs to be menu based and have the following capabilities: " " Display all the train car details Attach a train car (given Factory Name, Stop Number, Material Name) Detach cars at factory (given Factory Name) " Search a train car (given Factory Name) Merge two train cars (given update.txt) Here is what the menu looks like Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Steps to follow 1. You will need to write the class Car.java that is used to create cars. The shell is given below: class Car { public String factory; public int stop; public String material; Car next; public Car(){ // default constructor } public Car(String fact, int s, String m){ // regular constructor sets next to null } public Car(String fact, int s, String m, Car next){ // regular constructor sets } } this next-next; Office Dictation 2. You will need to write the class Train.java that creates the linked list and offers methods to manage the linked list. It should have one variable called front of type Car that points to the beginning of the linked list. It should have two constructors, a default and a regular constructor. The regular constructor reads the car details from the file "car.txt" and creates the train. 3. The class Train.java creates and manages a linked list of cats and should implement the following methods: public Train(String carFile) throws FileNotFoundException //constructor: reads each train car details from the file into the LinkedList public void detach (String factoryName) //remove a car given factoryName, this should delete the node in the LinkedList. public void attach(String factoryName, int stopNumber, String materialName) // add a new car(node) to the LinkedList public void search(String factoryName) // search for cars that correspond the given factory name. Note there may be // more than one car so you may use helper method that follows public List<String> getCars (String factoryName) // material name lookup given factory name public void display Train Cars() // display all the train cars in sorted order public void merge(String update) // reads from update.txt and merges it with the new train car. Merge two LinkedLists, and should maintain the sorted order. 4. Read the given text file car.txt and split the input strings into 3 tokens using String tokens[]= inline split(","); tokens[0] is Factory Name, tokens[1] is Stop Number, tokens[2] is Material Name as a single string. The tokens[] should be passed to the LinkedList. 5. When the node is added to the Linked List, it should always be in the sorted order, i.e., if the stop number being added is less than the existing stop numbers in the LinkedList, add the node to the head of the Linked List. if the stop number being added is greater than the existing stop numbers in the LinkedList, add the node to the tail of the Linked List. Otherwise, add the node in the appropriate position of the stop number. Here is what the User Interface for the Train Cars should look like: Main menu: Should accept upper and lower case: Option d: display all car details Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Jiffy Mix 10 corn Jiffy Mix 10 sugar Option a: attach a car Note: when you attach the car, the car should be placed in the sorted order. Please enter your choice a Please enter the Factory Name Foster Farms Please enter the Stop Number 9 Please enter the Material Name meat Adding a new car - Foster Farms 9 meat Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search the train cars Enter M to Merge two train cars Enter Q to Quit Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Jiffy Mix 10 corn Jiffy Mix 10 sugar Office Dictation Option r: detach car at factory a. Given a factory name, all cars belonging to that factory must be detached Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Please enter your choice r Please enter the Factory Name Jiffy Mix The car is detached at Jiffy Mix After detaching the car, the display should look like Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Options: search a train car a. Given a factory name, all the materials belonging to the factory must be displayed Please enter your choice s Enter the Factory Name Cargill The material in the car is eggs Option m: merge two train cars Note: while merging the cars the order should be maintained. Please enter your choice m Displaying the existing cars Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Displaying the new cars Nestle 1 candy General Mills 3 baking products Mars 6 candy Smithfield foods 12 cheese Pepsi 20 drink mixes Displaying the merged car details Please enter your choice d Nestle 1 cereals Nestle 1 candy Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices General Mills 3 baking products Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Mars 6 candy Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Smithfield foods 12 cheese Pepsi 20 drink mixes Option q: quit Please enter your choice q Good Bye! Nestle, 1, candy Smithfield foods,12,cheese Pepsi, 20, drink mixes Mars, 6, candy General Mills, 3, baking products update.txt You are the manager of the train depot. One of your tasks is to efficiently order the train cars so that it is easy to attach and detach them. In this assignment, you will implement Train Cars program that reads car details from the file called car.txt (given) and stores them in a Linked List data structure. Cars in the train are linked in a specific order. Each car in the train contains various materials that must be attached and detached in the most efficient manner possible. Each car (node of type Car) has a stop number, factory name, material name. " " Stop number - determines which stop the car must be detached, use this to order the train cars. They should be ordered either in increasing or decreasing stop numbers. Factory Name - name of the factory at which the car must be detached Material Name - name of the material being transported in the car. For example, the Jiffy Mix plant at stop 2 needs sugar, flour, cornmeal, etc. Write the program to perform each operation specified to get materials from source to destination efficiently. The train needs to be created as a linked list which has a car at each node. Your program needs to be menu based and have the following capabilities: " " Display all the train car details Attach a train car (given Factory Name, Stop Number, Material Name) Detach cars at factory (given Factory Name) " Search a train car (given Factory Name) Merge two train cars (given update.txt) Here is what the menu looks like Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Steps to follow 1. You will need to write the class Car.java that is used to create cars. The shell is given below: class Car { public String factory; public int stop; public String material; Car next; public Car(){ // default constructor } public Car(String fact, int s, String m){ // regular constructor sets next to null } public Car(String fact, int s, String m, Car next){ // regular constructor sets } } this next-next; Office Dictation 2. You will need to write the class Train.java that creates the linked list and offers methods to manage the linked list. It should have one variable called front of type Car that points to the beginning of the linked list. It should have two constructors, a default and a regular constructor. The regular constructor reads the car details from the file "car.txt" and creates the train. 3. The class Train.java creates and manages a linked list of cats and should implement the following methods: public Train(String carFile) throws FileNotFoundException //constructor: reads each train car details from the file into the LinkedList public void detach (String factoryName) //remove a car given factoryName, this should delete the node in the LinkedList. public void attach(String factoryName, int stopNumber, String materialName) // add a new car(node) to the LinkedList public void search(String factoryName) // search for cars that correspond the given factory name. Note there may be // more than one car so you may use helper method that follows public List<String> getCars (String factoryName) // material name lookup given factory name public void display Train Cars() // display all the train cars in sorted order public void merge(String update) // reads from update.txt and merges it with the new train car. Merge two LinkedLists, and should maintain the sorted order. 4. Read the given text file car.txt and split the input strings into 3 tokens using String tokens[]= inline split(","); tokens[0] is Factory Name, tokens[1] is Stop Number, tokens[2] is Material Name as a single string. The tokens[] should be passed to the LinkedList. 5. When the node is added to the Linked List, it should always be in the sorted order, i.e., if the stop number being added is less than the existing stop numbers in the LinkedList, add the node to the head of the Linked List. if the stop number being added is greater than the existing stop numbers in the LinkedList, add the node to the tail of the Linked List. Otherwise, add the node in the appropriate position of the stop number. Here is what the User Interface for the Train Cars should look like: Main menu: Should accept upper and lower case: Option d: display all car details Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Jiffy Mix 10 corn Jiffy Mix 10 sugar Option a: attach a car Note: when you attach the car, the car should be placed in the sorted order. Please enter your choice a Please enter the Factory Name Foster Farms Please enter the Stop Number 9 Please enter the Material Name meat Adding a new car - Foster Farms 9 meat Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search the train cars Enter M to Merge two train cars Enter Q to Quit Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Jiffy Mix 10 corn Jiffy Mix 10 sugar Office Dictation Option r: detach car at factory a. Given a factory name, all cars belonging to that factory must be detached Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Please enter your choice r Please enter the Factory Name Jiffy Mix The car is detached at Jiffy Mix After detaching the car, the display should look like Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Options: search a train car a. Given a factory name, all the materials belonging to the factory must be displayed Please enter your choice s Enter the Factory Name Cargill The material in the car is eggs Option m: merge two train cars Note: while merging the cars the order should be maintained. Please enter your choice m Displaying the existing cars Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Displaying the new cars Nestle 1 candy General Mills 3 baking products Mars 6 candy Smithfield foods 12 cheese Pepsi 20 drink mixes Displaying the merged car details Please enter your choice d Nestle 1 cereals Nestle 1 candy Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices General Mills 3 baking products Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Mars 6 candy Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Smithfield foods 12 cheese Pepsi 20 drink mixes Option q: quit Please enter your choice q Good Bye! Nestle, 1, candy Smithfield foods,12,cheese Pepsi, 20, drink mixes Mars, 6, candy General Mills, 3, baking products update.txt You are the manager of the train depot. One of your tasks is to efficiently order the train cars so that it is easy to attach and detach them. In this assignment, you will implement Train Cars program that reads car details from the file called car.txt (given) and stores them in a Linked List data structure. Cars in the train are linked in a specific order. Each car in the train contains various materials that must be attached and detached in the most efficient manner possible. Each car (node of type Car) has a stop number, factory name, material name. " " Stop number - determines which stop the car must be detached, use this to order the train cars. They should be ordered either in increasing or decreasing stop numbers. Factory Name - name of the factory at which the car must be detached Material Name - name of the material being transported in the car. For example, the Jiffy Mix plant at stop 2 needs sugar, flour, cornmeal, etc. Write the program to perform each operation specified to get materials from source to destination efficiently. The train needs to be created as a linked list which has a car at each node. Your program needs to be menu based and have the following capabilities: " " Display all the train car details Attach a train car (given Factory Name, Stop Number, Material Name) Detach cars at factory (given Factory Name) " Search a train car (given Factory Name) Merge two train cars (given update.txt) Here is what the menu looks like Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Steps to follow 1. You will need to write the class Car.java that is used to create cars. The shell is given below: class Car { public String factory; public int stop; public String material; Car next; public Car(){ // default constructor } public Car(String fact, int s, String m){ // regular constructor sets next to null } public Car(String fact, int s, String m, Car next){ // regular constructor sets } } this next-next; Office Dictation 2. You will need to write the class Train.java that creates the linked list and offers methods to manage the linked list. It should have one variable called front of type Car that points to the beginning of the linked list. It should have two constructors, a default and a regular constructor. The regular constructor reads the car details from the file "car.txt" and creates the train. 3. The class Train.java creates and manages a linked list of cats and should implement the following methods: public Train(String carFile) throws FileNotFoundException //constructor: reads each train car details from the file into the LinkedList public void detach (String factoryName) //remove a car given factoryName, this should delete the node in the LinkedList. public void attach(String factoryName, int stopNumber, String materialName) // add a new car(node) to the LinkedList public void search(String factoryName) // search for cars that correspond the given factory name. Note there may be // more than one car so you may use helper method that follows public List<String> getCars (String factoryName) // material name lookup given factory name public void display Train Cars() // display all the train cars in sorted order public void merge(String update) // reads from update.txt and merges it with the new train car. Merge two LinkedLists, and should maintain the sorted order. 4. Read the given text file car.txt and split the input strings into 3 tokens using String tokens[]= inline split(","); tokens[0] is Factory Name, tokens[1] is Stop Number, tokens[2] is Material Name as a single string. The tokens[] should be passed to the LinkedList. 5. When the node is added to the Linked List, it should always be in the sorted order, i.e., if the stop number being added is less than the existing stop numbers in the LinkedList, add the node to the head of the Linked List. if the stop number being added is greater than the existing stop numbers in the LinkedList, add the node to the tail of the Linked List. Otherwise, add the node in the appropriate position of the stop number. Here is what the User Interface for the Train Cars should look like: Main menu: Should accept upper and lower case: Option d: display all car details Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Jiffy Mix 10 corn Jiffy Mix 10 sugar Option a: attach a car Note: when you attach the car, the car should be placed in the sorted order. Please enter your choice a Please enter the Factory Name Foster Farms Please enter the Stop Number 9 Please enter the Material Name meat Adding a new car - Foster Farms 9 meat Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search the train cars Enter M to Merge two train cars Enter Q to Quit Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Jiffy Mix 10 corn Jiffy Mix 10 sugar Office Dictation Option r: detach car at factory a. Given a factory name, all cars belonging to that factory must be detached Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Please enter your choice r Please enter the Factory Name Jiffy Mix The car is detached at Jiffy Mix After detaching the car, the display should look like Train Depot Menu Options Enter A to Attach a train car Enter R to Detach car at factory Enter D to Display all the train cars Enter S to Search a train car Enter M to Merge two train cars Enter Q to Quit Please enter your choice d Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Options: search a train car a. Given a factory name, all the materials belonging to the factory must be displayed Please enter your choice s Enter the Factory Name Cargill The material in the car is eggs Option m: merge two train cars Note: while merging the cars the order should be maintained. Please enter your choice m Displaying the existing cars Nestle 1 cereals Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Displaying the new cars Nestle 1 candy General Mills 3 baking products Mars 6 candy Smithfield foods 12 cheese Pepsi 20 drink mixes Displaying the merged car details Please enter your choice d Nestle 1 cereals Nestle 1 candy Ghirardelli 2 sugar Ghirardelli 2 flour General Mills 3 yogurt General Mills 3 spices General Mills 3 baking products Tyson Foods 4 seasoned meats JBS 5 poultry JBS 5 pork Mars 6 crunchy vitamins Mars 6 candy Cargill 7 eggs Lactalis 8 cheese Foster Farms 9 meat Smithfield foods 12 cheese Pepsi 20 drink mixes Option q: quit Please enter your choice q Good Bye! Nestle, 1, candy Smithfield foods,12,cheese Pepsi, 20, drink mixes Mars, 6, candy General Mills, 3, baking products update.txt
Expert Answer:
Answer rating: 100% (QA)
Implement Train Class Methods detachString factoryName Method Traverse the linked list and remove cars with the given factoryName attachString factoryName int stopNumber String materialName Method Cre... View the full answer
Related Book For
Managerial Accounting A Focus on Ethical Decision Making
ISBN: 978-0324663853
5th edition
Authors: Steve Jackson, Roby Sawyers, Greg Jenkins
Posted Date:
Students also viewed these programming questions
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Use Eq. (6) to estimate Af = f(3.53, 8.98) - f(3.5,9)
-
If Kerry Dahl invests $3,152 now, she will receive $10,000 at the end of 15 years. What annual rate of interest will Kerry earn on her investment? Round your answer to the nearest whole number.
-
Find the current in each resistor of the circuit shown in Figure. 12 V
-
Differentiate between ferrous and non-ferrous materials.
-
Use the same information as above for Coffee Bean, Inc. (CBI) except assume now that Mona Loa and Malaysian are the only two products at CBI. Also, now include the following additional information...
-
What steps should Eco Chic handbags take to implement an effective budgeting process?
-
What is an example of what you would do it if the risk happened for Darling Murray Basin Water. For example, if the stakeholders did not get some information like a report, what would you do to sort...
-
Describe the impact of both workforce trends and industry trends on I/O psychology.
-
Describe how men and women experience divorce differently -. use the following headings for this response -"Men Experience Divorce" and "Women Experience Divorce". Explain why the divorce rate rose...
-
Describe the Daily Construction Diary, In your description, include. 1. why this is such an important document and who should maintatain one? 2. some of the information that should be recorded each...
-
Describe a Cyber Piracy case that you were not aware of. What was the outcome? Was the penalty fair in your opinion? Was there a cost to society for this crime?
-
Describe the main trade-off that must be made between distribution and other logistics activities?
-
On 11/1/Year 1, Armenti, Inc., planned to begin production on a yacht for sale to a customer in Canada. Due to backordered supplies, Armenti was unable to start construction on the yacht until...
-
On average there are four traffic accidents in a city during one hour of rush-hour traffic. Use the Poisson distribution to calculate the probability that in one such hour there arc (a) No accidents...
-
Washburn Delivery Company sold a company car for $12,000. Its original cost was $35,000, and the accumulated depreciation at the time of sale was $20,000. Required How does the transaction to record...
-
Define and give an example of value-chain analysis.
-
Barnett Corporation anticipates net income of $1,200,000 this year. The company is considering signing an equipment lease that would result in a $175,000 deductible expense this year. The companys...
-
The following trial balance of the Grampian Golf Club was extracted from the books as on 31 December 2016: (1) Bar purchases and sales were on a cash basis. Bar inventory at 31 December 2016 was...
-
Why do you think non-profit-oriented organizations prepare receipts and payments accounts when they have all this information in the cash book already?
-
A summary of the Balgreen Bowling Club's cash book is shown below. From it, and the additional information, you are to construct an income and expenditure account for the year ending 31 December...
Study smarter with the SolutionInn App