🔒 Closed Pseudocode

Status
Not open for further replies.

-CLAY-

Fanatic
Patulong po at paexplain kung bakit naging 0.80 yung sa may set price. Nung tinignan ko yung dito sa may internet maiksi di tulad dun sa code ng prof namin ang haba haba tsaka parang di accurate eh :3
 

Attachments

  • 20180910_203143.jpg
    20180910_203143.jpg
    11.4 KB · Views: 1
  • received_967850396937043.webp
    received_967850396937043.webp
    62.2 KB · Views: 19
  • 20180910_202952.webp
    20180910_202952.webp
    59.6 KB · Views: 20
kasi nagreduce ka ng 20 percent kaya 80 nalang
para makuha mo naman yung 80 percent dun sa price pwede mung i multiply sa 0.80
example :
100 * 0.80 = 80

p.s. Not really sure ahh noob noob palang din ako diyan ehh
 
Mahirap yan ts. isa rin akong i.t. pero basic pa yong alam ko sa pagawa ng algorithm at flowchart.
 
kasi nagreduce ka ng 20 percent kaya 80 nalang
para makuha mo naman yung 80 percent dun sa price pwede mung i multiply sa 0.80
example :
100 * 0.80 = 80

p.s. Not really sure ahh noob noob palang din ako diyan ehh
Ah so 100%-20% kaya naging 80 nalang so kapag 3 months na 40% nalang ang natira?
 
. . . . . . . . . . . . . . . . . . . . . . . . 100% - 20% of itself
original price = 2,500
1month passed = 2,000 = 2500 - 500
2months passed = 1,600 = 2000 - 400
3months passed = 1,280 = 1600 - 320
tapos balik na ata sa orig price pagkatapos na ng sale.
 
well, your prof's output is correct..

If we let:
SellingPrice = InitialPrice - (InitialPrice*ReductionRate)*MonthsPassed
where:
MonthsPassed = SellingMonth - 1

then:
For SellingMonth 1 (Product Launch):
MonthsPassed (since launching product = 0
SellingPrice = 100 - (100*.20)*0 = 100 - 0 = 100

For SellingMonth 2:
MonthsPassed (since launching product) = 1
SellingPrice = 100 - (100*.20)*1 = 100 - 20 = 80

For SellingMonth 3:
MonthsPassed (since launching product) = 2
SellingPrice = 100 - (100*.20)*2 = 100 - 40 = 60


..but his flowchart and pseudocode is confusing
He used `month>=3` (in flowchart) when he set `month = 1` and uses it to increment `SellingMonth += month` (in pseudocode). I can't clearly see the scribbles on the right part of the flowchart so i don't know how he increments month but is month left blank or is it my eyes?
 
For SellingMonth 3:
MonthsPassed (since launching product) = 2
SellingPrice = 100 - (100*.20)*2 = 100 - 40 = 60

dapat ata 64 pa ito?
dahil dun sa pseudo code ay
price = origprice * 0.8

so nung naging 80 ung preyso dahil hindi nabenta ng 1 month
kunin ung 80% nyan = 64


Code:
start loop
  set ownerCut = price * 0.60
  set shopCut = price * 0.40
  set price = price * 0.80
loop again
Note: correct me if i am wrong.
 
dapat ata 64 pa ito?
dahil dun sa pseudo code ay
price = origprice * 0.8

so nung naging 80 ung preyso dahil hindi nabenta ng 1 month
kunin ung 80% nyan = 64


Code:
start loop
  set ownerCut = price * 0.60
  set shopCut = price * 0.40
  set price = price * 0.80
loop again
Note: correct me if i am wrong.

Pasensya na if I wasn't clear enough but yung sinabi kong pseudocode is the one on the whiteboard, yung nasa left part ng flowchart of Pic2. Hindi kasi ngcompliment yung pseudocode and flowchart.

and I'm not going to say you need correction. Pic3 stated: "each month that the item doesn't sell, the price is reduced by 20%".
It did not explicitly say initial price or selling price. It just said "price" so, it can be interpreted in at least 2 ways. Since I was trying to find out how his prof ended with the output, I opted to interpret that part of the problem as "every month after launching, 20% of the 'initial price' is deducted from the current month's price."

Well, the correct answer depends pa rin sa interpretation ng ngbigay ng problem, yung prof nia.

Pero sa tingin ko, if you tell his prof na it'll reach zero faster that way, baka he'll reach enlightenment at gawin nia yung pseudocode in Pic1 (that is, if he knows how to).
 
Another problem ko dito kung pano na naman to icoconvert into c++ code i need help po I know the basics pero wala ako masyado alam sa may if else or loop code thingy.
 
Another problem ko dito kung pano na naman to icoconvert into c++ code i need help po I know the basics pero wala ako masyado alam sa may if else or loop code thingy.


afaik, those if-then-else and loop thingies are part of the basics of most programming languages.. You'll have to grok those concepts since you'll really be needing them later.
I'm not handing the code (sorry, not a fan of spoon-feeding) but I'm willing to explain. So, ask away..
 
Status
Not open for further replies.

About this Thread

  • 9
    Replies
  • 760
    Views
  • 5
    Participants
Last reply from:
rxe

Trending Topics

Online now

Members online
1,074
Guests online
859
Total visitors
1,933

Forum statistics

Threads
2,274,946
Posts
28,959,527
Members
1,233,492
Latest member
PHC-Francis
Back
Top