506017 Abstract Classes and Virtual Methods (C#)

Week 6: Abstract classes and Virtual Functions - iLab Help

Print This Page

Remember this!

Connect to the iLab here.

iLab 6 of 7: Abstract Classes and Virtual Methods (60 points)

Submit your assignment to the Dropbox located on the silver tab at the top of this page.

See Syllabus, Due Dates for Assignments & Exams, for due dates.

i L A B O V E R V I E W


• In the Week 5 lab, you created a program that created an Airplane class and two derived classes. In this application, you used polymorphism to override the behavior of the methods defined in the base class. This week, we are going to implement the same requirements from the Week 4 lab, but use a different object-oriented architecture.

• In Week 5, we used basic inheritance, where the base class implemented many of the class's operations, and we could actually create three types of airplane objects: (1) generic airplane, (2) fighter jet, and (3) passenger plane. This week, we will use abstract classes, and transform some of the base class methods into virtual methods. We will leave out the implementation and make the Airplane class an Abstract class. Then, we will create the same two derived classes: (1) fighter plane and (2) passenger plane, that must implement the virtual methods. Changing the Airplane class to an Abstract means that we can no longer create a generic Airplane object, and that any Airplane object that we do create must be a subclass of the base Airplane class.

• Since the architecture of the application is the important learning point of this lab, we will not change the actual algorithms of the methods, but will just move the implementation of the methods into the derived classes.


Step Deliverable

Step 12 Screen shots of running program results.

Step 13 Zip file with entire Lab files.

Lab Steps


• If you are using the Citrix remote lab, follow the login instructions located in the iLab tab in Course Home.

• Locate the Visual Studio 2008 icon and launch the program.

• You will use components of Lab 3.

i L A B S T E P S

STEP 1: Create and Set Up Application.

• Make a copy of your Week 5 lab and save it as "CIS247A Week 6 Lab-LastName".

STEP 2: Analyze the UML Class Diagram.

Review the class diagram below and notice the following key points:

• The name of the Airplane class has been renamed to Airplane_Abstract and the bold, italic letters specify that the entire class should be defined as an abstract class.

• The members in normal case font indicate that these members are declared as class-level members and the implementation of these members is done in the parent class.

• Methods in italic letters are pure virtual functions that have no implementation in the base class, and MUST be overridden in the derived classes.

• The Move method is a virtual method in the base class, but can be overridden in the derived classes. This will work in the Fighter Jet class in this example, BUT not in the Passenger Airplane class.

STEP 3: Modify the Airplane Class.

Using the Class diagram, modify the Airplane class to:

• Specify that the class is abstract;

• Specify that the Move method is a virtual method; and

• Specify that TurnRight, TurnLeft, Accelerate, and Decelerate are pure virtual methods. Remove the code from each of the methods (copy and paste it into a Notepad file, since you will want to use it in each of the derived class's implementation of the methods).

STEP 4: Modify the Jet Fighter Class.

Using the Class diagram, modify the Jet Fighter to:

• Using the same algorithms and formulas from Week 5 (and Week 3) for the Fighter Jet class, implement each of the pure virtual functions: (1) TurnRight, (2) TurnLeft, (3) Accelerate, and (4) Decelerate.

• Override the base class Move method so that the Jet Fighter moves 10 times faster than a generic airplane.

STEP 5: Modify the PassengerAirplane Class.

Using the Class diagram, modify the Passenger Airplane class to:

• Using the same algorithms and formulas from Week 5 (and Week 3) for the Fighter Jet class, implement each of the pure virtual functions: (1) TurnRight, (2) TurnLeft, (3) Accelerate, and (4) Decelerate.

STEP 6: Modify the Windows Interface Form.

Ensure thatWindows Form correctly implements each of the operations using the modified class architecture:

• List box, or combo box control, that allows the user to select whether the airplane is a generic airplane, a passenger plane, or a fighter plane.

• When the user selects the type of plane, create a new object of the identified type.

• Add a command button that when selected provides the information about the specific type of airplane object. [Hint: program each event handler to handle a generic airplane object, then use the polymorphic methods].

• When the user selects the existing operations, the appropriate object type methods will be invoked.

STEP 7: Compile and Test.

• When done, compile your code by clicking on Build, Build application name. Then, debug any errors in the Error Window until your code is error-free.

• To execute your code, click Start, and then Start Debugging. Check your output to ensure that you have the desired output. If you need to fix anything, close your execution window and modify your code as necessary and rebuild.

STEP 8: Execute Screen Prints.

• Capture the results of each test and paste into a Word Document.

STEP 9: Submit Deliverables.

• Put all of the Visual Studio files into a zip file.

• Put the zip file and execution screen shots (Word document) in the Dropbox.

Submit your lab to the Dropbox located on the silver tab at the top of this page. For instructions on how to use the Dropbox, read these Step-by-Step Instructions or watch this Dropbox Tutorial.

See Syllabus, Due Dates for Assignments & Exams, for due date information.

Beceriler: .NET, Her şey Kabul, C# Programlama, Veri Girişi, Grafik Tasarımı, Simge Tasarımı, Web Sitesi Yönetimi

Daha fazlasını gör: cis247a week lab, entire class virtual, week polymorphism ilab, work from home document review, work at home free start up, windows application icon design, virtual home design, virtual functions and polymorphism, user case diagram example, user case diagram, use of use case diagram, used case diagram, use case types, use case tutorial, use case to class diagram, use case diagram uml tutorial, use case diagram uml example, use case diagram tutorial, use case diagram steps, use case diagram scenario example, use case diagram of, use case diagram means, use case diagram login, use case diagram for login form, use case diagram for

İşveren Hakkında:
( 2 değerlendirme ) Lewisville, United States

Proje NO: #2251943



As Discussed.

%selectedBids___i_period_sub_7% gün içinde 40%project_currencyDetails_sign_sub_9% %project_currencyDetails_code_sub_10%
(105 Değerlendirme)