Docsity

Gross Price Calculation Algorithm with Profit Margin, Assignments of Programming Languages

Toggle sidebar
bg1
Input Process Output
Item name (name of
items)
GP (gross price)
Variable name
GP stand for (gross
price)
Profit
Formula:
GP- price of the item before going out
to the market
Profit margin– increment with certain
% based on the GP
Net price- New price after profit
margin was imposed.
Condition: Use the selection control
structure (if-else)
1.
If GP<=50
Profit= GP * 3%
NP= Gp + Profit
2. Else
If GP>50 and GP<=100
Profit= GP * 4%
NP= GP + Profit
3. Else
IF 100<GP and GP<=200
Profit= GP*5%
NP= GP + Profit
4. Else
If NP>200
Profit= GP * 5%
Data type
Float
Char
Float
Float
pf3
pf4
pf5

Partial preview of the text

Download Gross Price Calculation Algorithm with Profit Margin and more Assignments Programming Languages in PDF only on Docsity!

Input Process Output Item name (name of items) GP (gross price) Variable name GP stand for (gross price) Profit Formula: GP- price of the item before going out to the market Profit margin– increment with certain % based on the GP Net price- New price after profit margin was imposed. Condition: Use the selection control structure (if-else)

If GP<= Profit= GP * 3% NP= Gp + Profit

  1. Else If GP>50 and GP<= Profit= GP * 4% NP= GP + Profit
  2. Else IF 100<GP and GP<= Profit= GP*5% NP= GP + Profit
  3. Else If NP> Profit= GP * 5% Data type Float Char Float Float

NP= GP + Profit Variable Name Data type GP stand for (gross price) iName stand for (item name) NP stand for (net price) Profit Float Char Float Float ***This system must read 10 different items, thus the repetation control structure such as for, while and do while will be used in the system. B. Algarithms Algarithms can be represented by using flow chart or pscudocode. C. FlowchartStart if gp<= 50 Declare the variable GP, Profit, NP, iname Read gross price Read item name

2.0 declare the variable: gross price as float, net price as float, profit as float and item name as char 3.0 read\input item name 4.0 read input gross price 5.0 start if 5.1 if1 (gross price <= 50) then 5.1.1 calculate profit ⇦ gross price * 3% 5.1.2 calculate net price ⇦ gross price + profit end if 5.2 if2 (gross price > 50 and gross price <=100) 5.2.1 5.2.1 calculate profit ⇦ gross price * 4% 5.2.2 calculate net price ⇦ gross price + profit end if 5.3 if3 (gross price > 100 and gross price <=200) 5.3.1 calculate profit ⇦ gross price * 5% 5.3.2 calculate net price ⇦ gross price + profit End if 5.4 if4 (gross price >200)

5.4.1 calculate profit ⇦ gross price * 10% 5.4.2 calculate net price ⇦ gross price + profit End if 6.0 display net price 7.0 loop (read 10 time) goto 3. 8.0 end loop 9.0 end