SlideShare a Scribd company logo
1 of 2
Download to read offline
Udeme Eyoh
Question:
The electrical accounts of residents in a very small rural community are calculated
as follows:
if 500 units or less are used the cost is 2 cents per unit;
if more than 500 units but less than 1000 units are used, the cost is $10 for the first
500 units, and 5 cents for every unit in excess of 500;
if more than 1000 units are used, the cost is $35 for the first 1000 units plus 10
cents for every unit in excess of 1000; in addition, a basic service charge of $5 is
applicable for all users.
the five residents use the following amounts (units) of electricity in a certain
month: 200, 500, 700, 1000 and 1500. write a MATLAB program using logical
vectors to calculate how much they must pay. display the results in two columns:
one for electricty used in case and the other amount owed.
solution
clc
disp(['PROGRAM TO CALCULATE ELECTRICITY BILL'])
disp(['Compiled By Udeme Eyoh'])
disp(['----------------------------------------------------------- '])
disp([' '])
units = [200,500,700,1000,1500];
for x = 1:5
if units(x)<=500;
bill = (0.02*units(x)+5);
elseif units(x)>500 && units(x)<1000;
bill = ((units(x)-500)*0.05+10+5);
else bill = ((units(x)-1000)*0.1+35+5);
end
disp(['UNITS= ',num2str(units(x)),' BILL = Dallars',num2str(bill)])
end

More Related Content

What's hot

Lecture22 non linear fiber optics
Lecture22 non linear fiber opticsLecture22 non linear fiber optics
Lecture22 non linear fiber opticsnadia abd
 
Fisika Matematika I (14 - 15) Fungsi khusus
Fisika Matematika I (14 - 15) Fungsi khususFisika Matematika I (14 - 15) Fungsi khusus
Fisika Matematika I (14 - 15) Fungsi khususjayamartha
 
Pert 9 pandu gelombang
Pert 9 pandu gelombangPert 9 pandu gelombang
Pert 9 pandu gelombangjayamartha
 
Optika modern: Fiber Optik dan Pemantulan Internal Total
Optika modern: Fiber Optik dan Pemantulan Internal TotalOptika modern: Fiber Optik dan Pemantulan Internal Total
Optika modern: Fiber Optik dan Pemantulan Internal TotalUniversitas Gadjah Mada
 
179740720 efek-hall-ppt
179740720 efek-hall-ppt179740720 efek-hall-ppt
179740720 efek-hall-pptmaria ulfpah
 
Fungsi Distribusi Bose-Enstein & Fungsi Distribusi Fermi Dirac
Fungsi Distribusi Bose-Enstein & Fungsi Distribusi Fermi DiracFungsi Distribusi Bose-Enstein & Fungsi Distribusi Fermi Dirac
Fungsi Distribusi Bose-Enstein & Fungsi Distribusi Fermi DiracSamantars17
 
Jembatan arus bolak-balik[1]
Jembatan arus bolak-balik[1]Jembatan arus bolak-balik[1]
Jembatan arus bolak-balik[1]Ajir Aja
 
FISIKA EKSPERIMEN II : Konversi Energi Termal-Listrik Dengan Modul TEC1-12706
FISIKA EKSPERIMEN II : Konversi Energi Termal-Listrik Dengan Modul TEC1-12706FISIKA EKSPERIMEN II : Konversi Energi Termal-Listrik Dengan Modul TEC1-12706
FISIKA EKSPERIMEN II : Konversi Energi Termal-Listrik Dengan Modul TEC1-12706Affandi Arrizandy
 
Ppt. mall praktek
Ppt. mall praktekPpt. mall praktek
Ppt. mall praktekMelda RD
 
Teori Medan Elektromagnet (5 - 7) pandu_gelombang
Teori Medan Elektromagnet (5 - 7) pandu_gelombangTeori Medan Elektromagnet (5 - 7) pandu_gelombang
Teori Medan Elektromagnet (5 - 7) pandu_gelombangjayamartha
 
Pengolahan Sinyal Digital - Slide week 4 - transformasi fourier sinyal waktu ...
Pengolahan Sinyal Digital - Slide week 4 - transformasi fourier sinyal waktu ...Pengolahan Sinyal Digital - Slide week 4 - transformasi fourier sinyal waktu ...
Pengolahan Sinyal Digital - Slide week 4 - transformasi fourier sinyal waktu ...Beny Nugraha
 
