Jump to content



Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  Dath : (20 October 2018 - 05:21 AM) Boo
@  Rujio : (19 October 2018 - 07:07 PM) The old link is now invalid. I probably didn't have a discord then, but I do now, so
@  acceptance : (19 October 2018 - 10:07 AM) (Username - iDontEvenLikePie)
@  acceptance : (19 October 2018 - 09:58 AM) I joined. Don't ask me why I haven't until now but I did that thing.
@  Fire Blazer : (18 October 2018 - 07:12 PM) if it doesn't work, just reply with your account info and I'll add you as a friend and can you add after that... (or do that anyway just because :P if FES ever goes down it'll be hard to contact y'all lol)
@  Fire Blazer : (18 October 2018 - 07:12 PM) not sure if you're interested but it's there if so. (I know I had posted the link here in a thread before so I figure y'all would've joined if you had wanted to, but maybe something changed)
@  Fire Blazer : (18 October 2018 - 07:11 PM) sent both of you invites via PM just now
@  Fire Blazer : (18 October 2018 - 07:10 PM) but somehow he's not on my friend's list. honestly confused -_-
@  Fire Blazer : (18 October 2018 - 07:10 PM) yeah I thought I invited him at some point... weird
@  acceptance : (18 October 2018 - 03:41 PM) something inside of me fervently believes kirant already knew that lolol
@  xcrash1998 : (18 October 2018 - 06:59 AM) Yes we do
@  kirant : (17 October 2018 - 05:11 AM) We have a Discord?
@  acceptance : (16 October 2018 - 11:39 PM) Accepted.
@  acceptance : (16 October 2018 - 11:39 PM) Oh wow. Looks like I've finally been...
@  Fire Blazer : (16 October 2018 - 03:52 AM) even you, Pie :P
@  Fire Blazer : (16 October 2018 - 03:51 AM) feel free to join the Discord and chat with us if you haven't
@  Fire Blazer : (16 October 2018 - 03:51 AM) real sad this forum is dead, but hope y'all are all doing okay
@  Fire Blazer : (16 October 2018 - 03:50 AM) yoooo sup
@  acceptance : (04 October 2018 - 02:34 AM) TOV Definitive Edition has me pretty hyped up for the franchise right now.
@  acceptance : (04 October 2018 - 02:30 AM) Its been a while since I've been this excited to play a tales game lolol

Photo

Some real basic questions - PseudoCode


  • Please log in to reply
No replies to this topic

#1 MagixTricks

MagixTricks

    Member

  • Members
  • PipPipPip
  • 36 posts

Posted 20 September 2013 - 12:39 PM

Okay so i'm Taking a course on programming, and we're starting with pseudocode. Unfortunately the teacher does not like to- well, teach, so I'm doing it on my own. I got it pretty decent, and I can do the assignment just fine how it is "expected to be done"
but I wanted to try and go further.

Here is the assignment:
QUOTE
A customer in a storage is purchasing five items.  Design a program that asks for the price of each item, and then displays the subtotal of the sale, the amount of sales tax, and the total.  Assume the sales tax is 6%."


Okay so before i show my pseudocode; I understand that it would be simple to just have the user input all the item prices, and then do the calculations.

What i am trying to achieve with my pseudocode is to have the computer display current sub totals and current amount of tax being paid after each item. These prices would obviously build up as you go from item price 1 to item price 2 to item price 3, etc...

Here's the pseudocode:
CODE
//Declarations
Declare INT itm_1
Declare INT itm_2
Declare INT itm_3
Declare INT itm_4
Declare INT itm_5
Declare VAR crnt_Sub
Declare VAR crnt_Tax
Declare VAR total

//BEGIN CODE
 //Display Box [Item1]
  Display "Please Enter the price of your first item"
 //Input/Output
  Input itm_1
  crnt_Sub = itm_1  
  Calc crnt_Tax = itm_1 * .06
 //Display Box
  Display "Your current sub total is: $", crnt_Sub
  Display "Your current tax is: $", crnt_Tax
 //
 //Display Box [Item2]
   Display "Please Enter the price of your next item"
 //Input/Output
  Input itm_2
  crnt_Sub = crnt_Sub + itm_2  
  Calc crnt_Tax = crnt_Tax + (itm_2 * .6)
 //Display Box
  Display "Your current sub total is: $", crnt_Sub
  Display "Your current tax is: $", crnt_Tax
 //
 //Display Box [Item3]
  Display "Please Enter the price of your next item"
 //Input/Output
  Input itm_3
  crnt_Sub = crnt_Sub + itm_3  
  Calc crnt_Tax = crnt_Tax + (itm_3 * .6)
 //Display Box
  Display "Your current sub total is: $", crnt_Sub
  Display "Your current tax is: $", crnt_Tax
 //
 //Display Box [Item4]
  Display "Please Enter the price of your next item"
 //Input/Output
  Input itm_4
  crnt_Sub = crnt_Sub + itm_4  
  Calc crnt_Tax = crnt_Tax + (itm_4 * .6)
 //Display Box
  Display "Your current sub total is: $", crnt_Sub
  Display "Your current tax is: $", crnt_Tax
 //
 //Display Box [Item5]
  Display "Please Enter the price of your next item"
 //Input/Output
  Input itm_5
  crnt_Sub = crnt_Sub + itm_5  
  Calc crnt_Tax = crnt_Tax + (itm_5 * .6)
 //Display Box
  Display "Your current sub total is: $", crnt_Sub
  Display "Your current tax is: $", crnt_Tax
 //
 //
 //Decision Box
 Display "Are you ready for your total?"
  //If - Yes
   Display "Your Total is: $", total
   total = crnt_Sub + crnt_Tax
 //Connect To END CODE
  //If - No
   Display "Would you like to go back to change a price?"
    //If - Yes
     Display "Which price would you like to change?"
      //If - 1
       ******CONNECT BACK TO itm_1 Input Code
      //If - 2
       ******CONNECT BACK TO itm_2 Input Code
      //If - 3
       ******CONNECT BACK TO itm_3 Input Code
      //If - 4
       ******CONNECT BACK TO itm_4 Input Code
      //If - 5
       ******CONNECT BACK TO itm_5 Input Code
      //If - None
       ******CONNECT BACK TO "Are you ready for your total?"
    //If - No
     ******CONNECT BACK TO "Are you ready for your total?"
     
//END Code


See now what I'm not entirely sure of- is how exactly legal what i'm doing is. Don't look at the Y/N stuff, since I'm probably not gonna add that in the final pseudocde, but what I would liek help with is :
CODE
crnt_Sub = crnt_Sub + itm_5  
  Calc crnt_Tax = crnt_Tax + (itm_5 * .6)

And all of the ones that are thee same thing just using different variables before it.
Basically, I'm not sure if it would be legal to have a variable equal itself plus other numbers?

If it isn't, would I have to add my declarations? I doubt it would be 5 more declarations so it is specific to the program, because what if we wanted to have more than 5 items? I kind of want to base it off the latter. So basically, I'm just not sure how I would go about making one variable equal it's already previously set self + an additional amount.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users