Anda di halaman 1dari 1

A=input('nama produksi=');

B=input('banyak produksi=');
switch A
case {'buku','bk'}
harga=1000;
h=harga*B
if B<=2
x=h*10/100;
elseif B<=5
x=h*15/100;
else
x=h*20/100;
end
case {'pensil','ps'}
harga=2000;
h=harga*B
if B<=2
x=h*10/100;
elseif B<=5
x=h*15/100;
else
x=h*20/100;
end
case {'pena','pn'}
harga=7000;
h=harga*B
if B<=2
x=h*10/100;
elseif B<=5
x=h*15/100;
else
x=h*20/100;
end
case {'mistar','ms'}
harga=2000;
h=harga*B
if B<=2
x=h*10/100;
elseif B<=5
x=h*15/100;
else
x=h*20/100;
end
end
HD=h-x
disp(' ')
disp(' ')
disp(['harga awal (sebelum diskon)= ' num2str(h)])
disp(['jumlah diskon
= ' num2str(x)])
disp(['harga bayar (setelah diskon)= ' num2str(HD)])

Anda mungkin juga menyukai