14708251059_Esmiyati_Energi Gelombang
14708251059_Esmiyati_Energi Gelombang14708251059_Esmiyati_Energi Gelombang
14708251059_Esmiyati_Energi GelombangIPA 2014
 
koordinasi isolasi
koordinasi isolasikoordinasi isolasi
koordinasi isolasidini setyadi
 
02-Fundamentals of Optical Fiber Waveguides-I.pptx
02-Fundamentals of Optical Fiber Waveguides-I.pptx02-Fundamentals of Optical Fiber Waveguides-I.pptx
02-Fundamentals of Optical Fiber Waveguides-I.pptxAkliluAyele3
 
내가 이해하는 SVM(왜, 어떻게를 중심으로)
내가 이해하는 SVM(왜, 어떻게를 중심으로)내가 이해하는 SVM(왜, 어떻게를 중심으로)
내가 이해하는 SVM(왜, 어떻게를 중심으로)SANG WON PARK
 
Eksperimen Fisika "Indeks Bias Gelas dan Akrilik"
Eksperimen Fisika "Indeks Bias Gelas dan Akrilik"Eksperimen Fisika "Indeks Bias Gelas dan Akrilik"
Eksperimen Fisika "Indeks Bias Gelas dan Akrilik"Nurfaizatul Jannah
 

What's hot (20)

Lecture22 non linear fiber optics
Lecture22 non linear fiber opticsLecture22 non linear fiber optics
Lecture22 non linear fiber optics
 
Fisika Matematika I (14 - 15) Fungsi khusus
Fisika Matematika I (14 - 15) Fungsi khususFisika Matematika I (14 - 15) Fungsi khusus
Fisika Matematika I (14 - 15) Fungsi khusus
 
Perencanaan ptlmh
Perencanaan ptlmhPerencanaan ptlmh
Perencanaan ptlmh
 
Pert 9 pandu gelombang
Pert 9 pandu gelombangPert 9 pandu gelombang
Pert 9 pandu gelombang
 
Optika modern: Fiber Optik dan Pemantulan Internal Total
Optika modern: Fiber Optik dan Pemantulan Internal TotalOptika modern: Fiber Optik dan Pemantulan Internal Total
Optika modern: Fiber Optik dan Pemantulan Internal Total
 
179740720 efek-hall-ppt
179740720 efek-hall-ppt179740720 efek-hall-ppt
179740720 efek-hall-ppt
 
Fungsi Distribusi Bose-Enstein & Fungsi Distribusi Fermi Dirac
Fungsi Distribusi Bose-Enstein & Fungsi Distribusi Fermi DiracFungsi Distribusi Bose-Enstein & Fungsi Distribusi Fermi Dirac
Fungsi Distribusi Bose-Enstein & Fungsi Distribusi Fermi Dirac
 
OPERASI SISTEM TENAGA LISTRIK
OPERASI SISTEM TENAGA LISTRIKOPERASI SISTEM TENAGA LISTRIK
OPERASI SISTEM TENAGA LISTRIK
 
Jembatan arus bolak-balik[1]
Jembatan arus bolak-balik[1]Jembatan arus bolak-balik[1]
Jembatan arus bolak-balik[1]
 
FISIKA EKSPERIMEN II : Konversi Energi Termal-Listrik Dengan Modul TEC1-12706
FISIKA EKSPERIMEN II : Konversi Energi Termal-Listrik Dengan Modul TEC1-12706FISIKA EKSPERIMEN II : Konversi Energi Termal-Listrik Dengan Modul TEC1-12706
FISIKA EKSPERIMEN II : Konversi Energi Termal-Listrik Dengan Modul TEC1-12706
 
Ppt. mall praktek
Ppt. mall praktekPpt. mall praktek
Ppt. mall praktek
 
Teori Medan Elektromagnet (5 - 7) pandu_gelombang
Teori Medan Elektromagnet (5 - 7) pandu_gelombangTeori Medan Elektromagnet (5 - 7) pandu_gelombang
Teori Medan Elektromagnet (5 - 7) pandu_gelombang
 
Pengolahan Sinyal Digital - Slide week 4 - transformasi fourier sinyal waktu ...
Pengolahan Sinyal Digital - Slide week 4 - transformasi fourier sinyal waktu ...Pengolahan Sinyal Digital - Slide week 4 - transformasi fourier sinyal waktu ...
Pengolahan Sinyal Digital - Slide week 4 - transformasi fourier sinyal waktu ...
 
