Simulating the behaviour of a train management system

Assignment Help JAVA Programming
Reference no: EM131020663

Goal: The goal of this assignment is to gain practical experience with data abstraction, unit testing and using the Java class libraries (the Java 8 SE API).

Problem Overview: In this assignment, and the following two assignments in this course, you will develop the component classes of a program for simulating the behaviour of a train management system.

A train management system controls the behaviour of trains on a railway track. A railway track is composed of sections of track that are connected at junctions in the track. Each junction in the track has between one and three connections to sections of track. Each of these connections is referred to as a branch of the junction, and each of those branches has a type: they are either a FACING, NORMAL or REVERSE branch. Each junction can only have one branch of each type. Locations on the track can be defined relative to their offset from a junction along one of its branches.

Task Overview: In this assignment, you will be writing data types for a Section, a Location, and a Track.(All students will be expected to write their own tests to help them to debug their implementations, but only CSSE7023 students will be required to submit their tests for the SectionTest class.)

Task Details:

Skeletons for the classes Section, Location and Track classes are provided in the zip file in the railway package. These skeletons include javadoc specifications of the constructors and methods that you need to complete. You must complete these class skeletons according to their specifications in the files. You will need also to declare variables, add import clauses, and add comments and javadocs as required.

If you are a CSSE7023 student, you will also need to complete systematic and understandable JUnit4 test suite for the Section class in the skeleton of the SectionTest class from the railway.test package. You may write your unit tests assuming that the classes that Section depends on (e.g. the Junction class and any of the Java SE API libraries) are implemented and functioning correctly. That is, you don''t need to create test stubs for these classes.

You must implement these classes as if other programmers were, at the same time, implementing the code that instantiates them and calls their methods. Hence:

• Don''t change the class names, specifications, or alter the method names, parameter types, return types, exceptions thrown or the packages to which the files belong.

• Don''t add any new methods or variables to the classes unless they are private (that would be changing their specification by adding new features accessible from outside the class).

• You are encouraged to use Java 8 SE API classes, but no third party libraries should be used. (It is not necessary, and makes marking hard.)

• Don''t write any code that is operating-system specific (e.g. by hard-coding in newline characters etc.), since we will batch test your code on a Unix machine.

• Your source files should be written using ASCII characters only.

Implement the classes as if other programmers are going to be using and maintaining them. Hence:

• Your code should follow accepted Java naming conventions, be consistently indented, readable, and use embedded whitespace consistently.

• Your code should use private methods and private instance variables and other means to hide implementation details and protect implementation invariants.

• Your methods, fields and local variables (except for-loop variables) should have appropriate Javadoc comments or normal comments.

• Comments should be used to document your code''s invariants, and to describe any particularly tricky sections. (You must provide an implementation invariant for each of the Section, Location and Track classes). However, you should also strive to make your code understandable without reference to comments; e.g. by choosing sensible method and variable names, and by coding in a straightforward way.

• Any exceptions that are created and thrown should have appropriate messages to help the user understand why the exception was thrown.

• The checkInvariant() method of each class (other than the test suite) should check that the implementation invariant you have specified in your comments is satisfied.

• Your code should not be overly complex and hard to understand.

The Zip file for the assignment also includes some other code that you will need to compile your classes as well as some junit4 test classes to help you get started with testing your code.

Do not modify any of the files in package railway other than Section, Location and Track, since we will test your code using our original versions of these other files. Do not add any new files that your code for these classes depends upon, since you won''t submit them and we won''t be testing your code using them.

The junit4 test classes as provided in the package railway.test are not intended to be an exhaustive test for your code. Part of your task will be to expand on these tests to ensure that your code behaves as required by the javadoc comments. (Only if you are a CSSE7023 student will you be required to submit your test file SectionTest.java.) We will test your code using our own extensive suite of junit test cases. (Once again, this is intended to mirror what happens in real life. You write your code according to the "spec", and test it, and then hand it over to other people ... who test and / or use it in ways that you may not have thought of.)

If you think there are things that are unclear about the problem, ask on the piazza forum, ask a tutor, or email the course coordinator to clarify the requirements. Real software projects have requirements that aren''t entirely clear, too!

If necessary, there may be some small changes to the files that are provided, up to one week before the deadline, in order to make the requirements clearer, or to tweak test cases. These updates will be clearly announced on the Announcements page of Blackboard, and during the lectures.

Hints:

1. It will be easier to implement the Section class first, followed by Location and then Track. The tests you may wish to write before you start coding these classes.

