question archive Harbor View Mooring wants to modify the demonstration program to more closely match their actual setup
Subject:Computer SciencePrice: Bought3
Harbor View Mooring wants to modify the demonstration program to more closely match their actual setup. Although most of their mooring slips are uncovered, opened to the weather elements, others are covered. Some of the covered slips also have a door to further protect the boat from being affected by adverse weather conditions. In demonstrating the ability of an object-oriented class to inherit the properties of its base class, and thus cut down on development time, you need to extend the Slip Class to create a Covered Slip Class. The covered slip will include all the information of the regular slip, but will also have a height. Because some of these covered slips also have doors (and others do not), you need to track this information for each covered slip.
Because some slips are covered, they cannot moor a sailboat, because masts are generally too high. So, you will need to extend your boat class to keep track of which boats are sailboats. For sailboats, besides all the elements of a normal boat, you will need to keep track of their mast height and the depth of their keel. Sailboats cannot be moored in a covered slip.
You are expected to follow the "General Directions" found in the "Course Project Instructions" link on our course page.
Your tasks for Unit 5 are:
Use the Boat class you created in Unit 4. Use the Slip class you created in Unit 4. Create the extended Classes for each of the object types indicated above (Covered Slip and Sailboat). Create appropriate Methods for each Class as you solve the programming tasks performed in this Unit (which will include getters and setters, and a class constructor that takes all elements of the extended class with its base class). (See Note #2 in Programming Notes below.) Create an array that contains covered slips, populate the array with 5 to 7 objects, setting all fields in the extended and base class. (See Note #3 in Programming Notes below.) Create an array that contains sailboats, populate the array with 5 to 7 objects, setting all fields in the extended and base class. (See Note #3 in Programming Notes below.) Prompt the user for a sailboat ID: if the sailboat ID is valid, return the height of the boat and the value of the boat (using "getter" Methods from the SailBoat/Boat classes) (If they enter an invalid boat ID, inform them of such.) (No need to prompt the user for more boat IDs; just demonstrate this function once in your program; i.e. only ask for one sailboat ID, then continue on in the program.) Prompt the user for a covered slip ID:if the covered slip ID exists, tell (1) the height of the slip (2) if it has a door or not, and (3) whether the slip is rented or not (using "getter" Methods from the CoveredSlip/Slip classes). (See Note #3 in Programming Notes below.) (If they enter an invalid slip ID, inform them of such.) (No need to prompt the user for more covered slip IDs; just demonstrate this function once in your program; i.e. only ask for one slip ID, then continue on in the program.)
Unit 5 Programming Notes:
Because you are using some of the same Classes you created in Unit 4 (and will be instantiating your objects with some of same data you have already created), you should copy your Visual Studio solution to create your Unit 5 Project. You can then add Methods to your Class files for Unit 5. (As in Unit 4, even though you will be submitting four separate .cs files, it is suggested that you create them all as one Visual Studio Project, if that is what you are using for your C# programming.) For creating a constructor that will populate the extended class and the base class, see the discussion and examples on page 337 of your textbook. Because you will only be creating SailBoats and CoveredSlips, you can modify your array types and the data you use to instantiate these extended objects.
Unit 5 Deliverables:
A boat Class file with indicated Methods defined (ok to leave methods from previous Units). A sailboat Class file with indicated Methods defined. A slip Class file with indicated Methods defined (ok to leave methods from previous Units). A covered slip Class file with indicated Methods defined. A main C# test program that carries out the processes indicated above.