Starting from:

$24.99

SENG1120 Assignment 1 Solution




NOTE: The important information about submission and code specifics at the end of this assignment specification.


INTRODUCTION
You are required to build the infrastructure to manipulate data related to an eToll operator in Sydney, NSW. Your client further specifies that you are to create a class named LinkedList to store information about each vehicle that uses its motorway. The LinkedList will store the vehicle’s licence number, its type, and the toll charged, in a Node of the list, using the provided class EToll.


ASSIGNMENT TASK
You are required to use a Doubly-Linked List, as discussed in lectures, to create your own implementation of the LinkedList class. It will use instances of Node to store instances of value_type (in this assignment, each Node will be used to store an instance of EToll).

The LinkedList class will be used by a main program, to be supplied to you, as well as a makefile.

You will need to design LinkedList and Node in a way that it communicates seamlessly with the main program and the class EToll provided, and compiles with the makefile also supplied. Please refer to the lecture slides and recordings for guidance on how to implement both classes.


For SENG1120 students who want to be challenged more, there is an extra requirement, worth a bonus 3.0 marks, however you can still only score a MAXIMUM of 15.0/15.0.:
• (3.0 marks) Implement the member method void order() inside LinkedList. That method will order the vehicles according to their licence number. You are NOT ALLOWED to manipulate the contents of the Node’s value_type variable. You can only manipulate the pointers of the nodes to move them around until the list is ordered. In addition, you are NOT ALLOWED to instantiate new nodes in the implementation of the method void order().






SUBMISSION
Make sure your code works with the files supplied, and DO NOT change them (except for the uncommenting of the Bonus Question, if you want to try it). For marking, we will add the main file and the EToll class to the project and compile everything using the makefile, together with your own files. If it does not compile or run, your mark will be zero (as we are unable to test and validate your implementation).


Your submission should be made using the Assignments section of the course Blackboard site. Incorrectly submitted assignments will not be marked. You should provide the .h and .cpp files related to the LinkedList and Node classes, only, plus an assessment item coversheet. Also, if necessary, provide a readme.txt file containing instructions or comments for the marker. Each program file should have a proper header comment section including your name, course and student number; and your code should be properly documented.

Remember that your code should compile and run correctly using Cygwin. There should be no segmentation faults or memory leaks during or after the execution of the program.

Compress all your files into a single .zip file, using your student number as the filename. For example, if your student number is c9876543, you would name your submission:
c9876543.zip

If you have attempted the Bonus Requirement (or you are a 6120 student), please include a blank text file in the same folder as your source files, simply called Bonus.txt – this is to make it clear to the marker that you are attempting this.

Submit by selecting the Assignment 1 link that will be found in the Assessment section on Blackboard.


This assignment is worth 15 marks of your final result for the course (including bonus marks).






Compiling and running your files together with the demo file provided should output the following result:









$ make clean rm -rf *.o core

$ make
g++ -c -Wall -c LinkedListDemo.cpp g++ -c -Wall -c LinkedList.cpp g++ -c -Wall -c Node.cpp g++ -c -Wall -c EToll.cpp
g++ LinkedListDemo.o LinkedList.o Node.o EToll.o -o assignment1

$ ./assignment1.exe
Start lists:
Booth 1: (BYC567,Car) (U2KT30,Car) (P23SHW,Light Truck) (BY12PH,Car) (PNG890,Truck) (QWER45,Truck) (ERTC20,Car) (OYTCO7,Car)
Booth 2: (GFCU49,Car) (IFTN98,Motorcycle) (PNG890,Light Truck) (DTYR33,Truck) (NIO324,Truck) (GFV349,Car) Daily total: List is empty.

=====================================================
Removing vehicle 'NIO324' from Booth 2.
Removing vehicle 'BYC567' from Booth 1.
Removing vehicle 'GFV349' from Booth 2.
Concatenating the two lists onto list 'Daily Report'.

=====================================================
Booth 1: (U2KT30,Car) (P23SHW,Light Truck) (BY12PH,Car) (PNG890,Truck) (QWER45,Truck) (ERTC20,Car) (OYTCO7,Car)
Booth 2: (GFCU49,Car) (IFTN98,Motorcycle) (PNG890,Light Truck) (DTYR33,Truck)
Daily report: (U2KT30,Car) (P23SHW,Light Truck) (BY12PH,Car) (PNG890,Truck) (QWER45,Truck) (ERTC20,Car)
(OYTCO7,Car) (GFCU49,Car) (IFTN98,Motorcycle) (PNG890,Light Truck) (DTYR33,Truck)
=====================================================
Detailed report for the day:
Number of vehicles of type 'Car': 5
Number of vehicles of type 'Motorcycle': 1
Number of vehicles of type 'Light Truck': 2
Number of vehicles of type 'Truck': 3
Total charged: 87

=====================================================
Removing the contents of both booths from the daily report:
Booth 1: (U2KT30,Car) (P23SHW,Light Truck) (BY12PH,Car) (PNG890,Truck) (QWER45,Truck) (ERTC20,Car) (OYTCO7,Car) Booth 2: (GFCU49,Car) (IFTN98,Motorcycle) (PNG890,Light Truck) (DTYR33,Truck) Daily report: List is empty.


The program has finished.

$




















More products