Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Need help with pseudocode

pseudocode

  • Please log in to reply
5 replies to this topic

#1 Chris Gilbert

Chris Gilbert

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 05 December 2011 - 06:30 PM

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.
  • 0

#2 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 06 December 2011 - 04:11 PM

Start with: do you know how to do this by hand? Can you write down the steps?
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#3 Chris Gilbert

Chris Gilbert

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

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.
  • 0

#4 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

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?
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/


#5 Chris Gilbert

Chris Gilbert

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

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.
  • 0

#6 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

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.
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/






Also tagged with one or more of these keywords: pseudocode

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download