PROGRAM:
import
java.io.*;
class
Studentmarklist1
{
public
static void main(String a[]) throws IOException
{
DataInputStream
d=new DataInputStream(System.in);
System.out.println("\nEnter the Name,Rollno and Mark1,Mark2,Mark3,Mark4,Mark5::");
String name=d.readLine();
int
no=Integer.parseInt(d.readLine());
int m1=Integer.parseInt(d.readLine());
int
m2=Integer.parseInt(d.readLine());
int
m3=Integer.parseInt(d.readLine());
int
m4=Integer.parseInt(d.readLine());
int
m5=Integer.parseInt(d.readLine());
int tot=(m1+m2+m3+m4+m5);
float avg=tot/5;
System.out.println("\nName:="+name);
System.out.println("Rollno:="+no);
System.out.println("Mark1:="+m1);
System.out.println("Mark2:="+m2);
System.out.println("Mark3:="+m3);
System.out.println("Mark4:="+m4);
System.out.println("Mark5:="+m5);
System.out.println("Total:="+tot);
System.out.println("Average:="+avg);
if((m1&m2&m3&m4&m5)>40)
{
System.out.println("Result=Pass");
}
else
{
System.out.println("Result=Fail");
}
if(avg>=90.0)
{
System.out.println("Grade=Outstanding!");
}
if(avg>=70.5&avg<=90.0)
{
System.out.println("Grade=First Class");
}
if(avg>=60.0&avg<=70.5)
{
System.out.println("Grade=Second Class");
}
if(avg>50.0&avg<60.0)
{
System.out.println("Grade=Third
Class");
}
if(avg<50.0)
{
System.out.println("Grade=No Class");
}
FileOutputStream fos=new
FileOutputStream("Stud.txt");
DataOutputStream dos=new DataOutputStream(fos);
dos.writeUTF(name);
dos.writeInt(no);
dos.writeInt(m1);
dos.writeInt(m2);
dos.writeInt(m3);
dos.writeInt(m4);
dos.writeInt(m5);
dos.writeInt(tot);
dos.writeFloat(avg);
}
}
OUTPUT:
Enter the Name,Rollno and Mark1,Mark2,Mark3,Mark4,Mark5::
MARTIN
101
98
92
91
90
87
Name:=MARTIN
Rollno:=101
Mark1:=98
Mark2:=92
Mark3:=91
Mark4:=90
Mark5:=87
Total:=458
Average:=91.6
Result=Pass
Grade=Outstanding!
No comments:
Post a Comment
Thanks for your valuable comments