Skip to content

Instantly share code, notes, and snippets.

@NishantMishra-1
Created February 9, 2021 10:30
Show Gist options
  • Save NishantMishra-1/cca61119c04e619f3ac05b3b0c246d80 to your computer and use it in GitHub Desktop.
Save NishantMishra-1/cca61119c04e619f3ac05b3b0c246d80 to your computer and use it in GitHub Desktop.
problem in print,showing fails
/* Created by IntelliJ IDEA.
* Author: Nishant Mishra (NishantMishra-1)
* Date: 01-02-2021
* Time: 10:39
* File: studentResult.java
*/
package Lab_Task_1_Feb;
import java.util.*; //library file of java
class Student {
private static String StudentName;
private static int rollNumber;
private static int Subject1;
private static int Subject2;
private static int Subject3;
private String StudnetName;
public Student(String StudentName, int rollNumber, int Subject1, int Subject2, int Subject3) {
this.StudentName = StudentName;
this.rollNumber = rollNumber;
this.Subject1 = Subject1;
this.Subject2= Subject2;
this.Subject3 = Subject3;
}
public String getStudentName() {
return StudentName;
}
public int getrollNumber() {
return rollNumber;
}
public int getSubject1() {
return Subject1;
}
public int getSubject2() {
return Subject2;
}
public int getSubject3() {
return Subject3;
}
public void setStudentName(String StudentName) {
StudnetName = StudentName;
}
public void setStream(int rollNumber) {
rollNumber = rollNumber;
}
public void setSubject1(int Subject1) {
Subject1 = Subject1;
}
public void setSubject2(int Subject2) {
Subject2 = Subject2;
}
public void setSubject3(int Subject3){
Subject3 = Subject3;
}
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
Student[] student=new Student[1];
int i=0;
for (i=0; i <student.length; i++) {
String StudentName=scanner.next();
int rollNumber=scanner.nextInt();
int Subject1=scanner.nextInt();
int Subject2=scanner.nextInt();
int Subject3=scanner.nextInt();
}
Student student1=new Student(StudentName,rollNumber,Subject1,Subject2,Subject3);
int ar[]=new int[i]; // array initize // int[] arr={0,1,2,3} create , initiliaze , Declare
scanner.close();
if(Subject1<40 ){
System.out.println("Fails in Subject1!");
}
if(Subject2<40){
System.out.println("Fails in Subject2!");
}
if(Subject3<40){
System.out.println("Fails in Subject3!");
}
if(Subject1>40){
System.out.println("!!! Passed !!!");
}
if(Subject2>40){
System.out.println("!!! Passed !!!");
}
if(Subject3>40){
System.out.println("!!! Passed !!!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment