Answer to Question #162619 in Java | JSP | JSF for aj

Question #162619

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. (I = V/R)



1
Expert's answer
2021-02-10T14:43:46-0500
import java.util.Scanner;
public class current{
public static void getTotalCurrent(){
Scanner scan= new Scanner(System.in);
 double i,v,r;
 System.out.println("Enter voltage in volts");

v= scan.nextInt();

 System.out.println("enter resistance in ohms");


 r= scan.nextInt();


  i=v/r;


  System.out.printf("%.2f",i);

 }

  public static void main(String []args) {


getTotalCurrent();


  }


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog