Getting errors and having a hard time seeing where. If I get it to build it is ignoring the inputmenu.

package personalprogram;
import java.util.Scanner;

/**
 *
 * @author mitch
 */
public class PersonalProgram {

    /**
     */
   public final class InputMenu 
{
    public void display_menu() 
    {
    System.out.println("1) Calculate Cubic feet per hour of room:\n2) Calculate needed CFM of \n3) Option 3");
    System.out.print("Selection: ");
    }

    public void question()
    {
    System.out.println("Would you like to proceed or quit?");
    System.out.println("To proceed enter 3.");
    System.out.println("If you wish to quit enter 0.");
    Scanner q = new Scanner(System.in);

    switch (q.nextInt()) 
    {
        case 0:
        System.out.println ("Thank you and godbye.");
        break;

        case 3:
        System.out.println ("Please proceed.");
        new InputMenu();
        break;

        default:
        System.err.println ( "Unrecognized option" );
        break;
    }
    }

    public InputMenu() 
    {
    Scanner in = new Scanner(System.in);
        display_menu();

    switch (in.nextInt()) 
    {
        case 1:
        Scanner scanner = new Scanner(System.in);
       System.out.println("Enter the length of the Clean Room:");
       double length = scanner.nextDouble();
       System.out.println("Enter the width of Clean Room:");
       double width = scanner.nextDouble();
           System.out.println("Enter the Ceiling hight of Clean Room:");
       double hight = scanner.nextDouble();
       //Area = length*width;
       double area = length*width*hight;
       System.out.println("Cubic foot of the Cleanroom is:"+area);

           System.out.println("Enter the total CFM readings taken:");
       double cfm = scanner.nextDouble();
           double cfmh = cfm*60;
               //Area = length*width;
       double tac = cfmh/area;
       System.out.println("Total Aire changes a hour in room is:"+tac);
        break;

        case 2:
        System.out.println ( "You picked option 2" );
        question();
        break;

        default:
        System.err.println ( "Unrecognized option" );
        break;
    }
    }

    public static void main (String[]args) 
    {
    new InputMenu();
    }
   }
}

Recommended Answers

All 2 Replies

Don't just say "getting errors:, tell us the complete error messages or worng behaviours.
Anyway, one thing is that you have two different Scanners both using System.in, which is guaranteed to cause problems.
Just open one Scanner at startup and use that for everything

commented: Error: Main method not found in class personalprogram.PersonalProgram, please define the main method as: public static void main(String[] args) or +0

OK.
Your main method is in the inner class InputMenu. It needs to be in the public outer class PersonalProgram

commented: Stay classy. +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.