Computer Science, asked by sayanchatterjee04, 11 months ago

the equivalent resistance of a series and a parallel connection of two resistances
are given by the formula:
R = r, +r2
R₂ = Izol 2
I, tr,
Write a program in java to input the value of r, and r2. Calculate and display the output
of the equivalent resistance as per User's choice.​

Answers

Answered by mdaymaan9
2

Answer:

Ur question isn't clear

say me how do we differentiate in series and parallel resistance depending on users choice?

Do we have to write a menu driven program??

if yes I'll attach a program

Change it according to ur needs

Hope this helps

Please follow me

Attachments:
Answered by Anonymous
0

import java.util.*;

public class Resistances

{

public static void main (String args [])

{

Scanner in = new Scanner (System.in);

int n;

double r1, r2, rs, rp;

System.out.println(" enter 1 for series resistance, enter 2 for parallel resistance");

System.out.println("enter your choice:");

n = in.nextInt();

switch (n)

{

case 1:

System.out.println(" enter the value of r1 and r2:");

r1 = in.nextInt();

r2 = in.nextInt();

rs = r1+r2;

System.out.println("Resistance in series =" +rs);

break;

case 2:

System.out.println(" enter the value of r1 and r2:");

r1 = in.nextInt();

r2 = in.nextInt();

rp = (r1*r2)/(r1+r2);

System.out.println(" Resistance in parallel =" +rp);

break;

default:

System.out.println(" Wrong Choice !!!");

}

}

}

Similar questions