import javax.swing.JOptionPane;
import java.util.Scanner;

public class Counter
{
// instance variables belong here:
private int value;
private Scanner in;

public Counter()
{ in = new Scanner(System.in);
System.out.print("Age? >");
int age = in.nextInt();
System.out.println("Ok you are " + age);
System.out.print("Give 3 digits of PI: ");
double pi = in.nextDouble();
System.out.println("Estimate of PI: " + pi);
}

public void tryThis3()
{ String a = "Hello ";
String b = "Dave";
String c = a + b;
JOptionPane.showMessageDialog(null, c);
String ageStr = JOptionPane.showInputDialog("Age? ");
int age = Integer.parseInt(ageStr);
String name = JOptionPane.showInputDialog("Name?");
String name2 = name.substring(1, 6);
JOptionPane.showMessageDialog(null, name2);
JOptionPane.showMessageDialog(null, name.substring(2));
}

public void tryThis2()
{ double result = Math.pow(2,4);
JOptionPane.showMessageDialog(null, result);
result = Math.sqrt(25);
JOptionPane.showMessageDialog(null, result);
}

public void tryThis()
{ System.out.println(11/5);
System.out.println(11.0/5);
System.out.println((double)11/5);
System.out.println(11 % 5);
}

public void count()
{ value = value + 1;
// OR value++;
}

public int getValue()
{ return value;
}

public static void main(String[] args)
{ Counter tally = new Counter();
tally.count();
tally.count();
int result = tally.getValue();
String msg = "Value = " + result;
JOptionPane.showMessageDialog(null, msg);

int n = 1000000;

System.out.println(n * n);

double f = 4.35;
System.out.println(100 * f);

tally.tryThis3();
}
}