14708251059_Esmiyati_Energi Gelombang
14708251059_Esmiyati_Energi Gelombang14708251059_Esmiyati_Energi Gelombang
14708251059_Esmiyati_Energi Gelombang
 
Optical Fiber Communication.ppt
Optical Fiber Communication.pptOptical Fiber Communication.ppt
Optical Fiber Communication.ppt
 
Fisika inti diktat
Fisika inti diktatFisika inti diktat
Fisika inti diktat
 
koordinasi isolasi
koordinasi isolasikoordinasi isolasi
koordinasi isolasi
 
02-Fundamentals of Optical Fiber Waveguides-I.pptx
02-Fundamentals of Optical Fiber Waveguides-I.pptx02-Fundamentals of Optical Fiber Waveguides-I.pptx
02-Fundamentals of Optical Fiber Waveguides-I.pptx
 
내가 이해하는 SVM(왜, 어떻게를 중심으로)
내가 이해하는 SVM(왜, 어떻게를 중심으로)내가 이해하는 SVM(왜, 어떻게를 중심으로)
내가 이해하는 SVM(왜, 어떻게를 중심으로)
 
Eksperimen Fisika "Indeks Bias Gelas dan Akrilik"
Eksperimen Fisika "Indeks Bias Gelas dan Akrilik"Eksperimen Fisika "Indeks Bias Gelas dan Akrilik"
Eksperimen Fisika "Indeks Bias Gelas dan Akrilik"
 

Similar to Udeme Eyoh.

IRJET- Design and Implementation of Prepaid Energy Meter and Data Acquisi...
IRJET-  	  Design and Implementation of Prepaid Energy Meter and Data Acquisi...IRJET-  	  Design and Implementation of Prepaid Energy Meter and Data Acquisi...
IRJET- Design and Implementation of Prepaid Energy Meter and Data Acquisi...IRJET Journal
 
A Decomposition Aggregation Method for Solving Electrical Power Dispatch Prob...
A Decomposition Aggregation Method for Solving Electrical Power Dispatch Prob...A Decomposition Aggregation Method for Solving Electrical Power Dispatch Prob...
A Decomposition Aggregation Method for Solving Electrical Power Dispatch Prob...raj20072
 
IMPLEMENTATION OF UNSIGNED MULTIPLIER USING MODIFIED CSLA
IMPLEMENTATION OF UNSIGNED MULTIPLIER USING MODIFIED CSLAIMPLEMENTATION OF UNSIGNED MULTIPLIER USING MODIFIED CSLA
IMPLEMENTATION OF UNSIGNED MULTIPLIER USING MODIFIED CSLAeeiej_journal
 
1. Allen Machines specializes in developing weed-harvesting equipm.docx
1. Allen Machines specializes in developing weed-harvesting equipm.docx1. Allen Machines specializes in developing weed-harvesting equipm.docx
1. Allen Machines specializes in developing weed-harvesting equipm.docxadolphoyonker
 
A solar power generation system with a seven level inverter
A solar power generation system with a seven level inverterA solar power generation system with a seven level inverter
A solar power generation system with a seven level inverterAsoka Technologies
 
Prepaid energy meter with theft detection
Prepaid energy meter with theft detectionPrepaid energy meter with theft detection
Prepaid energy meter with theft detectionAmanVerma443
 
Final Project Report
Final Project ReportFinal Project Report
Final Project ReportRiddhi Shah
 
ANFIS Control of Energy Control Center for Distributed Wind and Solar Generat...
ANFIS Control of Energy Control Center for Distributed Wind and Solar Generat...ANFIS Control of Energy Control Center for Distributed Wind and Solar Generat...
ANFIS Control of Energy Control Center for Distributed Wind and Solar Generat...IRJET Journal
 
Prepaid and Postpaid Energy Meter for Billing System Using Microcontroller an...
Prepaid and Postpaid Energy Meter for Billing System Using Microcontroller an...Prepaid and Postpaid Energy Meter for Billing System Using Microcontroller an...
Prepaid and Postpaid Energy Meter for Billing System Using Microcontroller an...IRJET Journal
 
