Need Help With Program
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Need Help With Program

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    Need Help With Program

    Hi Guys,
    I need help in coding this program below in C#. Anyone's help is greatly appreciated..


    Our ticket brokers (by my office) need a little program to assist them in better analyzing secondary market value evaluation of Knicks tickets at MSG.

    User (the broker) will enter two or more ticket's information into the program.

    For each ticket, the following information is provided:

    1) Section: an integer value (ex. 101, 215 etc)
    2) Row: an integer value (ex. 1, 20 etc)
    3) Price: The price of the ticket

    Your program is to output the section, row and price of the cheapest and most expensive tickets entered. It also needs to report the average ticket price.

    Collect the input and do all the computation in the main() function. However, you will need to write a new function -- name it DisplayResults() -- that will output the results. In the main() function, you will call DisplayResults(), and send in the row, section and price of the cheapest and the most expensive ticket along with the average price of all tickets. Inside DisplayResults() function, you will display these values in a user friendly manner. Here is a screenshot of the program:



    In case you need it, I have a suggested set of steps to follow:

    Step 1:
    Declare variables for:
    minTicketPrice, minTicketSection, minTicketRow -- these will hold the cheapest ticket information.
    maxTicketPrice, maxTicketSection, maxTicketRow -- these will hold the most expensive ticket information.
    count -- this will be entered by the user telling us how many tickets he has
    price, section, row -- these will be entered by the user for each ticket (inside the loop).
    sum -- we will use this variable to sum up the prices of all tickets (to find average later on).

    Step 2:
    initialize minTicketPrice to a large number (ex 9999999).
    initialize maxTicketPrice to a small number (ex. -1)

    Step 3:
    Ask user how many tickets he has (count).

    Step 4:
    Setup a loop that will repeat a set of statements for count many times.

    Step 5:
    Inside this loop, ask for ticket information (price, section and row).
    If price of this ticket is larger than maxTicketPrice, then set maxTicketPrice, maxTicketSection and maxTicketRow to price, section and row, respectively.
    If price of this ticket is smaller than minTicketPrice, then set minTicketPrice, minTicketSection and minTicketRow to price, section and row, respectively.
    Add the price of the ticket to sum.

    Step 6:
    Find average ticket price, which is basically dividing sum to count.

    Step 7:
    Send minTicketPrice, minTicketSection, minTicketRow, maxTicketPrice, maxTicketSection, maxTicketRow and average you computed in step 6 to a function called DisplayResults.

    Step 8:
    Write a function that takes minTicketPrice, minTicketSection, minTicketRow, maxTicketPrice, maxTicketSection, maxTicketRow and average as input. You will use cout to output this information in a user friendly manner.

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,851

    Re: Need Help With Program

    Please do not start more than one thread on the same issue.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jan 2009
    Posts
    596

    Re: Need Help With Program

    Quote Originally Posted by Sayyesmoreinlife View Post
    Our ticket brokers (by my office) need a little program to assist them in better analyzing secondary market value evaluation of Knicks tickets at MSG.
    Why do your ticket brokers phrase this coding request (and give you suggestions as to how to do it) as if it is a homework question?

    Please read the forum FAQ on Homework .

  4. #4
    Join Date
    Apr 2012
    Posts
    3

    Re: Need Help With Program

    Sorry to say this, but there are people with genuine problems, whose threads get lost in the middle of messages like this one, so think about them when you decide to post something like this again, and think about you when you will be in the same situation - you wouldn't like it if others get in front of you with useless stuff.

  5. #5
    Join Date
    Apr 2012
    Posts
    2

    Re: Need Help With Program

    Thanks a lot guys for the help.. I am stunned!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center