none
Sales Commission Calculator APP Visual Basic 2010

    Question

  • Items have a fixed price of $10 per unit. Use a Select Case statement to implement the following sales commission schedule:

    Fewer than 10 items sold = 1% commission

    Between 10 & 40 items sold = 2% commission

    Between 41 & 100 items sold = 4% commission

    More than 100 items sold = 8%

    Numbers of items sold 

    Gross sales:

    Commission (%)

    Earnings:

                         Calculate(button)

    I keep getting "End of statement expected" error...underlined below;

    Public Class SalesCommissionCalculatorForm

        Dim Commission As Object
        Dim Price As Double


        Private Property caseCode As Double
        Private Property ItemsSold As Object

        ' handles calculateButton_Click event
        Private Sub calculateButton_Click(ByVal sender As System.Object,
          ByVal e As System.EventArgs) Handles calculateButton.Click

            Dim caseCode Ad Integer ' stores case code entered
            Dim message As String ' displays access status of users

            caseCode = Val(caseCodeTextBox.Text)
            caseCodeTextBox.Clear()

            Select Case ItemsSold
                Case Is < 10
                    Commission = Price * 0.01
                Case Is < 41
                    Commission = Price * 0.02
                Case Is < 101
                    Commission = Price * 0.04
                Case Else
                    Commission = Price * 0.08
            End Select
        End Sub

    End Class ' SalesCommissionCalculatorForm

    • Moved by Naomi N Sunday, January 19, 2014 1:55 AM VB question - OP has a simple typo in the code
    Friday, January 17, 2014 4:29 PM

Answers

All replies

  • 1) This is a T-SQL forum, which may explain why on one has answered your post yet.

    2) You have a simple typo on the problematic line, "Ad" instead of "As".


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Friday, January 17, 2014 11:27 PM
  • Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 

    This is minimal polite behavior on SQL forums. What you did post is garbage and in the wrong forum. Do not Internet while drinking or texting :)

    CREATE TABLE Sales
    (transaction_nbr CHAR(10) NOT NULL,
     sale_qty INTEGER NOT NULL
      CHECK (sale_qty > 0),
     commission_rate AS 
     (CASE WHEN sale_qty < 10 THEN 0.01
           WHEN sale_qty BETWEEN 10 AND 40 THEN 0.02
           WHEN sale_qty BETWEEN 41 AND 100 THEN 0.04
           ELSE 0.08 END),
     ..);

    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking in Sets / Trees and Hierarchies in SQL

    • Proposed as answer by Naomi N Sunday, January 19, 2014 1:54 AM
    Saturday, January 18, 2014 4:23 PM
  • Looks like incomplete homework in addition to the typo.

    Sunday, January 19, 2014 8:02 PM
  • Looks like incomplete homework in addition to the typo.

    Yes it does.

    How is it that they don't realize that their instructors are fully aware of this forum and, I suspect, even periodically monitor it?


    Please call me Frank :)

    Sunday, January 19, 2014 8:11 PM
  • If providing homework assistance on a free public forum is unethical...

    Does that mean it's fine if we charge a fee?

    Just wondering what the rules are :D


    Thanks! Josh

    Tuesday, January 21, 2014 3:50 AM
  • 1) This is a T-SQL forum, which may explain why on one has answered your post yet.

    2) You have a simple typo on the problematic line, "Ad" instead of "As".


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Hi,

    I marked this reply as answer becasue the point 2 may solve your issue:

    change "Ad" to "As"

    If still no helping, you could feel free to let us know.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 23, 2014 5:46 AM