Type not defined in the class

sam_2012
sam_2012 used Ask the Experts™
on
Hi Team,

I have the below error for my program . I have defined the method in the class , even then Iam getting this error

Multiple markers at this line
      - Line breakpoint:SeverityConstantsTest [line: 16] -
       main(String[])
      - Line breakpoint:SeverityConstantsTest [line: 18] -
       main(String[])
      - The method getHoursForFix(int) is undefined for the type
       SeverityUtil

Below is my code

SeverityConstants .java

package Enums;

public class SeverityConstants {
public static final int LOW=0;
public static final int MEDIUM=1;
public static final int HIGH=2;
public static final int URGENT=3;
}

===============================

SeverityUtil.java

package Enums;

public class SeverityUtil {

      public int getHoursForFix(int severity)
      {
            int hrs=0;
            
            switch (severity)
            {
            
            case SeverityConstants.LOW: hrs=24;
                                                      break;
            case SeverityConstants.MEDIUM: hrs=12;
            break;
            case SeverityConstants.HIGH: hrs=6;
            break;
            case SeverityConstants.URGENT: hrs=1;
            break;
            }            
            return hrs;            
      }      
}
=======================================

--SeverityConstantsTest.java
 
package Enums;

import java.io.Console;

public class SeverityConstantsTest {

      public static void main(String[] args) {
            // TODO Auto-generated method stub
            
            int severity=0;
            int respHrs=0;
            
            SeverityUtil sutl = new SeverityUtil();
            
            Console console= System.console();
            String str = console.readLine("Enter the Severity");
            severity=Integer.parseInt(str);
            respHrs=sutl.getHoursForFix(severity);            
            System.out.println(" The no hours for severity" + severity + " is "+ respHrs);
      }
}
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
Try cleaning and compiling again. The code looks OK to me

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial