Question

In: Computer Science

House Class The first class you should develop is a House class, as defined in the...

House Class The first class you should develop is a House class, as defined in the assignment specification. As we have not yet covered inheritance or association, we will not be integrating Banner this week — you will still be writing it for later usage though. Hence, the complete class should be implemented as defined in the UML below (please see the note on interpreting UML). You should maintain the order of the class fields in field declarations, and parameter orders (alternate constructor and setters). House - name - years - bannermen - castle + clone(): House + toString(): String The validation requirements for all of these fields can be found in the assignment specification. Begin by specifying the class name, constants (there should be a couple), and class fields. Next develop the default constructor, remember the default constructor should take no parameters and construct a valid object, what constitutes appropriate values for a default constructor is left to your discretion. Now complete your alternate constructor, remember to deal with validation as necessary and to indicate when/if the submodule can FAIL. The parameter order should be the same as the order in which your class fields are declared. The final constructor to complete is the copy constructor. A copy constructor should take in an object of the same class, use the accessors to retrieve the object state and initialise the class fields. The next method to focus on is clone. Clone should take no imports and return a copy of the current object. You may do this by using the copy constructor and passing it this. Clone is very similar to the copy constructor but without the requirement to specify the class name, this will be extremely useful once we cover inheritance. Complete the getters, equals, toString (see the note), and mutators (in that order) as per the examples and lecture slides. Take note that at this point you cannot yet implement battleStrengthand population, this method will be added in and completed in a later practical. Once your design is checked by a tutor you can convert your design to java.

Testing House Class, you need to develop a test harness for your House class. Your test harness should test (either directly or indirectly) every submodule you wrote for House.

Army Class

Next you need to develop Army, again the details for validation can be found in the assignment specification. you should continue to follow the order of, constructors, accessors, equals, toString, mutators in that order. Army - name - years - footmen - archers - history + clone(): Army + toString(): String Follow the same process as above to develop the design and then convert it to Java. Do not forget to create a test harness for this class as well.

Banner Class

The last class you need to develop this week is Banner, approach this class in the same manner as the previous two classes. Once again the validation details can be found in the assignment specification, the class should be implemented according to the following UML: Banner - sigil - bannerColour - sigilColour + clone(): Banner + toString(): String Once you have completed your pseudcode design and implemented in Java you need to create a test harness for this class as well.

Solutions

Expert Solution

ARMY CLASS -

BANNER CLASS

TESTERS -


Related Solutions

Consider the Nomad Machine Company (NMC) problem from class. As the problem stated: "you should develop...
Consider the Nomad Machine Company (NMC) problem from class. As the problem stated: "you should develop two flow models" because NMC has sought "to build a new factory to expand its production capacity". Your task was to determine which factory to recommend. In this discussion assignment, upload the JPG outcome for the optimal solution. Your uploaded solution should have a similar 'look and feel' professionalism as the JPG file on the external site (figure TP-F8). Make sure to use solver...
You are looking to buy your first house. The cost of the house is $325,000. The...
You are looking to buy your first house. The cost of the house is $325,000. The bank has agreed to make a loan to you for 30 years at 3.15% if you can make a down payment of 7.00%, and the loan payments do not exceed 36% of your gross monthly income. Based upon this information: What is the amount of the mortgage loan that the bank will lend to you? What will be the amount of your monthly payments?...
Using the class Date that you defined in Exercise O3, write the definition of the class...
Using the class Date that you defined in Exercise O3, write the definition of the class named Employee with the following private instance variables: first name               -           class string last name                -           class string ID number             -           integer (the default ID number is 999999) birth day                -           class Date date hired               -           class Date base pay                 -           double precision (the default base pay is $0.00) The default constructor initializes the first name to “john”, the last name to “Doe”, and...
(In java language) Write an abstract class called House. The class should have type (mobile, multi-level,...
(In java language) Write an abstract class called House. The class should have type (mobile, multi-level, cottage, etc.) and size. Provide the following methods: A no-arg/default constructor. A constructor that accepts parameters. A constructor that accepts the type of the house and sets the size to 100. All other required methods. An abstract method for calculating heating cost. Come up with another abstract method of your own. Then write 2 subclasses, one for mobile house and one for cottage. Add...
You looking to buy your first house. The cost of the house is $350,000. The bank...
You looking to buy your first house. The cost of the house is $350,000. The bank has agreed to make a loan to you for 30 years at 3.25% if you can make a down payment of 10%, and the loan payments equal 40% of your gross monthly income. Based upon this information: A. What will be the amount of your monthly payments? B. How much is your gross monthly income? C. What must your annual salary be in order...
Why should you develop an HRM strategic plan?
Why should you develop an HRM strategic plan?
You and your spouse are considering purchasing your first new house. The house price is $300,000....
You and your spouse are considering purchasing your first new house. The house price is $300,000. You will make 10% down payment. The remaining balance can be financed with a 30 year mortgage loan with an annual interest of 6%. A. What is the monthly mortgage payments? B. How much do you need if you are to pay off the loan after 5 years (right after the 60th payment)? C. How much interest (in $) will you save from paying...
Write two classes Class A and Class B in class A you should read from the...
Write two classes Class A and Class B in class A you should read from the keyboard a number and you should call a public method of the class B that will print on the screen whether the number that was read from the keyboard in class A is multiple of 7 and has the last digit 5.
In this exercise you will apply you new understanding of class design to develop an advanced...
In this exercise you will apply you new understanding of class design to develop an advanced version of the array helper class we created in the classroom. This variation of the design will maintain the data stored in the array in an ordered fashion (0 -100 for our int storage) . The class should always maintain its stored data in order meaning at any time if the programmer iterates the items, they will come back in order. This means each...
For the project you have selected for this class, do the following: "House maintenance"    a....
For the project you have selected for this class, do the following: "House maintenance"    a. Collect the appropriate data to analyze (characterize) the current situation.    b. Decide which tool(s) from the course will be used in the analysis.    c. Analyze data using the tool(s) selected.    d. Determine course of action based on the analysis (improved situation).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT