Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Assignment 3 Version Number: 1.00 (July 14, 2020) Worth 4.0% of your total mark Assignment 3 Land Registry, Part 3 To be submitted online not later than Saturday, July 26, 2020, 11:59 p.m....

1 answer below »
Assignment 3

Version Number:
1.00 (July 14, 2020)
of your total
Assignment 3
Land Registry, Part 3
To be submitted online not later than Saturday, July 26, 2020, 11:59 p.m.
In this lab you’ll make changes to the Land Registry you built in Assignment 1 and
augmented in Assignment II. Along the way, you’ll demonstrate your understanding of
the following course learning requirements (CLRs), as stated in the CST8284—Object
Oriented Programming (Java) course outline:
1. Write java code to implement exception handling (CLR VI)
2. Produce code that has been tested and executes reliably (CLR VIII)
3. Prepare program documentation using prescribed program specifiers, including
JavaDoc (CLR IX)
4. Debug program problems using manual methods and computerized tools in an
appropriate manner. (CLR X)
5. Identify appropriate strategies for solving a problem (CLR XI)
 Assignment 3
 Page 1
Assignment 3
Land Registry, Part 3
Program Description

In this assignment, you’ll document our code,
explore exception handling, and tidy up the
existing code in preparation for Assignment IV,
when we’ll add a graphical front end to our
For those students who failed to submit
Assignment 2, you can use my starter copy,
available on Brightspace, as the starting point for
your Assignment 3 code. This code is provided
‘as is’; you are responsible for tidying up any bugs
that may exist. But be certain to include in your
Javadocs at the top of each class the line:
@author: yourname, based on code
supplied by Prof. Dave Houtman
I. Load the Assignment2 project and copy
your existing classes to the new Project

a) In Eclipse, create a new project folder called
CST8284_20S_Assignment3, copy the
landRegistry package over from
Assignment2 (including all its classes), and refactor
the package name to reflect the change from the
asgmt2 package to asgmt3.

) The UML diagram for this assignment is almost
unchanged from the last assignment, except for
the addition of some methods and classes noted

As before, the principles of good code design still
apply. So, at the marker’s discretion, you will lose
marks for not implementing best practices such as,
e.g. not using getters and setters (in particular,
emember to use getRegControl() rather than
c), not chaining methods and constructors, not
practicing code reuse, not employing the principle
of least privilege in your code design, sloppy design
that uses several lines of code where only a few
are needed, etc.
II. Add the following new features to your
Land Registry Application

a) Tighten up the existing code in preparation
for the GUI interface in Assignment 4

