Swaminathan K
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:SeverityConstan tsTest [line: 16] -
main(String[])
- Line breakpoint:SeverityConstan tsTest [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.ja va
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.getHoursForFi x(severity );
System.out.println(" The no hours for severity" + severity + " is "+ respHrs);
}
}
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:SeverityConstan
main(String[])
- Line breakpoint:SeverityConstan
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.ja
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(
respHrs=sutl.getHoursForFi
System.out.println(" The no hours for severity" + severity + " is "+ respHrs);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.