Hi I have my program working all I need now is to output the answers to 2 decimal places. Could somebody help me out with this? Below is my code.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package assignment2;
import java.text.DecimalFormat;
import java.util.Scanner;
/**
*
* @author Adam
*/
public class PowerSquare {
public static void main(String[] args) {
double num1;
double num2;
double num1a;
double num2a;
Scanner scan = new Scanner(System.in);
System.out.println("Enter 2 numbers");
num1 = scan.nextDouble();
for (double i = num1; i <= num1 {
num1a =(i * i * i);
num2 = scan.nextDouble();
num2 = (num2 < 0 ? -num2 : num2);
for (double a = num2; a <= num2{
num2a =(Math.sqrt(a));
num2a =(Math.round(num2a));
if (num1a > num2a){
System.out.print(num1a);
}
else if (num2a > num1a){
System.out.print(num2a);
}
else if (num2 < 0){
DecimalFormat fmt = new DecimalFormat("#.##");
System.out.println(num2a);
}
System.exit(0);
}
}}}