EFFICIENT IMPLEMENTATION OF 16-BIT MULTIPLIER-ACCUMULATOR USING RADIX-2 MODIF...
EFFICIENT IMPLEMENTATION OF 16-BIT MULTIPLIER-ACCUMULATOR USING RADIX-2 MODIF...EFFICIENT IMPLEMENTATION OF 16-BIT MULTIPLIER-ACCUMULATOR USING RADIX-2 MODIF...
EFFICIENT IMPLEMENTATION OF 16-BIT MULTIPLIER-ACCUMULATOR USING RADIX-2 MODIF...VLSICS Design
 
29 16109 paper 098 ijeecs(edit)
29 16109 paper 098 ijeecs(edit)29 16109 paper 098 ijeecs(edit)
29 16109 paper 098 ijeecs(edit)IAESIJEECS
 
A Genetic Algorithm Approach to Optimize Dispatching for A Micro-grid Energy ...
A Genetic Algorithm Approach to Optimize Dispatching for A Micro-grid Energy ...A Genetic Algorithm Approach to Optimize Dispatching for A Micro-grid Energy ...
A Genetic Algorithm Approach to Optimize Dispatching for A Micro-grid Energy ...Kishor Datta Gupta
 
Implementation and Performance Analysis of a Vedic Multiplier Using Tanner ED...
Implementation and Performance Analysis of a Vedic Multiplier Using Tanner ED...Implementation and Performance Analysis of a Vedic Multiplier Using Tanner ED...
Implementation and Performance Analysis of a Vedic Multiplier Using Tanner ED...ijsrd.com
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingPradeep Kumar TS
 
IRJET- Arduino UNO Controlled DC Weaving Machine Powered by Solar Energy
IRJET- Arduino UNO Controlled DC Weaving Machine Powered by Solar EnergyIRJET- Arduino UNO Controlled DC Weaving Machine Powered by Solar Energy
IRJET- Arduino UNO Controlled DC Weaving Machine Powered by Solar EnergyIRJET Journal
 
Distribution system of virtual housing colony
Distribution system of virtual housing colonyDistribution system of virtual housing colony
Distribution system of virtual housing colonyHasanHussein
 
IRJET- Radix 8 Booth Encoded Interleaved Modular Multiplication
IRJET- Radix 8 Booth Encoded Interleaved Modular MultiplicationIRJET- Radix 8 Booth Encoded Interleaved Modular Multiplication
IRJET- Radix 8 Booth Encoded Interleaved Modular MultiplicationIRJET Journal
 

Similar to Udeme Eyoh. (20)

IRJET- Design and Implementation of Prepaid Energy Meter and Data Acquisi...
IRJET-  	  Design and Implementation of Prepaid Energy Meter and Data Acquisi...IRJET-  	  Design and Implementation of Prepaid Energy Meter and Data Acquisi...
IRJET- Design and Implementation of Prepaid Energy Meter and Data Acquisi...
 
A Decomposition Aggregation Method for Solving Electrical Power Dispatch Prob...
A Decomposition Aggregation Method for Solving Electrical Power Dispatch Prob...A Decomposition Aggregation Method for Solving Electrical Power Dispatch Prob...
A Decomposition Aggregation Method for Solving Electrical Power Dispatch Prob...
 
IMPLEMENTATION OF UNSIGNED MULTIPLIER USING MODIFIED CSLA
IMPLEMENTATION OF UNSIGNED MULTIPLIER USING MODIFIED CSLAIMPLEMENTATION OF UNSIGNED MULTIPLIER USING MODIFIED CSLA
IMPLEMENTATION OF UNSIGNED MULTIPLIER USING MODIFIED CSLA
 
1. Allen Machines specializes in developing weed-harvesting equipm.docx
1. Allen Machines specializes in developing weed-harvesting equipm.docx1. Allen Machines specializes in developing weed-harvesting equipm.docx
1. Allen Machines specializes in developing weed-harvesting equipm.docx
 
A solar power generation system with a seven level inverter
A solar power generation system with a seven level inverterA solar power generation system with a seven level inverter
A solar power generation system with a seven level inverter
 
Prepaid energy meter with theft detection
Prepaid energy meter with theft detectionPrepaid energy meter with theft detection
Prepaid energy meter with theft detection
 
PSOC.pptx
PSOC.pptxPSOC.pptx
PSOC.pptx
 
Final Project Report
Final Project ReportFinal Project Report
Final Project Report
 
ANFIS Control of Energy Control Center for Distributed Wind and Solar Generat...
ANFIS Control of Energy Control Center for Distributed Wind and Solar Generat...ANFIS Control of Energy Control Center for Distributed Wind and Solar Generat...
ANFIS Control of Energy Control Center for Distributed Wind and Solar Generat...
 