You’ve added a few new features since
Assignment 1, and refactored your code to use
ayLists and File IO as well. Before you re-
implement your Land Registry program as a GUI
application, it’s crucial that you tidy up your
program, which in many cases has grown to
include some very messy code. This ‘house
cleaning’ should be directed at the following
i) RegView methods handle console-based IO
ONLY; RegControl methods NEVER
equest or output text. This has been stated
efore, but it needs to be reinforced,
particularly with regards to the new
RegControl File IO methods. If a
RegControl method is successful, it returns
true or an object, typically an A
ayList of
Propertys or Registrants; if unsuccessful
it return false or null. Under NO
circumstance should your RegControl
methods output text-based information to
the console, much less print out the stack
trace from an exception.
For RegView, this means that whatever the
operation of a ‘View’ method internally, it
usually only has two things to decide: was the
equested operation performed or not? If
the former, the output message is something
like: “method executed successfully”; if the
latter, the message looks something like:
“could not complete the request”.
In a few rare cases, where the possible
esults of an operation can not be signaled by
a simple binary response, we’ll throw an
Exception, and let the handler deal with it.
(For more on this subject, see section II.b).
But for the most part, your code should be
written in such a way that each of the eleven
RegView ‘View’ methods uses an if…then…
statement (or better still, a ternary ‘if’, when
 Assignment 3
 Page 2
appropriate) to determine the String output
from the method.
Since a successful output often results in
looping through an A
ayList to display its
contents, add the private static method
shown below to simplify data output.
where the String output is just one long
string built up using the toString() methods
for each object in the A
ayList. (Note that
ayList has a toString() method,
inherited from its Collection class parent,
which you can use to output the content of
the displayList. However, the output is
formatted in a peculiar way, and while you
can use various String methods to excise the
extra characters out of the output String, it’s
generally to simpler to write a loop that uses
each component object’s toString() to
generate exactly the output you desire.)
With the addition of this new method, along
with the new RegControl methods listed
elow, you should be able to implement the logic
code in each of the RegView methods in five
concise lines of code or less (excluding the
println() outputs that signal method
completion, just mentioned above.) More
than that, and your code is less efficient than
it should be, and you need to rethink your
approach to the logic.
ii) In RegControl, add or revise the methods
shown below to your existing code.
The first two methods repackage the
loadFromFile() method you wrote for
Assignment 2, allowing you to offload much
of the functionality (and clutter) that resulted
in having to first delete and then reload the
two A
ayLists from their files using just the
public RegControl methods only. This should
streamline your code considerably, not just in
RegView, but in RegControl as well, since
you can now deal with the two A
directly, using A
ayList’s native methods.
Note however that code reuse is still
expected; you should not be duplicating code
that already exists elsewhere in
RegControl. (And there are further
estrictions imposed on your RegControl
methods as well: see below.)
The third method to add
evise is
changePropertyRegistrant(). In this
evised version, you read in an A
ayList of
type Property, rather than a single
Property. You then reset the regNum of
each Property using the second parameter,
and return the A
ayList of properties with
the new regNum.
The final alteration is to the
listOfProperties() method, the one
that lists all the properties with a particular
egNum. In particular, your code should
ensure that when a regNum of ‘0’ is passed
to listOfProperties(), the method
outputs an A
ayList of all the Properties. In
short, it operates as before, but with the
added feature that it calls
listOfAllPropeties() whenever a
egNum of ‘0’ is entered. We’ll put this new
feature to use in Assignment 4.
add to existing methods
ayList displayList): String

add the following two methods to RegControl
+refreshProperties(): void
+refreshRegistrants(): void
changed from the original
ayList, int newRegNum):
ayList chain according to instructions
+listOfProperties(regNum: int):
 Assignment 3
 Page 3
Just as there are limitations on the size of
RegView’s methods, there are limitations on
the eleven public RegControl methods used
directly by RegView. They are:

1. Whenever you absolutely need to loop
through an A
ayList (see below!), you
must use the enhanced for loop (except
for loadFromFile(), which can use
2. You must (still) check for and remove
null values returned by the
listOfRegistrants() and the
(revised) listOfProperties()
3. You cannot use streams, or anything not
already taught as part of the course. If
you use any material obtained from a
web site (e.g. the Oracle web site on
ayList), you must provide an
appropriate citation;
4. For the following five methods, you
should only need to use a single loop to
perform the method’s basic operations:
 loadFromFile
 saveToFile
 changePropertyRegistrant
 listOfProperties
 findRegistrant

For the remaining six methods, you must
not use a loop of any kind. In other words,
you must only use existing methods, both
those you have created yourself, and
those that exist in the A
ayList class, to
perform each operation—in short, code
Marks will be deducted if these rules are
not adhered to.
) Throw a BadLandRegistryException
whenever there is bad data input
Add a BadLandRegistryException class
to your project, which should extend from
RuntimeException. Add two constructors
to your new class: a no-arg constructor and a
two-String constructor, which passes both a
header String along with a message String
describing the exception and the action the
user should take. Pass the message String
to the superclass using super() (as you did
in Lab 7) so that it will be returned when you
call getMessage(). Store the header
parameter in a private String field named
header (which you’ll need to add to your
new exception class, along with an appropriate
getter and setter for it). Chain the no-arg
BadLandRegistryException constructor
to the 2-String constructor, passing the
default message “Please try again” and the
default header “Bad land registry data

In your existing code, throw a
BadLandRegistryException for each of
Answered Same Day Jul 20, 2021


Valupadasu answered on Jul 24 2021
131 Votes


