Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Help please

pseudocode

  • Please log in to reply
4 replies to this topic

#1 rabrown35

rabrown35

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 25 February 2012 - 05:41 PM

First let me say I am 35 years old, have not taken any classes since 1995 until now. This is a assignment from a online programming essential class and for some reason I am making this probably way to hard. I found this forum and figured I would see if I can pick some of your brains on this subject that I am a newbie on.

Assignment
A local department store hires you to write an automated checkout program to expedite customers in a hurry. The checkout line can only accept five items for any one purchase. Design a program that asks for the price of each item, and then displays the subtotal of the sale, the amount of the sales tax and the total. The sales tax is 6 percent.

You are to submit, as a Microsoft Word Document, the following for this assignment:

1. Pseudocode

2. Flowchart


I am having a hard time getting started on this assignment. I understand what it is asking, but just don't know how to get started. I know I am probably making this harder than it is.

The way I understand the question. The customer coming to this checkout line can only have 5 items. Add each item up to get a subtotal. Sales tax = 6%. The subtotal + 6% = Total.


So in a pseudocode is this acceptable.

Start
Checkout line = 5 Items
Subtotal = Item 1 + Item 2 + Item 3 + Item 4 + Item 5
Sales Tax = .6
Total = Subtotal + .6
End

Since pseudocode is not executable, How much of a wrong or right is there?

Any clarification on this would be greatly appreciated. Thanks
  • 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 25 February 2012 - 06:34 PM

Only 5 items suggests an array of 5 floats, and a loop to load prices.

total = subtotal * 1.06
  • 0

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

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


#3 macxp

macxp

    CC Lurker

  • New Member
  • Pip
  • 6 posts

Posted 26 February 2012 - 09:52 AM

1.Start
2.enter the no of items :
3.while(no. of item < 5 )do
4.Subtotal = Item 1 + Item 2 + Item 3 + Item 4 + Item 5
5.Sales Tax = .6*subtotal
6.Total = Subtotal + sales_tax
7.End

subtotal will be an array[4] of type char
  • 0

#4 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 29 February 2012 - 02:58 PM

1.Start
2.enter the no of items :
3.while(no. of item < 5 )do
4.Subtotal = Item 1 + Item 2 + Item 3 + Item 4 + Item 5
5.Sales Tax = .6*subtotal
6.Total = Subtotal + sales_tax
7.End

subtotal will be an array[4] of type char

Don't understand what you are trying here, main pieces are missing or totally wrong.

as a 3.5 in your code, there shuld be an asking for the next price
in 5, the tax is 6%, not 60%, so .06 would be
as a 6.5 a print would be needed.

And about your array of char? Why? See no point in using any strings or chars here at all, only floats or doubles.
  • 0

I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.


#5 macxp

macxp

    CC Lurker

  • New Member
  • Pip
  • 6 posts

Posted 01 March 2012 - 04:32 AM

Don't understand what you are trying here, main pieces are missing or totally wrong.

as a 3.5 in your code, there shuld be an asking for the next price
in 5, the tax is 6%, not 60%, so .06 would be
as a 6.5 a print would be needed.

And about your array of char? Why? See no point in using any strings or chars here at all, only floats or doubles.


right...it should be of type float or double
  • 0





Also tagged with one or more of these keywords: pseudocode

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