Prepaid and Postpaid Energy Meter for Billing System Using Microcontroller an...
Prepaid and Postpaid Energy Meter for Billing System Using Microcontroller an...Prepaid and Postpaid Energy Meter for Billing System Using Microcontroller an...
Prepaid and Postpaid Energy Meter for Billing System Using Microcontroller an...
 
Ee2404.set2
Ee2404.set2Ee2404.set2
Ee2404.set2
 
EFFICIENT IMPLEMENTATION OF 16-BIT MULTIPLIER-ACCUMULATOR USING RADIX-2 MODIF...
EFFICIENT IMPLEMENTATION OF 16-BIT MULTIPLIER-ACCUMULATOR USING RADIX-2 MODIF...EFFICIENT IMPLEMENTATION OF 16-BIT MULTIPLIER-ACCUMULATOR USING RADIX-2 MODIF...
EFFICIENT IMPLEMENTATION OF 16-BIT MULTIPLIER-ACCUMULATOR USING RADIX-2 MODIF...
 
10a--EDPA_PerUnit.pptx
10a--EDPA_PerUnit.pptx10a--EDPA_PerUnit.pptx
10a--EDPA_PerUnit.pptx
 
29 16109 paper 098 ijeecs(edit)
29 16109 paper 098 ijeecs(edit)29 16109 paper 098 ijeecs(edit)
29 16109 paper 098 ijeecs(edit)
 
A Genetic Algorithm Approach to Optimize Dispatching for A Micro-grid Energy ...
A Genetic Algorithm Approach to Optimize Dispatching for A Micro-grid Energy ...A Genetic Algorithm Approach to Optimize Dispatching for A Micro-grid Energy ...
A Genetic Algorithm Approach to Optimize Dispatching for A Micro-grid Energy ...
 
Implementation and Performance Analysis of a Vedic Multiplier Using Tanner ED...
Implementation and Performance Analysis of a Vedic Multiplier Using Tanner ED...Implementation and Performance Analysis of a Vedic Multiplier Using Tanner ED...
Implementation and Performance Analysis of a Vedic Multiplier Using Tanner ED...
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper setting
 
IRJET- Arduino UNO Controlled DC Weaving Machine Powered by Solar Energy
IRJET- Arduino UNO Controlled DC Weaving Machine Powered by Solar EnergyIRJET- Arduino UNO Controlled DC Weaving Machine Powered by Solar Energy
IRJET- Arduino UNO Controlled DC Weaving Machine Powered by Solar Energy
 
Distribution system of virtual housing colony
Distribution system of virtual housing colonyDistribution system of virtual housing colony
Distribution system of virtual housing colony
 
IRJET- Radix 8 Booth Encoded Interleaved Modular Multiplication
IRJET- Radix 8 Booth Encoded Interleaved Modular MultiplicationIRJET- Radix 8 Booth Encoded Interleaved Modular Multiplication
IRJET- Radix 8 Booth Encoded Interleaved Modular Multiplication
 

Udeme Eyoh.

  • 1. Udeme Eyoh Question: The electrical accounts of residents in a very small rural community are calculated as follows: if 500 units or less are used the cost is 2 cents per unit; if more than 500 units but less than 1000 units are used, the cost is $10 for the first 500 units, and 5 cents for every unit in excess of 500; if more than 1000 units are used, the cost is $35 for the first 1000 units plus 10 cents for every unit in excess of 1000; in addition, a basic service charge of $5 is applicable for all users. the five residents use the following amounts (units) of electricity in a certain month: 200, 500, 700, 1000 and 1500. write a MATLAB program using logical vectors to calculate how much they must pay. display the results in two columns: one for electricty used in case and the other amount owed. solution clc disp(['PROGRAM TO CALCULATE ELECTRICITY BILL']) disp(['Compiled By Udeme Eyoh']) disp(['----------------------------------------------------------- ']) disp([' ']) units = [200,500,700,1000,1500]; for x = 1:5
  • 2. if units(x)<=500; bill = (0.02*units(x)+5); elseif units(x)>500 && units(x)<1000; bill = ((units(x)-500)*0.05+10+5); else bill = ((units(x)-1000)*0.1+35+5); end disp(['UNITS= ',num2str(units(x)),' BILL = Dallars',num2str(bill)]) end