Computer Science, asked by shinyshibu, 8 months ago

import java.util.*;
class student
{

long admission_no = 0;
String sname = "";
int sclass = 0;
int sroll = 0;
int tmarks = 0;
String remark = "";

public student (long admission_no, String sname,int sclass,int sroll, int tmarks, String remark)
{
this.admission_no = admission_no;
this.sname = sname;
this.sroll = sroll;
this.sclass = sclass;
this.tmarks = tmarks;
this.remark = remark;
}
public void input()
{
Scanner sc = new Scanner(System.in);
System.out.println ("Enter admission no:");
admission_no = sc.nextLong();
System.out.println ("Enter name:");
sname = sc.nextLine();
System.out.println ("Enter class");
sclass = sc.nextInt();
System.out.println ("Enter roll no.");
sroll = sc.nextInt();
System.out.println ("Enter total marks");
tmarks = sc.nextInt();

}
public void calculate()
{
if(tmarks <40)
{
remark = "Fail";

}
else if(tmarks >40 && tmarks < 50)
{
remark = "Pass";

}
else if(tmarks >50 && tmarks < 60)
{
remark = "Second Class";

}
else if(tmarks >60 && tmarks < 70)
{
remark = "First Class";

}
else if(tmarks >70 && tmarks < 90)
{
remark = "Distinction";

}
else if (tmarks>90 )
{
remark = "High Distinction";
}

}
public void display()
{
System.out.println ("Admission no.:"+admission_no);
System.out.println ("Name:"+sname);
System.out.println ("Class:"+sclass);
System.out.println ("Roll no:"+sroll);
System.out.println ("Total Marks"+tmarks);
System.out.println ("Remark---"+remark);

}
public static void main(String [] args)
{
student ob = new student();
ob.input();
ob.calculate();
ob.display();

}

}

There is something wrong with this, please help. I don't quite understand how to use constructors and functions in Java. Help​

Answers

Answered by shishirsingh2535
0

Answer:

Mark me as branliest answer then you get your answer. thank you

Similar questions