Java Implementation of a Bus Stop Display System: CMP5354 Project

Verified

Added on  2022/11/25

|9
|1084
|225
Project
AI Summary
This project focuses on the development of a bus stop display system using Java. The solution involves reading and processing data from CSV files containing bus route information, including bus numbers, source and destination stops, due times, and status updates. The code utilizes classes such as `BusStopDisplay`, `HasExpectedBuses`, and `Route` to manage and display the data. The system uses `FileReader` and `read()` functions to access the CSV files and `System.out.print` to display the results. An array list is used to store route information. The project also includes a UML diagram that outlines the system's classes, variables, methods, and data types. The output displays bus routes, departure times, and other relevant details. The provided code also includes methods to get and set the bus's calling routes, seat numbers, departure times, and speed values, which are converted to strings for display. The project's goal is to create a functional system that presents bus information in a clear and understandable manner. The assignment solution is available on Desklib.
Document Page
Implementation
Bus stop display system development is the main aim of this project. Here Java code for the bus
stop display system is developed. And the implementation methods and explanation for the
developed coding is given below (Douglass, n.d.).
The BusStopDisplay class used to read the routes.csv file. It has the bus stop information such as
bus number, source, destination, due at and status. It has eight records. The main function is the
entry point for the Java Virtual Machine. The heading is bus stop displays. The FileReader and
read() function used to read the CSV file (Foster & Price, 2005). The System.out.print used to
print the results. Here print the bus route information. The fread.close() function used to close the
file.
1
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Created the array list for storing the route information. The route_information is the object. It is
used to add the bus details to the array list. The add keyword is also used to add the details to the
array list. There are eight records are added to the array list (Friesen, 2000).
The HasExpectedBuses class used to read the timetable.csv file. It has bus arrival and departure
time. The FileReader and read() used to read the file. The close() function used to close the file.
2
Document Page
The Route class has four variables such as route_source, route_destination, route_num, and
distance. These variables data type is a string. The RoutesAndStopInfoParser is the constructor.
The bus is the object of the routedAndStopInfoParser (Markham, 2014).
The Route is the constructor. It has five arguments such as route_no, route_start,
route_terminate, and distance_value.
The above code is to display the bus stop information. It has the route id, source, destination, and
distance. The bus object used to invoke the toString function .
3
Document Page
In the above section of the code class “RoutesAndStopParser” is shown. It helps to show the
calling routes, seat number and times, etc. The class contains four variables on it. And they are
callingRoutes, seat_number, departure times, and speed_value. The constructor has four
variables. And they are b_num, cap, dri, and sp (McAffer, Lemieux & Aniszczyk, 2010).
The getCallingRoutes() method used to get the bus routes. It return the calling routes value. It
data type is integer. The getseat_number() method has the bus available seat numbers. It data
type also integer (Schmuller, 2004). The getDepartureTimes() method used to find the bus
departure time and also is remain the bus display status such as on time, delay and cancelled. It
data type is string.
4
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
The above codes are invoke the getspeed_value() and setDepartureTimes(). The
setDepartureTimes has the dri_name arguments. The getspeed_value() used to get the bus speed
value. it return the speed value. it data type is string and it has the public access modifier.
In the developed code all outputs are stored as different formats like int, float, etc. But for
displaying purpose string format is preferred. So that we need to convert the output into the
string. For that, we used a "toString" function. It converts output values (different format) into
strings. Then the code executed and shows the results in the required format.
5
Document Page
Output
In the above screenshot, the information founded from the given CSV file is shown. The
developed code initially collect and store the information present in the attached CSV file. So all
6
Document Page
the data present in the three CSV files are shown here. The attached CSV file contains the details
like number, source, destination due at and current status. Then the coding process the data and
shows the bus routes and time similar to the below-attached screenshot. And the screenshot
contains the information like Route Id, Source and destination and distance (Scott, 2001). Also,
the output shows the information in a simple and understandable manner. And the output
screenshots were shown in the below context.
7
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
UML daigram
There are five classes in the UML diagram such as Time table, Route, Expected bus, Bus stop
display, and Route alert. The time table has the bus number and due at variables. It is associated
with the expected bus. It has a bus number, available seats, and status variables. It composition to
bus stop display class.
8
Document Page
The bus stop display has four variables such as routeId, source, destination, and distance. And it
has two methods such as RoutesAndStopInfoParser() and Route(). It is composed to the Route
class. The route class has three variables and methods. It associates to the routealert. It has three
variables and two methods such as getCallingRoutes() and getDepartureTimes().
There are two data types defined in the UML diagram such as dueat and routeid. The dueat has
hours and minutes. The enumeration is created for status. It has cancelled, ontime and delay.
References
Douglass, B. Real-time UML workshop for embedded systems.
Foster, J., & Price, M. (2005). Sockets, shellcode, porting & coding. Rockland, Mass.: Syngress
Pub.
Friesen, J. (2000). Java 2 by example. Indianapolis, Ind.: Que.
Markham, N. (2014). Java programming interviews exposed. Hoboken: Wiley.
McAffer, J., Lemieux, J., & Aniszczyk, C. (2010). Eclipse Rich Client Platform. [Upper Saddle
River, N.J.]: Addison-Wesley.
Schmuller, J. (2004). UML. Indianapolis: Sams.
Scott, K. (2001). UML explained. Boston [u.a.]: Addison-Wesley.
9
chevron_up_icon
1 out of 9
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]