I was wondering if you could help me with an assignment i have due by Wednesday...i honestly have NO IDEA what im doing and my teacher doesn't seem to want to help out....so if i post the questions on here do you think you can help me with them???????? Its important that i get this done cause my semester ends on Wednesday of this week lol......if you cant i understand but so far your the only on i have found that seems to know what he is doing lol...please let me know either on here or at cgilbert0039@kctcs.edu....thank you!!!:confused:
---------- Post added at 09:30 PM ---------- Previous post was at 09:23 PM ----------
here is what he told us to do but i have NO IDEA what im doing
I want you to develop a program to add up the cost of a number of items purchased by a customer then calculate the change to be returned given the amount the customer gives you to cover the cost. Don't worry about the tax right now.
What you need to do is first write the pseudocode, then write the program in QBasic. You will need to test it, of course. I would write this is parts. One part would be totaling the cost of the items. Sounds like we need a loop. We don't know how many items, so a while loop would probably be the best bet. We will need a running total variable. We will need to input the cost of each item. We will need to input the amount given to us by the customer. We will need a variable for that. We will need to subtract the running total from the amount from the customer. We will need a variable to hold that. Etc.
I dont know how to use Qbasic..and neither does my dad and he is real good with computers.....please let me know if you can help me with this.
13 replies to this topic
#1
Posted 05 December 2011 - 06:30 PM
|
|
|
#2
Posted 06 December 2011 - 04:11 PM
Start with: do you know how to do this by hand? Can you write down the steps?
#3
Posted 06 December 2011 - 06:22 PM
Nope...i honestly have no idea...i havent had time to study or anything with this...and im barley passing this class as it is...can you or someone please help...i have till midnight tomorrow night.
#4
Posted 06 December 2011 - 06:54 PM
So wait: you don't know how to add to cost of items or calculate change by hand?
#5
Posted 06 December 2011 - 07:17 PM
Well...honestly....i dont know how to do any of it...i had some help from one of my friends when the class first started but since they got out of the class they wont help me with it and i dont understand how to do any of it....i have to write a whole code and stuff here is the assignment i have to do
Find the minimum value in a list of N items
minimum list[1];
index 2;
while index N do
if list[index ] < minimum then
minimum list[index ];
end if
index index + 1;
end while
print minimum;
find the minimum value in a list (array). Convert this to a QBasic program and test it
Honestly...i wouldnt ask for help like this if i didnt need help like i do.....PLEASe if you could help me with this it would be awesome.
Find the minimum value in a list of N items
minimum list[1];
index 2;
while index N do
if list[index ] < minimum then
minimum list[index ];
end if
index index + 1;
end while
print minimum;
find the minimum value in a list (array). Convert this to a QBasic program and test it
Honestly...i wouldnt ask for help like this if i didnt need help like i do.....PLEASe if you could help me with this it would be awesome.
#6
Posted 07 December 2011 - 05:43 AM
Wait, what? Back up a LOT.
Things you need to do:
1) get the prices of the items
1A) keep a running total of those prices
2) get the amount of money handed to you
3) give back the difference as change
Where are you getting lists? Why is there a minimum going on?
When learning to program, ALWAYS start by working the problem on paper. Not recording an algorithm, just getting a feel for the scenario. For example:
Bob wants to by 3 oranges for $2.00 (total so far: $2.00)
Bob wants to by a Snickers for $1.50 (total so far: $3.50)
Bob wants to by a cheeseburger for $2.75 (total so far: $6.25)
Bob hands me $10.00 to pay for it.
I give back $10.00 - $6.25 = $3.75 in change.
This isn't writing the algorithm, it's doing the problem by hand. Now you can look at what you did by instinct, and try to formalize it into pseudocode.
Things you need to do:
1) get the prices of the items
1A) keep a running total of those prices
2) get the amount of money handed to you
3) give back the difference as change
Where are you getting lists? Why is there a minimum going on?
When learning to program, ALWAYS start by working the problem on paper. Not recording an algorithm, just getting a feel for the scenario. For example:
Bob wants to by 3 oranges for $2.00 (total so far: $2.00)
Bob wants to by a Snickers for $1.50 (total so far: $3.50)
Bob wants to by a cheeseburger for $2.75 (total so far: $6.25)
Bob hands me $10.00 to pay for it.
I give back $10.00 - $6.25 = $3.75 in change.
This isn't writing the algorithm, it's doing the problem by hand. Now you can look at what you did by instinct, and try to formalize it into pseudocode.
#7
Posted 07 December 2011 - 06:54 AM
the last post i posted is the assignment i have to do.....i dont know how to do it.
Find the minimum value in a list of N items
minimum list[1];
index 2;
while index N do
if list[index ] < minimum then
minimum list[index ];
end if
index index + 1;
end while
print minimum;
find the minimum value in a list (array). Convert this to a QBasic program and test it
Find the minimum value in a list of N items
minimum list[1];
index 2;
while index N do
if list[index ] < minimum then
minimum list[index ];
end if
index index + 1;
end while
print minimum;
find the minimum value in a list (array). Convert this to a QBasic program and test it
#8
Posted 07 December 2011 - 08:49 AM
Do you understand what the pseudocode is doing? Have you traced through it with real data?
#9
Posted 07 December 2011 - 09:12 AM
i dont know how to do any of it honestly.....but if u cant help me either its ok.....
#10
Posted 07 December 2011 - 09:25 AM
Forget about pseudocode.
You work at a store, someone come and want a item, give you money and want his money back
What is going on in your head to be able to calculate the cost, and how much you should give him back?
And tell us step by step
You work at a store, someone come and want a item, give you money and want his money back
What is going on in your head to be able to calculate the cost, and how much you should give him back?
And tell us step by step
#11
Posted 07 December 2011 - 10:03 AM
I think we have another case of what the OP means by "help" is "do it for me". If you want help, it's much more likely going to come in the form of helping you figure it out for yourself, so you will truly learn it.
Forget about code and pseudocode for a minute. In fact, forget about computers. Computers don't exist. There's no such thing. Now. Do you know how to follow directions?
If someone tells you how to get to the store by saying, First: Go three blocks and take a right. Next: Go two blocks and take a left. Last: Go one block to your destination. Could you follow those directions?
Now: Back to computers: Pseudo code is no different than the "algorithm" I posted above for getting to the store. It's a list of directions that you must follow. It becomes only slightly more complicated when you introduce if statements and loops, but, using common sense, you should be able to follow them.
With your example above, what are the instructions telling you to do? Grab a piece of paper and a pencil and work it out.
There you have it. If you've worked through this on paper, you should arrive at your result. Now, use common sense and determine whether your result is correct according to the description of the algorithm on the first line. If not, you've made a mistake somewhere and need to start again.
Again, the pseudocode is pretty sloppy, so I can understand that you were confused. I personally would have included some = operators in those assignment statements, or at least the word "LET", so it would be a little more clear.
Forget about code and pseudocode for a minute. In fact, forget about computers. Computers don't exist. There's no such thing. Now. Do you know how to follow directions?
If someone tells you how to get to the store by saying, First: Go three blocks and take a right. Next: Go two blocks and take a left. Last: Go one block to your destination. Could you follow those directions?
Now: Back to computers: Pseudo code is no different than the "algorithm" I posted above for getting to the store. It's a list of directions that you must follow. It becomes only slightly more complicated when you introduce if statements and loops, but, using common sense, you should be able to follow them.
With your example above, what are the instructions telling you to do? Grab a piece of paper and a pencil and work it out.
Find the minimum value in a list of N itemsThis is the title of the algorithm. It's not an instruction, but keep it in mind. It describes what we're about to accomplish.
minimum list[1]; index 2;These are just declarations. We are declaring placeholders here. If you remember back in algebra class that 'x' can stand in place for a number, then you've already grasped the concept here. We've declared two variables: one named 'minimum', and one named 'index'. They've both been assigned specific values. Can you work out what they are? Hint: It's the other information in the line along with the variable name. Another hint: This pseudo code looks like it's assuming that the variable 'list' already exists, and is in fact a list. HUGE HINT: You can use the square brackets to access a particular value in the list using its position, or index, value.
while index N doI'm guessing there's a missing operator here. I'll go ahead and assume it's the <= operator. While index is less than N, we are going to do something. N, i'm assuming, by the wording of the first line, is the length of the list. The pseudocode is a little bit sloppy, with missing operators and such, but common sense should be able to fill in the blanks.
if list[index ] < minimum thenThis should be simple enough for you to work out. Look at your paper now. Look at the values this statement is referencing. Now, fill them into the equation. Does the equation stand true? Or does it form a false statement? The result will tell you what to do next.
minimum list[index ];This looks awfully familiar to one of the statements toward the beginning. Can you work out what it's trying to accomplish here?
end ifThis is a marker for the end of the body of the if statement.
index index + 1;Another statement that you should be able to recognize by now.
end whileThis is a marker for the end of the body of the while loop.
print minimum;This should be pretty self explanatory.
There you have it. If you've worked through this on paper, you should arrive at your result. Now, use common sense and determine whether your result is correct according to the description of the algorithm on the first line. If not, you've made a mistake somewhere and need to start again.
Again, the pseudocode is pretty sloppy, so I can understand that you were confused. I personally would have included some = operators in those assignment statements, or at least the word "LET", so it would be a little more clear.
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid
#12
Posted 07 December 2011 - 11:21 AM
Chris Gilbert said:
i dont know how to do any of it honestly.....but if u cant help me either its ok.....
I'm really, really trying to help you. The trick is, I won't do it for you, I'm trying to help you do it yourself.
Step 1: can you understand the pseudocode you posted? Have you tried stepping through it by hand?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









