Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Assignment 05 Blue Jet Flight Information with Class and Inheritance General and specific program requirements: 1. Problem: Blue Jet has just.

Similar presentations


Presentation on theme: "Programming Assignment 05 Blue Jet Flight Information with Class and Inheritance General and specific program requirements: 1. Problem: Blue Jet has just."— Presentation transcript:

1 Programming Assignment 05 Blue Jet Flight Information with Class and Inheritance General and specific program requirements: 1. Problem: Blue Jet has just established flights to three cities from Sacramento. Blue Jet wants you to design and program a system to display flight information. (Yes, I know the real name is jetBlue.) 2.Your GUI must look like the one below. 3.Get a picture of any Blue Jet plane by searching Google using Image and the key words “jetBlue” 4.You are to create a Class with the Class Name, Properties and Method shown in the diagram below. The class “clsFlightInformation” must be in a separate file within your solution. Class Name Properties Method 5.You are to use a ComboBox to select the destination city. 6.Place the word Destination in the Text property of the ComboBox as seen. ComboBoxes are covered in Chapter 5 (Gaddis) Due Dec 4, 2014 Get started now.

2 Programming Assignment 05 Blue Jet Flight Information with Class General and specific program requirements: 7. Place the three city-state items in the ComboBox as shown below. See the next slides for the directions.

3 Programming Assignment 05 Blue Jet Flight Information with Class General and specific program requirements: 8. Select the ComboBox and Click on the Items’ (Collections) property button. Select Click here.

4 Programming Assignment 05 Blue Jet Flight Information with Class General and specific program requirements: 9. Enter the City-State values into the “String Collections Editor” EXACTLY as shown. There is one space after the comma. 10.Click OK (The ComboBox is now loaded and ready to use.) Enter these items here. Click OK when done.

5 The arrows show direction of the flow of data between the Object and Form1’s code. Programming Assignment 05 Blue Jet Flight Information with Class General and specific program requirements: 11. You are to code the class and then use its object in Form1’s code. 12.The object and Form1’s GUI communicate as shown below: a.The City-State from Form1’s GUI Sets the Destination Property in the Object. b.The Form1 GUI then Gets these three Properties values from the object: ArrivalTime, DepartureTime, and Gate. c.The TicketPrice Method calculates TicketPrice by adding 15% (Tax) to the Flight Price. That Method is used by Form1’s GUI, but the calculations are done within the TicketPrice Method within the Object. 12.5You must use Option Strict On in the Form1 code, and in both classes. Form1 code Object Code

6 Programming Assignment 05 Blue Jet Flight Information with Class General and specific program requirements: 13.You MUST use the values below for each of the three City-State Items. Washington, DCVancouver, WAChicago, IL Price 300DPrice 100DPrice 200D Tax Rate 0.15DTax Rate 0.15DTax Rate 0.15D Departure Time 7:00 amDeparture Time 8:00 amDeparture Time 9:00 am Arrival Time 3:00 pmArrival Time 10:00 amArrival Time 2:00 pm Gate 10Gate 20Gate 30 14.The partial code below is how I programmed the class. This will serve as a template. YOU MUST DOCUMENT THIS CODE, AS YOU WOULD THE CODE ON FORM1. I DID NOT DOCUMENT IN ORDER TO SAVE SPACE. Public Class clsFlightInformation Private mstrDestination As String Private mstrDepartureTime As String Private mstrArrivalTime As String Private mstrGate As String Private Const mdecWASHINGTON_DC_PRICE As Decimal = 300D Private Const mdecVANCOUVER_WA_PRICE As Decimal = 100D Private Const mdecCHICAGO_IL_PRICE As Decimal = 200D Private Const mdecTAX_RATE As Decimal = 0.15D Public WriteOnly Property Destination() As String Set(ByVal Value As String) mstrDestination = Value I USED IF-THEN-ELSE CASE LOGIC HERE. THIS IS WHERE I SET THE VALUES OF mstrDestination, mstrDepartureTime, mstrArrivalTime, and mstrGate. End Set End Property Public ReadOnly Property DepartureTime() As String Get Return I HAD CODE HERE. End Get End Property Public ReadOnly Property ArrivalTime() As String Get Return I HAD CODE HERE. End Get End Property Public ReadOnly Property Gate() As String Get Return I HADE CODE HERE. End Get End Property Public Function TicketPrice() As String I USED IF-THEN-ELSE CASE LOGIC HERE. USE THE CONSTANTS ABOVE TO CALCULATE THE TicketPrice. Use FormatCurrency() function here and return the value as a string so that it can be assigned, without conversion, to a label text property in the Form Code. End Function End Class

7 Programming Assignment 05 Blue Jet Flight Information with Class General and specific program requirements: 15. Now that you have coded your class, Sacramento International Airport decided to temporarily add a $10 gate fee. Since you don’t want to rewrite your base class, you are to write another class which will add $10 to the ticket price of each flight. You must use inheritance for this. Below is a diagram of how this will function. 16.IMPORTANT: I think it best to get your program running without using inheritance, then add it as a last step. You will need to make minor modifications to the Form1 code when you add a derived class. 17.Both classes MUST be written as two separate files within the solution. You will get a ZERO grade if you code the classes within the code of the Form. Again, the Classes below, must be written as two separate files. 18.The method in the derived class only needs one line of code within it. clsRevisedFlightInformatiion will inherit the four properties and the single method from clsFlightInformation. Note that there are no properties and only one method in clsRevisedFlightInformation. Your Form1 code must now use clsRevisedFlightInformation and not clsFlightInformation; and there is no need to change objFlightInfomation to objRevisedFlightInformation unless you want to. Remember, this $10 gate fee is temporary. Base class Derived class IMPORTANT: GET THE PROGRAM RUNNING WITHOUT clsRevisedFlightInformation, THEN ADD IT. No Properties One Method

