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 »
hi , i am looking for the same tutor from last assignment 1 and 2 to help me with my assignment 3 please, because all these 3 assignments have connection , thanks



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. Description: 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 application. 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. b) The UML diagram for this assignment is almost unchanged from the last assignment, except for the addition of some methods and classes noted below. 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, remember to use getRegControl() rather than rc), 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 ArrayLists 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 areas: i) RegView methods handle console-based IO ONLY; RegControl methods NEVER request or output text. This has been stated before, 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 ArrayList 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 requested 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 results 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 ArrayList 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 ArrayList. (Note that ArrayList 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 below, 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 ArrayLists 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 ArrayLists directly, using ArrayList’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 restrictions imposed on your RegControl methods as well: see below.) The third method to add/revise is changePropertyRegistrant(). In this revised version, you read in an ArrayList of type Property, rather than a single Property. You then reset the regNum of each Property using the second parameter, and return the ArrayList of properties with the new regNum. The final alteration is to the listOfProperties() method, the one that lists all the properties with a particular regNum. In particular, your code should ensure that when a regNum of ‘0’ is passed to listOfProperties(), the method outputs an ArrayList of all the Properties. In short, it operates as before, but with the added feature that it calls listOfAllPropeties() whenever a regNum of ‘0’ is entered. We’ll put this new feature to use in Assignment 4. // add to existing methods -toString(ArrayList displayList): String RegView // add the following two methods to RegControl +refreshProperties(): void +refreshRegistrants(): void // changed from the original +changePropertyRegistrant(ArrayList oldRegNumPropertyArrayList, int newRegNum): ArrayList // chain according to instructions +listOfProperties(regNum: int): ArrayList RegControl  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 ArrayList (see below!), you must use the enhanced for loop (except for loadFromFile(), which can use while(true).); 2. You must (still) check for and remove null values returned by the listOfRegistrants() and the (revised) listOfProperties() methods; 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 ArrayList), 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 ArrayList class, to perform each operation—in short, code reuse. Marks will be deducted if these rules are not adhered to. b) 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 entered”. In your existing code, throw a BadLandRegistryException for each of
Answered Same DayJul 20, 2021

Answer To: Assignment 3 Version Number: 1.00 (July 14, 2020) Worth 4.0% of your total mark Assignment 3 Land...

Valupadasu answered on Jul 24 2021
151 Votes
CST8284_20S_Assignment3/.classpath

    
    
    
CST8284_20S_Assignment3/.project

     CST8284_20S_Assignment3
    
    
    
    
        
             org.eclipse.jdt.core.javabuilder
            
            
        
    
    
         org.eclipse.jdt.core.javanature
    
CST8284_20S_Assignment3/.settings/org.eclipse.jdt.core.prefs
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.deb
ug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
CST8284_20S_Assignment3/bin/cst8284/asgmt3/landRegistry/BadLandRegistryException.class
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();
}
CST8284_20S_Assignment3/bin/cst8284/asgmt3/landRegistry/Property.class
package cst8284.asgmt3.landRegistry;
public synchronized class Property implements java.io.Serializable {
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);
}
CST8284_20S_Assignment3/bin/cst8284/asgmt3/landRegistry/RegControl.class
package cst8284.asgmt3.landRegistry;
public synchronized class RegControl {
private java.util.ArrayList registrants;
private java.util.ArrayList properties;
public void RegControl();
public java.util.ArrayList getRegistrants();
public java.util.ArrayList getProperties();
public Registrant addNewRegistrant(Registrant);
public Registrant findRegistrant(int);
public java.util.ArrayList listOfRegistrants();
public Registrant deleteRegistrant(int);
public void setRegistrants(java.util.ArrayList);
public void setProperties(java.util.ArrayList);
public Property addNewProperty(Property);
public boolean deleteProperties(java.util.ArrayList);
public java.util.ArrayList changePropertyRegistrant(java.util.ArrayList, int);
public java.util.ArrayList listOfProperties(int);
public java.util.ArrayList listOfAllProperties();
private Property propertyOverlaps(Property);
public boolean saveToFile(java.util.ArrayList, String);
public java.util.ArrayList loadFromFile(String);
public void refreshProperties();
public void refreshRegistrants();
}
CST8284_20S_Assignment3/bin/cst8284/asgmt3/landRegistry/Registrant.class
package cst8284.asgmt3.landRegistry;
public synchronized class Registrant implements java.io.Serializable {
private static final int REGNUM_START = 1000;
private static int currentRegNum;
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();
}
CST8284_20S_Assignment3/bin/cst8284/asgmt3/landRegistry/RegLauncher.class
package cst8284.asgmt3.landRegistry;
public synchronized class RegLauncher {
public void RegLauncher();
public static void main(String[]);
}
CST8284_20S_Assignment3/bin/cst8284/asgmt3/landRegistry/RegView.class
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 errMsg = 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...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here