Link to home
Start Free TrialLog in
Avatar of Swaminathan K
Swaminathan KFlag for India

asked on

Type not defined in the class

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);
      }
}
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial