Class should be declared in Hstudent.java
import java.util.Scanner;
public interface StudentFee
{
int HFee=10000;
int getAmount();
void getFirstName();
void getLastName();
void getAddress();
void getContact();
}
public class HStudent implements StudentFee
{
String FName,LName,Add;
int Cnc,Am;
public void getFirstName()
{
FName=s.nextLine();
}
public void getLastName()
{
LName=s.nextLine();
}
public void getAddresss()
{
Add=s.nextLine();
}
public void getContact()
{
Cnc=s.nextInt();
}
public int getAmount()
{int x=s.nextInt;
return(x);
}
}
class J43
{
public static void main (String args[])
{
Scanner s=new Scanner(System.in);
HStudent S1=new HStudent();
System.out.println("Enter the First Name of the student:");
S1.getFirstName();
System.out.println("Enter the Last Name of the student:");
S1.getLastName();
System.out.println("Enter the Address of the student:");
S1.getAddress();
System.out.println("Enter the Contact of the student:");
S1.getContact();
System.out.println("Enter the Amount of the Fee:");
int Am = S1.getAmount();
System.out.println("Is the student \"HOSTLER\" if yes press y/Y:");
char y=s.nextChar();
if(y=='y'||y=='Y')
{
System.out.println("Total Amount student should Pay is:"+
(Am+HStudent.HFee));
}
else
{
System.out.println("Sudent Has To Pay :"+Am);
}
}
}
gives error class HStudent is public , should be declared in
HStudent.java... Also says symbol not found for s
No comments:
Post a Comment