Project 2 – Minivan Door Solved

60.00 $

Category: Tags: , , , ,
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (1 vote)

Project 2 – Minivan Sliding Door

 

Overview

In this assignment, you will write another complete class that is intended to reinforce your skills in writing instance variables, accessors, and mutators. We You will also practice the use of branching and conditionals via if statements, along with writing informal tests to verify the proper operation of your code.

Your task in this assignment is to develop a class that monitors and controls the operation of the power sliding door of a minivan.

Requirements

The state of the minivan’s side sliding door system is governed entirely by the following operational rules:

The door can be successfully locked or unlocked at any time, by using lock and unlock buttons. When the door is closed, the door cannot be opened if the gear shift is in any position but park, regardless of any other conditions. Even if the gear shift is in park, the door cannot be opened if it is locked. There are three mechanisms that can open the door: 1) an open button on the dashboard; 2) a handle on the outside of the door; or 3) a handle on the inside of the door. The inside handle mechanism cannot open the door, if a separate childsafe mechanism has been engaged, regardless of any other conditions. The childsafe engage/disengage switch can only be accessed while the door is open. The door can be successfully closed at any time, using the same mechanisms used for opening. The gear can be successfully changed at any time.

You will write a class that represents these features and manages the sliding door. To test your system, you must write an informal tester class as in the previous assignment, but this time no tests will be provided. For full credit, you must exercise every unique code path through your system at least once.

System Description

You will develop a class called MinivanSlidingDoor in the edu.vt.cs5044 package that models the sliding door system. The methods of this class will be invoked by other systems, displays, and sensors within the minivan to indicate certain requests or activities. The methods of your implementation must behave according to the operational rules stated above. Your class must implement the provided public methods exactly, without changing the method signatures in any way.

Your constructor must set an initial state with the door closed and unlocked, the childsafe disengaged, and the gear shift lever in Park.

Please note that each mutator call must always return a non-null Result value, even if no state is actually mutated due to the operational rules. It’s very important that you carefully review all of the comments in the Result file. There you’ll find critical details about how to deal with cases where more than one Result value may apply. This in turn will help you organize your code properly.

Downloads

Getting Started With Eclipse

The setup for this project is basically identical to the previous project. Create a new Java Project for this assignment, and within the src folder of that project create a new Package named edu.vt.cs5044 for your code. You will need to import all of the provided files into this package.

The MinivanSlidingDoor class already has a empty placeholders for all the public methods listed above. There is only enough code to satisfy the compiler at this point, so the methods don’t yet work as intended. However, we can at least start with something that compiles.

Finally, create a MinivanSlidingDoorTester file, and add a main() method so that you can exercise the implementation. At first, you can just construct a new MinivanSlidingDoor instance, then print the expected and actual result of calling the accessors to confirm the initial state.

Planning Your Development

Read through the description for each method, thinking about how you might implement and test the behavior, then plan an order in which you want to implement the methods. It’s completely natural to adjust your plan as you go along, but just try to choose one to get started for now. The constructor and the accessors should be relatively easy to implement (and test) first. In fact, all of the accessors that are unrelated to the result log are just simple one-line getters.

Once you’ve selected a mutator method to implement, don’t implement it quite yet! First, try to write at least one simple test case before you start coding the implementation. Any new tests will almost certainly fail when you first run them, but your code will begin to pass as you start to develop the method. This strategy goes by several names, but “Test-Driven Development” is the term we’ll eventually use. We’ll cover all of these concepts in much more depth — and practice them formally — starting with the next project.

Enumeration Types

You’ve been provided source code for three predefined enum types (specifically Direction , Result and Gear) to be used within the required methods. Please use this code exactly as provided, without any modification. JHtP 6.10 has more background on the usage of enum types. The basic idea is that we’ve defined a set of distinct constant values, in a way that leverages Java’s natural type safety system. This ensures that our code can only ever use valid values, as enforced by the compiler, thus eliminating typos and many other common mistakes.

Branches and Logical Operators

We’re striving for simplicity in these solutions. In this assignment, you must avoid nested branches. Also, you must avoid using the AND (&&) and OR (||) operators (see JHtP 5.9), although the NOT (!) operator is allowed. Web-CAT cannot enforce these rules, but using nested branches, AND, or OR will result in score deductions during the human review process. You may need to rearrange your branches to meet this requirement.

 

  • Minivan-2-qoq4en.zip