8 Additional Requirements for Program05 PROGRAM REQUIREMENTS: 1.Use good internal documentation in Form1 code and the Class code. See example on the later slides. Don't forget to use single-line comments within the program code, IF they add to comprehension of how the program functions. 2.Be sure to use the FormatCurrency function to display the ticket price. In this program, use it in the Class. In other words the ticket price will be sent back to the Form code all ready to be displayed in a label. 3.You must use Option Strict On in the Form1 code and the two classes 4. You must use the appropriate three-letter prefixes for variables and constants. If a variable or constant is declared at the module level, you must add an "m" to the beginning of the three-letter prefix. Example: mstrDepartureTime. See the example on the previous slide. A variable declared WITHIN a subroutine (sub-procedure) does not need the "m" and it must not be used. 5.All variable names must use the "Pascal" method; That is, begin every word in the variable name with a capital letter. All other letters are lowercase. Example: mstrDepartureTime (The prefix must be in lower case.) 6.Constant names must be in all caps. Separate each word with an underscore, and use the appropriate prefixes. Example: mdecVANCOUVER_WA_PRICE Use good identifiers (constant names and variable names.) These must be as meaningful as possible, as short as possible, and as meaningful as possible. 7.There is no need to validate data in this program. 8. Your user interface must look very similar to the one on the first slide. 9.Use pseudocode to design the program. That is, write down each step necessary to solve the programming problem. The steps must be in the appropriate order. Don't worry about the syntax of the code. You will write the code later to match the steps you have written down. Remember, never start coding until you know the steps necessary to solve the programming problem. You must fully understand the requirements of the program before you start coding. 10.Always use a "D" after a literal numeric constant which is used to calculate money values. Example: Private Const mdecCHICAGO_IL_PRICE As Decimal = 200D 11.Be sure that you use internal documentation within your class as well as the code on the form. 12.The class must use WriteOnly and ReadOnly for properties if appropriate. 13.Calculations of the TicketPrice with currency formatting must be done in the Class Method, not in Form1 code. 14.All procedures and methods MUST do a SINGLE FUNCTION. Use the “and” & “or” test. 14.5 You must use Region/End Region on Form1 code, and both classes. Use Regions on Variable/Constant section, each property procedure, and each method.

9 Additional Requirements for Program05 (Continued) PROGRAM REQUIREMENTS: 15.The Classes MUST be written as separate files within the solution. You will get a ZERO grade if you code the classes within the code of the Form. Again, the Classes must be written as separate files. 16. You are to design this program yourself. Do your best to modularize it.

10 DOCUMENTATION EXAMPLE ONLY YOU MUST FOLLOW THE DOCUMENTATION CHARACTERISTICS OF THE PROGRAMS ON THE NEXT FOUR SLIDES. DOCUMENTATION EXAMPLE ONLY

11

12

13 Below is an example of how documentation must be done. Don't forget to add comments in the code where appropriate. Don't forget to document all button subroutines (sub-procedures). DOCUMENTATION EXAMPLE ONLY

14 (Print) Last ____________________________First_________________ FOLD HERE------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- MIS 15 section: Noon Program number1 2 3 4 5 6 7 GRADING STANDARDS POINTS POINTS Documentation was done according to guidelines: (0 OR 1 point)__________ GUI is reasonably correct:(0 OR 1 point)__________ Followed rules for forming constant names & variable names:(0 OR 1 point)__________ Used Option Strict On in the Form code and the two class:(0 OR 1 point)__________ Use FormatCurrency for displaying Ticket Price.(0 OR 1 point)__________ Ticket price is correct for all cities. (be sure to add tax (.15) and gate charge ($10))(0 OR 20 points)__________ SET and GET used correctly for properties.(0 OR 10 points)__________ Correctly used inheritance in the derived class that added the gate charge.(0 OR 10 points)__________ Regions were used on all modulesincluding the two classes. (0 OR 5 points)__________ ANY CALCULATIONS DONE IN THE FORM CODE (-50 POINTS) (All calculations MUST be done in the classes.) The base and derived classes not in two files in project files. (-50 POINTS) TOTAL POINTS: 50 pts. possible __________ Form-A Programming Assignment 05 Blue Jet Comments:

15 Program #2 Fall 2011 15 Form-B STUDENT FILLS IN THESE BLANKS: LAST NAME:_______________________________ FIRST NAME:________________________ PROGRAM (Circle) 1 2 3 4 5 6 7 8 DATE DUE:_________________ DATE SUBMITTED:__________________ PLACE A CHECK NEXT TO THE FOLLOWING: 1.____Saved the Program on a CD using the following directory and sub-directory: Your Name\Program 05 2.____Printed your full name and program number on the CD using a permanent black marker. 3.____Submitted the CD in required envelope style not much larger than the CD. 4.____Placed the CD in the envelope. 5.____Cut out this form along dotted edges and TAPE it to the envelope. CUT OUT THIS FORM ALONG THE DOTTED EDGES AND TAPE IT TO THE ENVELOPE. YOU MUST USE THIS STYLE THAT IS ABOUT THE SIZE OF YOUR CD. Do not lick to seal. Use metal clip. Program 5 Blue Jet Program


Download ppt "Programming Assignment 05 Blue Jet Flight Information with Class and Inheritance General and specific program requirements: 1. Problem: Blue Jet has just."

Similar presentations


Ads by Google