2. Read the specification comments carefully. They have details that affect how you need to implement and test your solution.

test

We will try to use your test suite SectionTest to test an implementation of Section that contains some errors in an environment in which the other classes Section.java depends on exist and are correctly implemented.

Marks for the JUnit4 test suite in SectionTest.java will be allocated as follows:

• Clear and systematic tests that can easily be used to detect most of the (valid) errors in a sample implementation and does not erroneously find (invalid) errors in that implementation.

Note: code submitted with compilation errors will result in zero marks in this section. A Java 8 compiler will be used to test code.

Attachment:- railways.zip

Reference no: EM131020663

Questions Cloud

What ultimately happened to jwm partners : Should the LTCM partners have been sanctioned from any governmental body (lose their professional licenses, prohibitions on working in the investment industry, etc.)? Why or why not.
What is the maximum amount of capital goods : Given the above graph, what is the maximum amount of capital goods this economy could produce? Is it likely this economy will choose to produce this amount
Calculate the expected cash flow : EOG Resources incurred $275,000 in drilling costs prior to deciding when to complete the well. Estimated completion costs are $175,000. The expected net cash flows from the sale of the oil and gas from this well are $300,000. Should the well be compl..
Dividends paid exceeded the net new equity raised : A positive cash flow to stockholders indicates which one of the following with certainty? The dividends paid exceeded the net new equity raised. The amount of the sale of common stock exceeded the amount of dividends paid. No dividends were distribut..
Simulating the behaviour of a train management system : You will develop the component classes of a program for simulating the behaviour of a train management system - You must implement these classes as if other programmers were, at the same time, implementing the code that instantiates them and calls t..
Risks is irrelevant to a well-diversified investor : Which one of the following risks is irrelevant to a well-diversified investor? systematic portion of a surprise non diversifiable risk systematic risk market risk unsystematic risk
Short-term unexpected returns can be either positive : Which one of the following statements related to unexpected returns is correct? Unexpected returns are relatively predictable in the short-term Unexpected returns can be either positive or negative in the short term but tend to be zero over the long-..
What is the debt ratio after the change in structure : How many shares can the company buy back with the $160 million of new debt that it issues?
Assume the sale form action is annually based : Assume Enterprise Inc. Sells special widgets per week. They are able to sell 400 widgets per week. Assuming the carrying cost per unit is $2.00. What is the total carrying cost per week? Assume another company sells common widgets (and assume the sal..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Writing a simple gui application using a class called myguic

writing a simple GUI application using a class called MyGuiClass. Your GUI will have a JButton which your program will need to respond to when it is clicked. Describe what you would need to do to setup event handling using a nested inner class. Use J..

  Development of an automated atm machine using java

Development of an Automated ATM Machine using Java - The ATM application stack shall be loaded to a fully-equipped ATM machine with complete CPU power, chip card reader, secure crypto-processor, display monitor, function keys, in-built printer and ..

  Representing an investment value and interest rate

Write a Java test program, all your code should be in the main method that asks the user for two numbers representing an investment value and interest rate.

  Practice involves creating an algorithm

Practice involves creating an algorithm. An algorithm (pronounced AL-go-rith-um) is a procedure or formula for solving a problem. We will see in future weeks how the detailed steps of this type of procedure relate to pseudocode and, in general, to th..

  In this project you need to write a program called

in this project you need to write a program called ecc.javato implement elliptic curve

  Write the constructor date which has 3 parameters

The Date.java class. Implement a public class Date that represents a date composed of a month , day, and a year. Declare month, day, and year as integers. Date has a constructor with 3 parameters and 4 methods. Write the constructor Date which has..

  How many parameters are supposed to be passed

How many parameters are supposed to be passed to the constructor or how big to create the array - Method Union comparing two different objects?

  Write the methods used in section two of main

Write the constructor for the SortTraversableLinkedList. It should create the head and tail nodes, and set the size of the list to 0, as in a typical linked list.

  Write a main method that reads in a single string

Write a main method that reads in a single string and calls trianglePrint with that string. Write a method that uses recursion to print an input string in the shape of a triangle

  Write program with jframe to enter series of names

Write a program with JFrame which permits user to enter series of friends' names and phone numbers and creates file from entered data.

  Develop a java application to calculate the monthly paycheck

Develop a Java application to calculate the monthly paychecks for a number of different types of employees. The employee types are created in a subclass array based on parent base class Employee. Does this ring a bell?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd