Question: Please help me to do this program using java netbeans please screenshot the main program and output tysm! OOP Activity 1. Create a class CIRCUIT



Please help me to do this program using java netbeans please screenshot the main program and output tysm!
OOP Activity 1. Create a class CIRCUIT with the following public attributes: total resistance, total voltage and total current. Assign proper variable type and name for each attribute. Total voltage must be static. (static double variablename) 2. Create a method setVoltage Source () of circuit class to set a constant value of voltage to 24 volts. This value is true to all types of connection thus; it should be a static method. 3. Create a public method getTotalCurrent() to compute and display total current in 2 decimal values. Total current is equal to the ratio of voltage and total resistance. (1 = V/R) 4. Create a child class of class CIRCUITS named Series and Parallel 5. Each class must have an integer attribute named numres. This variable holds the number of resistors in a circuit and will be used for display only. 6. In series class, create a public method named computeTotalresistance (double ri, double r2). This method is used to accept two resistance values and computes the total resistance of a series connection with 2 resistors. Total resistance is the summation of the two resistance values. Also, it sets numres equal to 2. NOTE: store computed total resistance to the total resistance attribute of the parent class. A child class can use attributes and methods of a parent class (Inheritance). 7. Overload the method from the previous item (7) that accepts 3 resistance values and computes the total resistance of a series connection with 3 resistors. Total resistance is the summation of the three resistance values. Also, it sets numres equal to 3. NOTE: store computed total resistance to the total resistance attribute of the parent class. A child class can use attributes and methods of a parent class (Inheritance). 8. Perform item 7 and 8 in parallel class. a. Total resistance 2 resistor = 1/(1/resistor) + 1/resistor2) b. Total resistance 3 resistor = 1/(1/resistor] + 1/resistor2 + 1/resistor3) Set value of numres accordingly. 9. Add new public methods in each class (series and parallel) named disType() to display the type of circuit connection and number of resistor (numres). See test case below. 10. Implement encapsulation by setting up the total resistance attribute in both series and parallel class to private and creating public class to allow other class to access the total resistance value. This is an example of a read only function when using encapsulation. 11. Create an interface class called DisplayCircuitType. It contains an abstract method of disType(). Modify the series class and parallel class to implement this interface class. A subclass (extends) can be also implement interface (implements). Syntax: public class childclassname extends parentclassname implements interfaceclassname 12. Complete the program with the following steps: a. Use scanner to enter 3 values (resistor values). Create 3 variables to store each inputs b. Create 2 objects of Series Class and 2 objects of Parallel Class c. Call setvoltage() to set uniform voltage d. Work on with the first object of Series class with 2 resistors. Call computeTotalResistance and disType methods. Print the value of getTotalResistance. Call getTotalCurrent. Note: In calling computeTotalResistance method you have to indicate number of parameters. e. Work on with the first object of Series class with 2 resistors. Call computeTotalResistance and disType methods. Print the value of getTotalResistance. Call getTotalCurrent. Note: In calling computeTotalResistance method you have to indicate number of parameters. f. Test the program for the first circuit. If it gives the correct answer, work on the other circuits. Please enter 3 resistance values: 1 2 3 SERIES CONNECTION with 2 Resistors Total Resistance in 24 (V): 3.00 Total Current in 24 (V): 8.00 SERIES CONNECTION with 3 Resistors Total Resistance in 24 (V): 6.00 Total Current in 24 (V): 4.00 PARALLEL CONNECTION with 2 Resistors Total Resistance in 24 (V): 0.67 Total Current in 24 (V): 36.00 PARALLEL CONNECTION with 3 Resistors Total Resistance in 24 (V): 0.55 Total Current in 24 (V): 44.00
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
