Visual Basics Intro to progrmaing

profilerocko G
Exam-2Exam-3.pdf

Trip Journal

Test-2:

Recording the stages of the journey:

When the user arrives at a State, to record completion of that leg.

• They click on the state name in the Checked-Listbox.

• Enter the miles travelled in that leg

• Select the number of hours traveled

• Clicking the “Add to Journey” button has an event-handler which:

o Calculates the speed (Distance / Time)

o Concatenates the values from the 3 controls to a string: E.g. “You have completed the

“South Carolina leg which was 210 miles and took 3 hours at an average speed of 70mph”

o Adds the string to the JourneyArray

Test-3:

Write the code for a Journey class which has ...

o a JourneyArray variable in the class to store all the legs of the journey

o an AddLeg method which:

o Stores distance of current leg of journey in the Leg_Distance property

o Stores distance of current speed of the journey in the Leg_Time property

o Calculates speed as Leg_Distance / Leg_Time and stores it in Leg_Speed Property

o Stores the string describing the journey in the next position of the JourneyArray

o a replay journey method which concatenates all the legs of the journey together and returns

a string (including CRLFs after each leg).

Create the SAVANNAH_NY object from the JOURNEY class.

When the user chooses the numberofhours:

o Automatically calls SAVANNAH_NY.AddLeg using the miles and hours from the form controls.

Gets the speed from SAVANNAH_NY.Leg_Speed property and displays the speed in the speed

label.

o Calls the AddLeg method of the SAVANNAH_NY object

When the user clicks another state in the list-box, Hours NumericUpDown is automatically cleared

On the form, you will create a Savannah_NY object.

When they click on the state name in the Checked-Listbox it will:

Automatically put the distance into the text-box

Do everything that the “Add to Journey” button

Click Replay button: Calls the Replay method of the Journey object

o Replay method uses a for-loop to get each leg of journey from the JourneyArray within

the SAVANNAH_NY object