Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Q: Task is to Take an Array of Voltage, Current, Resistance and Power. There wer

ID: 3751716 • Letter: Q

Question

Q: Task is to Take an Array of Voltage, Current, Resistance and Power.

There were Two Cases.

*Case-1*

Keep Resistance Fixed like R=10 and Change Voltage.

Find Power and show them.

*Case-2*

Keep Voltage Fixed like V=10 and Change Resistance like shown in Example

Find Power and show them.

Electronic Formula For DC Circuits Needed for this assignment

V = Voltage in Volts

R= Resistance In ohms

I= Current in Amps

P=Power In watts

There for:

V=IxR,

Voltage = Current x Resistance

R=V/I,

Resistance = Voltage divide by Current

I=V/R, Voltage divide by Resistance.

P=I*V

Example:

V    R    I

5 100 0.05

6 100 0.06

7 100 0.07

8 100 0.08

9 100 0.09

10 100 0.1

11 100 0.11

12 100 0.12

13 100    0.13

14 100    0.14

This is done with the Volt changing and Resistance

Content Try with voltage being Constant and Resistance Changing

Then with this formula for Power P=IxR and add that to the Array

### It must be solved in Eclipse Java program##

Explanation / Answer

import java.util.*;

import java.text.*;

class conversion{

public static void main(String args[])

{

int n=0;

System.out.println("Enter the size of array :");

Scanner sc=new Scanner(System.in);

n=sc.nextInt();

double volt[]=new double[n];

double current[]=new double[n];

double Resistance[]=new double[n];

double power[]=new double[n];

DecimalFormat numberFormat = new DecimalFormat("#.00");

double R,V;

System.out.println("Case1: Taking R to constant! Enter the value for R");

R=sc.nextDouble();

System.out.println("Enter values for current :");

for(int i=0;i<n;i++)

{

Resistance[i]=R;

current[i]=sc.nextDouble();

volt[i]=current[i]*Resistance[i];

power[i]=current[i]*volt[i];

}

System.out.println("V R I P");

for(int i=0;i<n;i++)

{

System.out.println(numberFormat.format(volt[i])+" "+Resistance[i]+" "+numberFormat.format(current[i])+" "+numberFormat.format(power[i]));

}

System.out.println("Case2: Taking V to be constant! Enter the value for V");

V=sc.nextDouble();

for(int i=0;i<n;i++)

{

volt[i]=V;

Resistance[i]=volt[i]/current[i];

power[i]=current[i]*volt[i];

}

System.out.println("V R I P");

for(int i=0;i<n;i++)

{

System.out.println(volt[i]+" "+numberFormat.format(Resistance[i])+" "+numberFormat.format(current[i])+" "+numberFormat.format(power[i]));

}

}

}