Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a project to input chartering information about yachts and print a summar

ID: 3545052 • Letter: C

Question

Create a project to input chartering information about yachts and print a summary report showing the total revenue, number of charters, and average hours per charter.


Menus


The File menu will contain items for Print Summary, Print Yacht Types, and Exit. Place a separator before Exit. The Edit menu should have items for Clear the Next Charter, Add Yacht Type, Remove Yacht Type, and Display Count of Yacht Types. Include a separator after the Clear item. The Help menu will contain an About item that displays an About form.


The form


- The form should contain text boxes for responsible party, hours chartered, and the calculated price of the charter.


- A drop-down combo box will contain the type of Yacht: Ranger, Wavelength, Catalina, Coronado, Hobie, C&C, Hans Christian, and Excalibur. Any items that are added to the text box during processing must be added to the list.




- A drop down list will contain the sizes 22,24,30,32,36,38,45 No new sizes can be added


- An OK button will calculate and display the price and add to the totals. The calculations will require price per hour using the following numbers.


Size Hourly Rate


22     95.00


24     137.00


30     160.00.


32     192.00


36     250.00


38     400.00


45     550.00




- A Clear button will clear the contents of the screen controls. The functions of the Clear button are the same for the Clear for Next Charter menu item.


-Make the Ok button the Accept Button and the Clear button the form's cancel button




SUmmary Report


The summary report will print the summary information and send the report to a Print Preview dialog box. The summary information will include Number of Charters, Total Revenue, and Average hours Chartered. Include your name on the output and identifying labels for the summary information.


Yacht Types Report


Display the yacht types in the combo box in the Print Preview dialog box. Include your name and a title at the top of the report.

Explanation / Answer

Option Explicit


Private Sub mnuFileExit_Click()

'Terminate the program



End Sub


Private Sub mnuFileNewCharter_Click()

'Hide the main form and show the Charter form using syle vbModal




End Sub


Private Sub mnuFilePrintSummary_Click()

'Declare local string variables for formatting

Dim strFormattedAverage As String

Dim strFormattedTotal As String

  

'Print Summary if there is data

If gintCount > 1 Then

'Format numeric data and assign to string variables

strFormattedAverage = FormatNumber(gcurTotalHours / gintCount, 1)

strFormattedTotal = FormatCurrency(gcurTotal)


'Print Report - Showing Average Hours Chartered and Total Revenue





'Send current page to printer and terminate print job



'Current Charter line item and summary report is finished

'permit user to print Yacht List


Else 'No data to print

'Display Error Message



End If


End Sub


Private Sub mnuFilePrintYachtType_Click()

'This sub procedure prints the contents of the Yacht types in

'the combobox to the printer

  

'Declare local variables for use in For-Loop

Dim intIndex As Integer

Dim intFinalValue As Integer

  

'Print heading

Printer.Print

Printer.Print , , "Yacht List"

Printer.Print

  

'Print the Yacht Types listed in the ComboBox

With frmCharter.cboYacht

intFinalValue = .ListCount - 1

For intIndex = 0 To intFinalValue

Printer.Print , .List(intIndex)

Next intIndex

End With

  

'Send the current page to the printer and terminate the print job



End Sub


Private Sub mnuHelpAbout_Click()

'Invoke the About form using vbModal


End Sub


============================================================================

'Lab: Exercise 7.3

'Programmer:

'Module: Charter.frm

'Description: Program will print a summary report of the

' customer name, charter hours, rate per hour,

' type of yacht, yacht size and add to total.


Option Explicit



Private Sub cmdCancel_Click()

'This sub procedure cancels request and returns to Main form

  

'Clear TextBoxes



'Reset combo boxes by assigning -1 to ListIndex property



'Return to Main form (Hide Charter form and show Main form)



End Sub


Private Sub cmdClear_Click()

'This sub procedure clears the form


'Clear TextBoxes



'Reset combo boxes by assigning -1 to ListIndex property



'Reset focus on name text box



End Sub


Private Sub cmdOK_Click()


'This sub procedure calculates the charter and adds to totals


'Declare local output variables

Dim curCost As Currency

Dim strFormattedCost As String

Dim strFormattedHours As String

  

'Declare local input variables

Dim curHours As Currency

Dim intSize As Integer

  

'Validate Input -- Use Nested If-Then-Else construct

If Val(txtHours.Text) > 0 Then

If cboYacht.Text <> "" Then

If cboSize.ListIndex <> -1 Then


'***Input Data is Valid***

'Convert text input to numeric

curHours = Val(txtHours.Text)

intSize = Val(cboSize.Text)

  

'Compute cost - call curRate function passing intSize and then

'multiply times curHours, assigning to curCost


  

'Update totals(global variables)



  

'Update Yacht ComboBox if new yacht was added

With cboYacht

If .ListIndex = -1 Then 'New yacht type entered

.AddItem .Text 'Add to list

.ListIndex = .NewIndex 'Set ListIndex for print

End If

End With


'Format cost and hours variables and assign to string variables


  

'Print Charter line item

Printer.Print Tab(5); txtName.Text; _

Tab(30); cboYacht.List(cboYacht.ListIndex); _

Tab(45); intSize; _

Tab(60 - Len(strFormattedHours)); strFormattedHours; _

Tab(75 - Len(strFormattedCost)); strFormattedCost


'Do not allow user to print a Yacht List

'between the Charter line items and the summary


'Call click event to clear screen


Else 'Size missing

'Display error message and reset focus


  

End If

  

Else 'Yacht Type missing

'Display error message and reset focus



End If

  

Else 'Hours missing or invalid

'Display error message and reset focus


End If

End Sub


Private Sub Form_Activate()

'Set the focus in the name text box


End Sub


Private Sub mnuEditAddYachtType_Click()

'Enter a new Yacht name into Yacht List


If cboYacht.Text <> "" 'If TextBox has value

'Add name to list using AddItem method


  

Else 'Name missing

'Display error message

  

End If

End Sub


Private Sub mnuEditDisplayCountofYachtTypes_Click()

'Display a count of the yacht types in a mesage box


  

End Sub


Private Sub mnuEditRemoveYachtType_Click()

'Remove a Yacht name from Yacht List


If cboYacht.Text <> "" Then 'If TextBox has value

'Remove name from list using RemoveItem Method

  

Else 'Missing value

'Display error message

  

End If

End Sub


Private Function curRate(intSize As Integer) As Currency

'This function procedure calculates the HourRate


If intSize = 22 Then

curRate = 95

ElseIf intSize = 24 Then

curRate = 137

'Complete the If/ElseIf latter






End If


End Function

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote