Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
830 B
8
Indexable
Never
	int rno;
	String name;
	int s1, s2, s3;
	int total;
	String result;
	
	void calculate()
	{
		if(s1>=50 && s2>=50 && s3>=50)
		{
			total = s1 + s2 +s3;
			result = "Pass";
		}
		else
		{
			total = 0;
			result = "Fail";
		}	
	}

	StudentData()
	{
		Scanner in = new Scanner(System.in);
		
		System.out.println("Enter Roll no:");
		rno = in.nextInt();
		
		System.out.println("Enter Name:");
		name = in.next();
		
		System.out.println("Enter 3 subject marks:");
		s1 = in.nextInt();
		s2 = in.nextInt();
		s3 = in.nextInt();	
	}
	void display()
	{
		System.out.println("Roll no: "+rno);
		System.out.println("Name: "+name);
		System.out.println("Subject 1: "+s1);
		System.out.println("Subject 2: "+s2);
		System.out.println("Subject 3: "+s3);
		System.out.println("Total: "+total);
		System.out.println("Result: "+result);
	}
}