First off I'm a complete newbie
Now that we have that taken care of:
The program has to be part of a problem we have, and then we solve it. I'm taking physics- and were on power and currents so voila - thats my problem!
At my system.out.println I'm getting illegal start of expression and ")" expected.
I'd appreciate any help or corrections anyone could offer. I'm not going to be a programmer- this was just sort of a fun course. I'm sorry if these are newb mistakes ( often I forget the simplest thing!).
I'm really winging it here.
Code:
/*
This program will find the current and power if you have reistance and voltage, OR it will find voltage and power if you have current and reistance.
*/
import java.io.*;
public class Phyiscs
{
double current;
double power;
double voltage;
public static void main(String args[])
{
System.out.println("This program will help you find the current and power if you have the reistance and voltage. OR It will find the voltage and power if you have the current and reistance.");
System.out.println("Please type 0 if you have the resistance and voltage, or type 1 if you have the current and resistance");
String inputLine = keyboard.readLine();
if ( inputLine == 0 ) {
System.out.println(" Please enter the Resistance: ");
double resistance = keyboard.readLine();
System.out.println(" Please enter the voltage: ");
double voltage = keyboard.readLine();
current=voltage/resitance;
System.out.println( " The current is:"+current+);
power=current*voltage;
System.out.println( "The power is:"+power+);
}
else
{
System.out.println(" Please enter the current: ");
double current = keyboard.readLine();
System.outprintln(" Please enter the resistance: ");
double resistance = keyboard.readLine();
voltage=current*resistance;
System.out.println("The voltage is: " +voltage+);
power=current*voltage;
System.out.println("The Power is:" +power+);
}
}
}