Results 1 to 12 of 12

Thread: help needed for Repetition

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    help needed for Repetition

    hey guys
    My name is Laura and this is my first thread and I need your help please

    Write programs to solve the following problems using loops:


    1) You are offered two salary options for 10 days of work. Option 1: $100 per day. Option 2: $1 the first day, $2 the second day, $4 the third day, and so on, with the amount doubling each day. Determine, and output, which is the better option.




    2) Request a sentence from the user and then display the number of sibilants (that is, letters ‘S’ or ‘Z’ – not case sensitive) in that sentence. The counting should be carried out by a procedure (sub-routine or function).

    Thank you so much

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: help needed for Repetition

    We don't do people's homework for them. If you want to post what you have done so far with specific questions instead of just copying the questions right off your assignment and asking us to do it for you, then I am sure you will be able to get help here.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: help needed for Repetition

    If you would like us to help you, simply transposing your homework assignment into a post is not the way to do it. It's your homework so it's for you to do. We can help but it's for you to write your own code.

    So, what exactly have you done so far? What exactly are you having trouble with?

    Usually the best way to start is to forget that it's a programming problem and start with a pen and paper, writing out the steps you would have to take if you had to do it manually. Once you know what the steps are, then you can think about writing code to implement those steps. Writing code is not problem solving. You solve the problem first, then you write code to implement the solution.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    Re: help needed for Repetition

    Thank you, Ill be back with my questions !!

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    Re: help needed for Repetition

    Quote Originally Posted by jmcilhinney View Post
    If you would like us to help you, simply transposing your homework assignment into a post is not the way to do it. It's your homework so it's for you to do. We can help but it's for you to write your own code.

    So, what exactly have you done so far? What exactly are you having trouble with?

    Usually the best way to start is to forget that it's a programming problem and start with a pen and paper, writing out the steps you would have to take if you had to do it manually. Once you know what the steps are, then you can think about writing code to implement those steps. Writing code is not problem solving. You solve the problem first, then you write code to implement the solution.
    Thank you so much, that's really help. Ill follow your steps

  6. #6

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    Re: help needed for Repetition

    I did this so far but it's giving me errors!!


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    'salary options.
    Dim opt1, opt2 As Double
    opt1 = option1()
    opt2 = option2()
    1stoutput.items.add("option 1 = " & FormatCurrency(opt1))
    1stoutput.items.add("option 2 = " & FormatCurrency(opt2))
    If opt1 > opt2 Then
    1stoutput.items.add("option 1 pays better.")
    Else
    1stoutput.items.add("option 2 pays better.")
    End If

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: help needed for Repetition

    Quote Originally Posted by lvu98 View Post
    I did this so far but it's giving me errors!!
    Please be specific, i.e. what is the error message and on what line does it occur?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    Re: help needed for Repetition

    here is the problem:
    1stoutput.items.add("option 1 pays better.")
    1stoutput.items.add("option 2 pays better.")


    I actually don't know what is the right control should I add from the toolbox to the form beside the button, so I think this is why I got the error.
    Any idea pls.

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: help needed for Repetition

    I ask again: what error?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: help needed for Repetition

    Sounds like you only have a button on the form? Where did you come up with 1stoutput then? Try adding a listbox from the toolbox to your form, and another thing is that (unless it was a typo on your part) you can not name a control starting with a number. Perhaps that was supposed to be an L and not a 1?

  11. #11

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    Re: help needed for Repetition

    Quote Originally Posted by jmcilhinney View Post
    I ask again: what error?
    name toutpout is not declared

  12. #12
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: help needed for Repetition

    Sounds like you were getting help elsewhere, but they failed to mention you actually need to add a control to your form if you plan on using it in your code.

Posting Permissions

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



Click Here to Expand Forum to Full Width