Professional Documents
Culture Documents
Lademora - Proj
Lademora - Proj
FINAL PROJECT
CENTRAL PHILIPPINE
SP CALCULATOR
ENGG 1035
UNIVERSITY COMPUTER PROGRAMMING
COLLEGE OF ENGINEERING
Jaro, Iloilo City, Philippines
Submitted by:
Name: Beatrex June Lademora
Date: December 21, 2022
Stub code:1885
Submitted to:
Engr. Romarie Jhoanna C. Eder
Engg 1035 Instructor
I. Introduction
A circuit in electronics is a fully enclosed circle through which electricity travels. A current source,
conductors, and a load make up a straightforward circuit. In a broad sense, the word "circuit" can refer to
any permanent path through which electricity, data, or a signal can pass.
Circuits can be connected in two ways, series or parallel. Series circuits are circuits where the
components are connected end to end in a line while parallel circuits are those that has components
connected across each other.
To find for the total resistance of a series circuit, you need to add the value of resistance of each
resistor. The arithmetical sum obtained is the total resistance. You can also determine the total current
that passes through by using the Ohm’s law (V=IR). Since the circuit is in series, it follows that the
current passing through each branch remains the same. The voltages of each branch could also then be
determined.
Rt = R1+R2+R3 = 3+10+5 =18 kilo-ohms
It = Vt/Rt = 9/18000 = 500μA
It = I1 = I2 = I3 = 500μA
V1 = I1R1 = (5x10 -4)(3x10 3) = 1.5 V
V2 = I2R2 = (5x10 -4)(10x10 3) = 5 V
V3 = I3R3 = (5x10 -4)(3x10 3) = 1.5 V
On the other hand, to get the total resistance of a circuit connected in parallel, you need to get the
reciprocal of the arithmetical sum of the reciprocal of the resistance of each resistors. Total current can be
obtained using Ohm’s Law or by summing up the individual currents of each resistors.. In parallel
circuits, the voltages that travels around remains the same. The individual currents can then be solved
using the aforementioned law.
1 1
Rt = 1 1 1 = 1 1 1 = 0.625 kilo-
+ + + +
R1 R 2 R 3 10 2 1
ohms
Vt = V1 = V2 = V3 = 9 V
It = Vt/Rt = 9/0.625 = 14.4 mA
V1 9
I1 = = = 0.9 mA
R1 10× 103
V2 9
I2 = = = 4.5 mA
R2 2× 103
II. Flowchart
III. Algorithm
main()
STEP 1. Initialize type and ch.
STEP 2. Input type.
STEP 3. Test if type is equal to ‘S’ or ‘s’.
STEP 4. If true, then call the function Series(type) and proceed to step 7. If false, proceed to
next step.
STEP 5. Test if type is equal to ‘P’ or ‘p’.
STEP 6. If true, call the function Parallel(type) and proceed to Step 7. Otherwise, print "\n\
n\tError! Please try again!\n\n\t" and proceed also to step 7.
STEP 7. Print "\n\n\tEnter <C> to continue or <X> to exit: ".
STEP 8. Input ch.
STEP 9. Test if ch is equal to ‘C’ or ‘c’.
STEP 10. If true, return to step 1. If false, proceed to next step.
STEP 11. Test if ch is equal to ‘X’ or ‘x’.
STEP 12. If true, print “\n\n\tThank you! Have a nice day!\n\n\t". Otherwise, print "\n\n\
tError! Please try again!\n\n\t" and return to step 7.
Series(type)
STEP 1. Initialize Vt, resistor, x[10], Rt, Ct, Cr, Vr, i, j, k to 0. Initialize confirm.
STEP 2. Print "\tYou chose the Series Circuit.".
STEP 3. Input Vt.
STEP 4. Input resistor.
STEP 5. Test if resistor is less than or equal to 0 or greater than 10.
STEP 6. If true, print "\n\n\tInvalid input! Please enter value within the range.\n\n\t" and
return to Step I. If false, then proceed to next step.
STEP 7. Initialize i to 0.
STEP 8. Test if i is less than resistor.
STEP 9. If true, print “\t\tEnter value of resistance “ i+1 “: “ and proceed to step 10. If false,
print “\n\n\tAre the entered values correct? Enter any key if yes or <N> if you wish to
change the values: " and proceed to step 12.
STEP 10. Input x[i].
STEP 11. Increment i by 1. Return to step 8.
STEP 12. Input confirm.
STEP 13. Test if confirm is not equal to ‘N’ or ‘n’.
STEP 14. If true, return to step 2. If false, print"\n\tRESULTS\n" "\n\tType of Circuit:
SERIES" "\n\tEntered value of total voltage: " Vt " volts" "\n\tEntered value of resistance
for each resistors: \n" and proceed to next step.
STEP 15. Initialize i to 0.
STEP 16. Test if i is less than the resistor.
STEP 17. If true, print "\t\tResistor " i+1 ": " x[i] " ohms\n" and proceed to step 18. If false,
proceed to step 19.
STEP 18. Increment i by 1. Return to step 16.
STEP 19. Initialize i to 0.
STEP 20. Test if i is less than the resistor.
STEP 21. If true, solve for Rt += x[i] and proceed to step 22. If false, print "\n\t\tTotal
Resistance = " Rt " ohms" and proceed to step 23.
STEP 22. Increment i by 1. Return to step 20.
STEP 23. Solve for Ct=Vt/Rt.
STEP 24. Print "\n\t\tTotal Current = " Ct " amperes".
STEP 25. Initialize k to 0.
STEP 26. Test if k is less than the resistor.
STEP 27. If true, then Cr = Ct and proceed to Step 28. If false, initialize j to 0 and proceed to
Step 30.
STEP 28. Print "\n\t\tTotal Current = " Ct " amperes".
STEP 29. Increment k by 1. Return to step 26.
STEP 30. Test if j is less than the resistor.
STEP 31. If true, then solve for Vr=Ct*x[j] and proceed to Step 32. If false, return to main
function.
STEP 32. Print "\n\t\tVoltage of R" j+1 " = " Vr " volts".
STEP 33. Set Vr=0.
STEP 34. Increment j by 1. Return to Step 30.
Parallel(type)
STEP 1. Initialize Vt, resistor, x[10], Rt, pRt, Ct, Cr, Vr, i, j, k, l to 0. Initialize confirm.
STEP 2. Print "\tYou chose the Parallel Circuit.".
STEP 3. Input Vt.
STEP 4. Input resistor.
STEP 5. Test if resistor is less than or equal to 0 or greater than 10.
STEP 6. If true, print "\n\n\tInvalid input! Please enter value within the range.\n\n\t" and
return to Step I. If false, then proceed to next step.
STEP 7. Initialize i to 0.
STEP 8. Test if i is less than resistor.
STEP 9. If true, print “\t\tEnter value of resistance “ i+1 “: “ and proceed to step 10. If false,
print “\n\n\tAre the entered values correct? Enter any key if yes or <N> if you wish to
change the values: " and proceed to step 12.
STEP 10. Input x[i].
STEP 11. Increment i by 1. Return to step 8.
STEP 12. Input confirm.
STEP 13. Test if confirm is not equal to ‘N’ or ‘n’.
STEP 14. If true, return to step 2. If false, print"\n\tRESULTS\n" "\n\tType of Circuit:
Parallel" "\n\tEntered value of total voltage: " Vt " volts" "\n\tEntered value of resistance
for each resistors: \n" and proceed to next step.
STEP 15. Initialize i to 0.
STEP 16. Test if i is less than the resistor.
STEP 17. If true, print "\t\tResistor " i+1 ": " x[i] " ohms\n" and proceed to step 18. If false,
proceed to step 19.
STEP 18. Increment i by 1. Return to step 16.
STEP 19. Initialize i to 0.
STEP 20. Test if i is less than the resistor.
STEP 21. If true, solve Rt += (1/x[i]) and proceed to step 22. If false, Print "\n\t\tTotal
Resistance = " pRt " ohms" and proceed to step 24.
STEP 22. Solve pRt = 1/Rt.
STEP 23. Increment i by 1. Return to step 20.
STEP 24. Initialize k to 0.
STEP 25. Test if k is less than the resistor.
STEP 26. If true, then Vr = Vt and proceed to step 27. If false, initialize j to 0 and proceed to
step 29.
STEP 27. Print "\n\t\tVoltage of R" k+1 " = " Vr " volts".
STEP 28. Increment k by 1. Return to step 25.
STEP 29. Test if j is less than the resistor.
STEP 30. If true, then Cr = Vt/x[j] and proceed to step 31. If false, initialize l to 0 and
proceed to step 34.
STEP 31. Print "\n\t\tCurrent of R" j+1 " = " Cr " amperes".
STEP 32. Set Cr = 0.
STEP 33. Increment j by 1. Return to step 29.
STEP 34. Test if l is less than the resistor.
STEP 35. If true, then Ct += Vt/x[l] and proceed to step 36. If false, print "\n\t\tTotal Current
= " Ct " amperes" and return to main function.
STEP 36. Increment l by 1. Return to step 34.
IV. Codes
V. Screenshots