help needed for Repetition
hey guys :wave:
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 :)
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.
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.
Re: help needed for Repetition
Thank you, Ill be back with my questions !!
Re: help needed for Repetition
Quote:
Originally Posted by
jmcilhinney
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
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
Re: help needed for Repetition
Quote:
Originally Posted by
lvu98
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?
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.
Re: help needed for Repetition
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?
Re: help needed for Repetition
Quote:
Originally Posted by
jmcilhinney
I ask again: what error?
name toutpout is not declared
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.