Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THE-LINE SPINE SIM TOOL Neom was announced in 2017 and is part of Saudi Arabia's Vision 2030 drive to diversify its economy and become less

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

THE-LINE SPINE SIM TOOL Neom was announced in 2017 and is part of Saudi Arabia's Vision 2030 drive to diversify its economy and become less reliant on oil. The area will be populated by more robots than people, and powered by solar panels and wind farms. Part of the NEOM project is the Line. The linear city will have no cars or streets, with all residents living within a five-minute walk of essential facilities. The 100-mile-long (170 kilometers) mega-city will consist of connected communities - which it calls "city modules" and link the Red Sea coast with the north-west of Saudi Arabia. All communities will be connected by a Spine that runs through the 170 kilometers city. Drawings show vehicles driven by artificial intelligence (AI), a metro line and high-speed freight transportation located underground. The metro line may use hyperloop or high-speed underground trains that stops frequently at each module. Passengers can embark and disembark at metro stations. About the Line-NEOM Project: https://www.dezeen.com/2021/01/13/line-saudi- arabia-170-kilometres-long-city-neom/ NEOM A FULLY SUSTAINABLE CITY THE SPINE CONNECTS CITY MODULES In this project we will simulate this metro-train, by using Linked Lists as a suitable data-structure to store information about trains, passengers, service timings, cost of journey etc. You project implements three classes namely Node, List and Solution The following provides an API for your project. Node Description int ticketID; // a unique ticket id; int paxID: 1/ Passenger ID number; int journeyDate: // journey date DDMMYYYY; int srcModule; // takes values between 1 and 255 int destModule; // takes values between 1 and 255 String paxName; 1/ Name of the passenger // Node next Node() // default constructor Node (...) //override constructor as necessary. You can edit the params as needed. // returns a String with the contents of the Node as follows: String toString() ticketID, paxID, journeyDate, srcModule, destModule, paxName. Node next The following is the API for the List class. This implements a Singly Linked List consisting of Nodes from the Node class. List Node Head; int size: Description // Anchors the Head of the List // Maintains the size of the List List() // default constructor insert (Node N) // inserts the node N in the correct position, ordered by the date. e.g. datel is 14022021; date2 is 01032021. datel appears before date2. Assume all months have exactly 30 days. There are 12 months in a year. If dates are equal (we assume inserting at the beginning). void remove (PaxID) int cost (PaxID) //removes the first node with matching PaxID. 1/Computes the cost of ALL journeys for a passenger with PaxID. Here is how this is computed. Journey cost = h.abs (src Module - destModule) * 5. //example srcModule=3, destModule=5. Journey Cost = 10. void printl (PaxID) void print2 (journeyDate) void print3 (srcModule) 1/searches for PaxID in the list. Prints ALL nodes with PaxID. 1/searches for journeyDate in the list. Prints ALL nodes with journeyDate. //searches for srcModule in the list. Prints ALL nodes with sreModule. //searches for destModule in the list. Prints ALL nodes with destModule. NOTE: print methods call Node.toString() as necessary. void print3 (dest Module) The following is the API for the Solution class. This class implements the main method, makes appropriate data Input/Output calls and implements data structures and all necessary method calls. Description //Attributes NA Not applicable main() Implements the main method; reads data from console, processes information and make appropriate calls as necessary. Solution Sample Input Here is a sample input 1 1225 101 10022021 3 5 Ahmed Baloshi 1 1226 101 11022021 5 8 Ahmed Baloshi 1 1227 101 12022021 8 3 Ahmed Baloshi 3 101 2 101 4 101 Sample Output For the above sample input, the following would be printed on the console. 50 1226 101 11022021 5 8 Ahmed Baloshi 1227 101 12022021 8 3 Ahmed Baloshi Explanation 1 1225 101 10022021 3 5 Ahmed Baloshi 1 1226 101 11022021 5 B Ahmed Baloshi 1 1227 101 12022021 8 3 Ahmed Baloshi The line starting with integer 1 indicates that insert would be called. No Output is generated for the insert call. 3 101 The line starting with integer 3 indicates that cost method would be called. The program computes the cost for all journeys taken by Passenger with paxID = 101. In the list, there are 3 nodes with paxID = 101. Node with ticketID=1225 has a journey cost = Math.abs(3-5) * 5 = 10 Node with ticketID=1226 has a journey cost = Math.abs (5-8) * 5 = 15 Node with ticketID=1227 has a journey cost = Math.abs(8-3) * 5 = 25 Hence total cost = 10+15+25=50 50 will he displayed on the monela 2 101 The line starting with integer 2 indicates that the first node with paxID=101 will be removed from the list. No output is generated. This removes the node that contains the following information 1 1225 101 10022021 3 5 Ahmed Baloshi 4 101 The line starting with integer 4 indicates that all passenger details for PaxID=101 will be printed on console separate by new line character at the end of each line. 1226 101 11022021 5 Ahmed Baloshi 1227 101 12022021 8 3 Ahmed Baloshi Similar to the above, your program implements the following commands: Legend for the acceptable commands: 1. insert details for a new node 2. removes node from list 3. computes the cost of ALL Journeys for this PaxID and displays the total. 4. prints All nodes with PaxID. 5. prints ALL nodes with journeyDate. 6. prints ALL nodes with src Module. 7. prints ALL nodes with destModule. THE-LINE SPINE SIM TOOL Neom was announced in 2017 and is part of Saudi Arabia's Vision 2030 drive to diversify its economy and become less reliant on oil. The area will be populated by more robots than people, and powered by solar panels and wind farms. Part of the NEOM project is the Line. The linear city will have no cars or streets, with all residents living within a five-minute walk of essential facilities. The 100-mile-long (170 kilometers) mega-city will consist of connected communities - which it calls "city modules" and link the Red Sea coast with the north-west of Saudi Arabia. All communities will be connected by a Spine that runs through the 170 kilometers city. Drawings show vehicles driven by artificial intelligence (AI), a metro line and high-speed freight transportation located underground. The metro line may use hyperloop or high-speed underground trains that stops frequently at each module. Passengers can embark and disembark at metro stations. About the Line-NEOM Project: https://www.dezeen.com/2021/01/13/line-saudi- arabia-170-kilometres-long-city-neom/ NEOM A FULLY SUSTAINABLE CITY THE SPINE CONNECTS CITY MODULES In this project we will simulate this metro-train, by using Linked Lists as a suitable data-structure to store information about trains, passengers, service timings, cost of journey etc. You project implements three classes namely Node, List and Solution The following provides an API for your project. Node Description int ticketID; // a unique ticket id; int paxID: 1/ Passenger ID number; int journeyDate: // journey date DDMMYYYY; int srcModule; // takes values between 1 and 255 int destModule; // takes values between 1 and 255 String paxName; 1/ Name of the passenger // Node next Node() // default constructor Node (...) //override constructor as necessary. You can edit the params as needed. // returns a String with the contents of the Node as follows: String toString() ticketID, paxID, journeyDate, srcModule, destModule, paxName. Node next The following is the API for the List class. This implements a Singly Linked List consisting of Nodes from the Node class. List Node Head; int size: Description // Anchors the Head of the List // Maintains the size of the List List() // default constructor insert (Node N) // inserts the node N in the correct position, ordered by the date. e.g. datel is 14022021; date2 is 01032021. datel appears before date2. Assume all months have exactly 30 days. There are 12 months in a year. If dates are equal (we assume inserting at the beginning). void remove (PaxID) int cost (PaxID) //removes the first node with matching PaxID. 1/Computes the cost of ALL journeys for a passenger with PaxID. Here is how this is computed. Journey cost = h.abs (src Module - destModule) * 5. //example srcModule=3, destModule=5. Journey Cost = 10. void printl (PaxID) void print2 (journeyDate) void print3 (srcModule) 1/searches for PaxID in the list. Prints ALL nodes with PaxID. 1/searches for journeyDate in the list. Prints ALL nodes with journeyDate. //searches for srcModule in the list. Prints ALL nodes with sreModule. //searches for destModule in the list. Prints ALL nodes with destModule. NOTE: print methods call Node.toString() as necessary. void print3 (dest Module) The following is the API for the Solution class. This class implements the main method, makes appropriate data Input/Output calls and implements data structures and all necessary method calls. Description //Attributes NA Not applicable main() Implements the main method; reads data from console, processes information and make appropriate calls as necessary. Solution Sample Input Here is a sample input 1 1225 101 10022021 3 5 Ahmed Baloshi 1 1226 101 11022021 5 8 Ahmed Baloshi 1 1227 101 12022021 8 3 Ahmed Baloshi 3 101 2 101 4 101 Sample Output For the above sample input, the following would be printed on the console. 50 1226 101 11022021 5 8 Ahmed Baloshi 1227 101 12022021 8 3 Ahmed Baloshi Explanation 1 1225 101 10022021 3 5 Ahmed Baloshi 1 1226 101 11022021 5 B Ahmed Baloshi 1 1227 101 12022021 8 3 Ahmed Baloshi The line starting with integer 1 indicates that insert would be called. No Output is generated for the insert call. 3 101 The line starting with integer 3 indicates that cost method would be called. The program computes the cost for all journeys taken by Passenger with paxID = 101. In the list, there are 3 nodes with paxID = 101. Node with ticketID=1225 has a journey cost = Math.abs(3-5) * 5 = 10 Node with ticketID=1226 has a journey cost = Math.abs (5-8) * 5 = 15 Node with ticketID=1227 has a journey cost = Math.abs(8-3) * 5 = 25 Hence total cost = 10+15+25=50 50 will he displayed on the monela 2 101 The line starting with integer 2 indicates that the first node with paxID=101 will be removed from the list. No output is generated. This removes the node that contains the following information 1 1225 101 10022021 3 5 Ahmed Baloshi 4 101 The line starting with integer 4 indicates that all passenger details for PaxID=101 will be printed on console separate by new line character at the end of each line. 1226 101 11022021 5 Ahmed Baloshi 1227 101 12022021 8 3 Ahmed Baloshi Similar to the above, your program implements the following commands: Legend for the acceptable commands: 1. insert details for a new node 2. removes node from list 3. computes the cost of ALL Journeys for this PaxID and displays the total. 4. prints All nodes with PaxID. 5. prints ALL nodes with journeyDate. 6. prints ALL nodes with src Module. 7. prints ALL nodes with destModule

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

Do you want your own family someday?

Answered: 1 week ago