/**
* Simple math application using a scanner input
* @version 1.00 2010/1/26
*/
import java.util.*;
import java.text.*;
import java.io.*;
public class mathopr {
public static void main(String[] args) {
double num1,answer1,answer2,answer3=0;
String myname;
String reply;
char replyChar=;
Scanner input = new Scanner(System.in);
DecimalFormat df= new DecimalFormat("00.00");
while (replyChar=='y'){
System.out.println("Please enter your name");
myname=input.nextLine();
System.out.println("Please enter your number");
num1=input.nextDouble();
answer1=Math.pow(num1,2);
System.out.println("Thank you Mr./Mrs. "+myname+" The value of num1 is"+num1+"Raised to the second power is"+df.format(answer1));
answer2=Math.sqrt(num1);
System.out.println("Thank you Mr./Mrs. "+myname+" The value of num1 is"+num1+"The square root of num1 is"+df.format(answer2));
System.out.println("Do you want to continue? Y or N?");
reply=input.nextLine();
replyChar=reply.charAt(0);
}
}
This is just a basic application using some math operators. I am having trouble looping however. It says my char variable may need to be initialized. I'm not quite sure how to fix this. Any help would be greatly appreciated. Thanks in advance!
Regards,
Dalymiddleboro