clc
a1=input('Total Weight Of CNG in compressor = '); % TOTAL C-N-G IN COMPRESSOR
a2=input('Total liters Of petrol in storage tank = ');% TOTAL PETROL STORED IN TANK
a3=input('Total liters of Diesel in storage tank = ');% TOTAL DIESEL STORED IN TANK
b1=input('Purchase price of CNG='); % price for which fuel is purchased
b2=input('Purchase price of Petrol=');% price for which fuel is purchased
b3=input('purchase price of Diesel=');% price for which fuel is purchased
w=0; % varibles saved for assigning values from line # 12 upto line # 63
w1=0;
w2=0;
q=0;
q1=0;
q2=0;
q4=0;
q5=0;
q6=0;
q7=0;
q8=0;
q9=0;
u=0;
c=0;
c1=0;
c2=0;
c3=0;
c4=0;
c5=0;
d1=0;
d2=0;
d3=0;
l=0;
s=0;
y=0;
x1=a1;
x2=a2;
x3=a3;
e1=0;
e2=0;
e3=0;
e=0;
f=0;
f1=0;
f2=0;
y=0;
y1=0;
y2=0;
l=0;
l1=0;
l2=0;
r=0;
r1=0;
r2=0;
s=0;
s1=0;
s2=0;
p=input('Please enter Password to change prices = '); % PASSWORD FOR STARTING FUEL STATION EVERY DAY
if p==123;
disp('.........initializing syndrome..."PHANTOM PROTOCOL"')
a=input('Fixed price of CNG='); % price fixed by station for selling C-N-G
d=input('Fixed price of Petrol=');% price fixed by station for selling PETROL
i=input('Fixed price of Diesel=');% price fixed by station for selling DIESEL
while 1
o=input('Enter 1 for CNG , 2 for Petrol & 3 for Diesel='); % ENTER OPTIONS FOR DESIRED FUEL INPUT
if o==999;
break
end
if o==1
while 1
if x1>=0&&x1<1||c>x1||r>x1;
break
end
b=input('Options enter 1 for PRICE & 2 for WEIGHT ='); % select option whether to input the weight or input the price
if isempty(b)
break
end
if b==1;
r=0;
f=0;
e=input('paid amount in PKR =');% AMOUNT PAID BY CUSTOMER TO PURCHASE C-N-G
c=e/a;
if c>a1
disp('CNG not available')% CAPACITY IN COMPRESSOR IS LESSER THAN DEMAND
c=0;
break
end
if c>x1
disp('CNG not available')% CAPACITY IN COMPRESSOR IS LESSER THAN DEMAND
c=0;
break
end
disp(['sold weight of C-N-G in KG= ',num2str(c)]) % C-N-G sold by station
a=a+0;
disp(['Price of C-N-G/kg=',num2str(a)])% fixed price of C-N-G is displayed with each purchase
y1=y1+1;
else
if b==2;
c=0;
e=0;
r=input('Required weight of CNG in Kg =');% C-N-G required by customer in Kilograms
if r>a1
disp('CNG not available')% CAPACITY IN COMPRESSOR IS LESSER THAN DEMAND
r=0;
break
end
if r>x1
disp('CNG not available')% CAPACITY IN COMPRESSOR IS LESSER THAN DEMAND
r=0;
break
end
f=r.*a;
disp([' Price of CNG in RS=',num2str(f)])% Amount to be paid by customer for purchasing C-N-G
a=a+0;
disp(['Price of CNG/kg=',num2str(a)])% fixed price of C-N-G is displayed with each purchase
y2=y2+1;
else
disp('program not installed')% DISPLAY FOR WRONG INPUT
end
end
q7=e+f;
w=w+q7;
q4=c+r;
q=q+q4;
x1=a1-q;
if x1>=0&&x1<1;
break
end
y=y1+y2;
disp(['Total Numbers of CNG customers= ',num2str(y)])% TOTAL CUSTOMERS CALCULATED FOR C-N-G FUEL
end
end
if o==2;
while 1
if x2>=0&&x2<1||c1>x2||r1>x2
break
else
b=input('Options enter 1 for PRICE & 2 for Liter ='); % select option whether to input in liters or input for price
if isempty(b)
break
end
if b==1;
r1=0;
f1=0;
e1=input('Paid amount in PKR =');% AMOUNT PAID BY CUSTOMER TO PURCHASE PETROL
c1=e1/d;
if c1>a2
disp('Petrol not available')% CAPACITY IN STORAGE TANK IS LESSER THAN DEMAND
c1=0;
break
end
if c1>x2
disp('Petrol not available')% CAPACITY IN STORAGE TANK IS LESSER THAN DEMAND
c1=0;
break
end
disp(['Sold petrol in liters=',num2str(c1)])% AMOUNT OF PETROL SOLD IN liters
d=d+0;
disp(['Price of Petrol/liter=',num2str(d)])% fixed price of PETROL is displayed with each purchase
l1=l1+1;
end
if b==2
e1=0;
c1=0;
r1=input('Required liters of Petrol=');% REQUIRED liters OF PETROL BY CUSTOMER
if r1>a2
disp('Petrol not available')% CAPACITY IN STORAGE TANK IS LESSER THAN DEMAND
r1=0;
break
end
if r1>x2
disp('Petrol is not available')% CAPACITY IN STORAGE TANK IS LESSER THAN DEMAND
r1=0;
break
end
f1=r1.*d;
disp(['Price of Petrol in RS=' ,num2str(f1)])% Amount to be paid by customer for purchasing PETROL
d=d+0;
disp(['Price of Petrol/Liter=' ,num2str(d)])% fixed price of PETROL is displayed with each purchase
l2=l2+1;
end
q8=e1+f1;
w1=w1+q8;
q5=c1+r1;
q1=q1+q5;
l=l1+l2;
disp(['Total Numbers of Petrol Customers= ', num2str(l)])% TOTAL CUSTOMERS CALCULATED FOR FUEL
x2=a2-q1;
if x2>=0&&x2<1
break
end
end
end
end
if o==3
while 1
if x3>=0&&x3<1||c2>x3||r2>x3
break
end
b=input('Options enter 1 for PRICE & 2 for liters ='); % select option whether to input in liters or input for price
if isempty(b)
break
end
if b==1;
r2=0;
f2=0;
e2=input('Paid amount in PKR = ');% AMOUNT PAID BY CUSTOMER TO PURCHASE DIESEL
c2=e2/i;
if c2>a3
disp('Diesel not available')% CAPACITY IN STORAGE TANK IS LESSER THAN DEMAND
c2=0;
end
if c2>x3
disp('Diesel not available')% CAPACITY IN STORAGE TANK IS LESSER THAN DEMAND
c2=0;
break
end
disp(['Sold diesel in liter = ',num2str(c2)])
i=i+0;
disp(['Price of diesel/Liter = ',num2str(a)])% fixed price of DIESEL is displayed with each purchase
s1=s1+1;
end
if b==2
e2=0;
c2=0;
r2=input('Required Liter of diesel = ');% REQUIRED liters OF DIESEL BY CUSTOMER
if r2>a3
r2=0;
disp('Diesel not available')% CAPACITY IN STORAGE TANK IS LESSER THAN DEMAND
break
end
if r2>x3
disp('Diesel not availble')% CAPACITY IN STORAGE TANK IS LESSER THAN DEMAND
r2=0;
break
end
f2=r2.*i;
disp(['Price of diesel in PKR = ' ,num2str(f2)])% AMOUNT OF DIESEL SOLD IN liters
i=i+0;
disp(['Price of diesel/Liter = ' ,num2str(i)])% fixed price of DIESEL is displayed with each purchase
s2=s2+1;
end
q9=e2+f2;
w2=w2+q9;
q6=c2+r2;
q2=q2+q6;
x3=a3-q2;
if x3>=0&&x3<1
break
end
s=s1+s2;
disp(['Total Numbers of Diesel Customers= ', num2str(s)])% TOTAL CUSTOMERS OF DIESEL
end
end
end
else
disp(' WARNING.....suspected Insurgency......"SYSTEM SHUT DOWN"')% IN CASE OF ENTERING WRONG PASSWORD
end
w=w+0;
disp(['Total Amount of CNG sale in PKR = ',num2str(w)])%Amount of CNG sale in PKR
w1=w1+0;
disp(['Total Amount of Petrol sale in PKR = ',num2str(w1)])%Amount of Petrol sale in PKR
w2=w2+0;
disp(['Total Amount of Diesel sale in PKR = ',num2str(w2)])%Amount of Diesel sale in PKR
q=q+0;
disp(['Total Weight of CNG sold = ',num2str(q)])%Total Weight of CNG sold
q1=q1+0;
disp(['Total liters of Petrol sold = ',num2str(q1)]) %Total liters of Petrol sold
q2=q2+0;
disp(['Total liters of Diesel sold = ',num2str(q2)])%Total liters of Diesel sold
x1=x1+0;
disp(['CNG left in kg= ',num2str(x1)])%C-N-G left in kg
x2=x2+0;
disp(['Petrol left in liters= ',num2str(x2)])%Petrol left in liters
x3=x3+0;
disp(['Diesel left in liters= ',num2str(x3)])%Diesel left in liters
u=l+s+y;
disp(['Total Customers of HD Pump ', num2str(u)])%Total Customers of Station
c3=q.*b1;
d1=w-c3;
disp([' Profit earned On CNG= ',num2str(d1)])%Profit earned On C-N-G
c4=q1.*b2;
d2=w1-c4;
disp(['Profit earned On Petrol= ',num2str(d2)])%Profit earned On Petrol
c5=q2.*b3;
d3=w2-c5;
disp(['Profit earned On Diesel= ',num2str(d3)])%Profit earned On Diesel
figure(1);
hold on
title('Profits earned on C-N-G vs PETROL vs DIESEL')
xlabel('Profit earned on C-N-G (green), Petrol (red) , Diesel (black) ');
ylabel(' Profit earned on each FUEL ')
tango=2;
bar(tango,d1,'green');%GRAPH OF PROFIT EARNED ON C-N-G
axis auto
tango2=4;
bar(tango2,d2,'red');%GRAPH OF PROFIT EARNED ON PETROL
axis auto
tango3=6;
bar(tango3,d3,'black');%GRAPH OF PROFIT EARNED ON DIESEL
axis auto
hold off
figure(2);
hold on
title('COMPARISON OF EACH FUEL LEFT IN STATION')
xlabel('C-N-G left (blue), Petrol left (black) , Diesel left (yellow) ');
ylabel(' FUEL left in storage tanks ')
charlie=2;
bar(charlie,x1,'blue');%GRAPH OF LEFT WEIGHT OF C-N-G
axis auto
charlie2=4;
bar(charlie2,x2,'black');%GRAPH OF LEFT liters OF PETROL
axis auto
charlie3=6;
bar(charlie3,x3,'yellow');%GRAPH OF LEFT liters OF DIESEL
axis auto
hold off
figure(3);
hold on
title('COMPARISON OF AMOUNTS OF FUELS SOLD')
xlabel('C-N-G amount (black), Petrol amount (cyan) , Diesel amount (green) ');
ylabel(' Amount of fuels sale in PKR ')
delta=2;
bar(delta,w,'black');%GRAPH OF TOTAL AMOUNT OF C-N-G SALE
axis auto
delta2=4;
bar(delta2,w1,'cyan');%GRAPH OF TOTAL AMOUNT OF PETROL SALE
axis auto
delta3=6;
bar(delta3,w2,'green');%GRAPH OF TOTAL AMOUNT OF DIESEL SALE
axis auto
hold off
figure(4);
hold on
title('COMPARISON OF QUANTITIES OF FUELS SOLD')
xlabel('C-N-G in kg , Petrol in liters , Diesel in liters ');
ylabel(' FUEL sale in liters ')
alpha=2;
bar(alpha,q,'blue');%GRAPH OF WEIGHT OF C-N-G SALE
axis auto
alpha2=4;
bar(alpha2,q1,'blue');%GRAPH OF liters OF PETROL SALE
axis auto
alpha3=6;
bar(alpha3,q2,'blue');%GRAPH OF liters OF DIESEL SALE
axis auto
hold off
figure(5);
hold on
title('COMPARISON OF CUSTOMERS OF EACH FUEL')
xlabel('C-N-G customers (black) , Petrol customers (red) , Diesel customers (green) ');
ylabel(' COMPARISON OF CUSTOMERS ')
bravo=2;
bar(bravo,l,'black');%GRAPH OF TOTAL C-N-G CUSTOMERS
axis auto
bravo2=4;
bar(bravo2,s,'red');%GRAPH OF TOTAL PETROL CUSTOMERS
axis auto
bravo3=6;
bar(bravo3,y,'green');%GRAPH OF TOTAL DIESEL CUSTOMERS
hold off