package cst8284.asgmt3.landRegistry;
public synchronized class BadLandRegistryException extends RuntimeException {
private static final long serialVersionUID = 1;
private String header;
public String getHeader();
public void setHeader(String);
public void BadLandRegistryException(String, String);
public void BadLandRegistryException();
package cst8284.asgmt3.landRegistry;
public synchronized class Property implements {
private static final double TAX_RATE_PER_M2 = 12.5;
private static final int DEFAULT_REGNUM = 999;
private int xLeft;
private int yTop;
private int xLength;
private int yWidth;
private int regNum;
private int area;
private double taxes;
public static final long serialVersionUID = 1;
public void Property();
public void Property(int, int, int, int);
public void Property(Property, int);
public void Property(int, int, int, int, int);
public int getXLeft();
public void setXLeft(int);
public int getXRight();
public int getYTop();
public void setYTop(int);
public int getYBottom();
public int getYWidth();
public void setYWidth(int);
public int getXLength();
public void setXLength(int);
public int getRegNum();
private void setRegNum(int);
public int getArea();
public double getTaxes();
public String toString();
public boolean equals(Object);
public boolean hasSameSides(Property);
public boolean overlaps(Property);
package cst8284.asgmt3.landRegistry;
public synchronized class RegControl {
private java.util.A
ayList registrants;
private java.util.A
ayList properties;
public void RegControl();
public java.util.A
ayList getRegistrants();
public java.util.A
ayList getProperties();
public Registrant addNewRegistrant(Registrant);
public Registrant findRegistrant(int);
public java.util.A
ayList listOfRegistrants();
public Registrant deleteRegistrant(int);
public void setRegistrants(java.util.A
public void setProperties(java.util.A
public Property addNewProperty(Property);
public boolean deleteProperties(java.util.A
public java.util.A
ayList changePropertyRegistrant(java.util.A
ayList, int);
public java.util.A
ayList listOfProperties(int);
public java.util.A
ayList listOfAllProperties();
private Property propertyOverlaps(Property);
public boolean saveToFile(java.util.A
ayList, String);
public java.util.A
ayList loadFromFile(String);
public void refreshProperties();
public void refreshRegistrants();
package cst8284.asgmt3.landRegistry;
public synchronized class Registrant implements {
private static final int REGNUM_START = 1000;
private static int cu
private final int REGNUM;
private String firstName;
private String lastName;
public static final long serialVersionUID = 1;
static void ();
public void Registrant();
public void Registrant(String);
public int getRegNum();
private static void incrToNextRegNum();
public String getFirstName();
public void setFirstName(String);
public String getLastName();
public void setLastName(String);
public boolean equals(Object);
public String toString();
package cst8284.asgmt3.landRegistry;
public synchronized class RegLauncher {
public void RegLauncher();
public static void main(String[]);
package cst8284.asgmt3.landRegistry;
public synchronized class RegView {
private static java.util.Scanner scan;
private static RegControl rc;
private static final int ADD_NEW_REGISTRANT = 1;
private static final int FIND_REGISTRANT = 2;
private static final int LIST_REGISTRANTS = 3;
private static final int DELETE_REGISTRANT = 4;
private static final int ADD_NEW_PROPERTY = 5;
private static final int DELETE_PROPERTY = 6;
private static final int CHANGE_PROPERTY_REGISTRANT = 7;
private static final int LIST_PROPERTY_BY_REGNUM = 8;
private static final int LIST_ALL_PROPERTIES = 9;
private static final int LOAD_LAND_REGISTRY_FROM_BACKUP = 10;
private static final int SAVE_LAND_REGISTRY_TO_BACKUP = 11;
private static final int EXIT = 0;
public static final String PROPERTIES_FILE = LandRegistry.prop;
public static final String REGISTRANTS_FILE = LandRegistry.reg;
public static final String e
Msg = Could not complete the request;
public static final String successMsg = Method executed successfully;
static void ();
public void RegView();
public static RegControl getRegControl();
public static void launch();
private static int displayMenu();
private static void executeMenuItem(int);
private static String getResponseTo(String);
private static int requestRegNum();
private static Property makeNewPropertyFromUserInput();
private static Registrant makeNewRegistrantFromUserInput();
public static void viewAddNewRegistrant();
public static void viewFindRegistrant();
public static void viewListOfRegistrants();
public static void viewDeleteRegistrant();
public static void viewAddNewProperty();
public static void viewDeleteProperty();
public static void viewChangePropertyRegistrant();
public static void viewListPropertyByRegNum();
public static void viewListAllProperties();
public static void viewLoadLandRegistryFromBackUp();
public static void viewSaveLandRegistryToBackUp();
public static String...

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here