my program compiles with no errors though I need help actually getting the program to loop. I want it to loop if yes is entered , and stop if no is entered. How would I go about doing this? can someone please provide the proper code needed? I am very new to Java and I am trying my best to learn. this program is a project from a book I am reading.
here is my code:
/* Protoype program to be used to prove first concepts Algorithm project */ import java.io.*; import java.lang.*; import java.text.*; import java.util.*; //Set up public class public class document2 { //declare main() method public static void main(String[] args) throws IOException { //Declare data types float length,width,area,circum,loop,yes,no; //set up input stream Scanner readin = new Scanner(System.in); //prompt for length System.out.println("\n\n enter value for length"); //stream in length and convert to float length = readin.nextFloat(); //prompt for width System.out.println("\n\n enter value for width"); //stream in width and convert to float width = readin.nextFloat(); //Calculate results area = length*width; circum = 2* (length + width); //prepare data for out put display DecimalFormat twodig = new DecimalFormat("########.##"); System.out.print("\n\nThe results of the calcuations are\n\n\n"); System.out.print("the area is:\t\t" + twodig.format(area) + "\n\n"); System.out.println("the circumference is:\t\t" + twodig.format(circum)); //prompt for loop System.out.println("\n\n calculate again YES / NO ?"); //stream in width and convert to float loop = readin.nextFloat(); }//end main }//end class