import java.util.Scanner; /** * * @author Ahs@n */ public class Absent { private int smstrno; private int absents; boolean con; public Absent(){ smstrno=0; absents=0; } public void collecFine(){ } public boolean setSmstrno(int smstrno){ con = (smstrno>0 && smstrno<9)? true:false; if(con){ this.smstrno = smstrno; } return con; } public boolean setAbsents(int absents){ con = (absents<33)? true:false; if(con){ this.absents = absents; } return con; } public void takeInput(){ Scanner input = new Scanner(System.in); do{ System.out.println("To find the total fine \n Please enter the semester no. : "); // int smstrno = input.nextInt(); setSmstrno(smstrno = input.nextInt()); if(!con){ System.out.println("Please re-enter your value"); } }while(!con); do{ System.out.println("\nPlease enter the total no. of bunked lectures : ");
//int absents = input.nextInt(); setAbsents(absents = input.nextInt()); if(!con){ System.out.println("Please re-enter your value"); } }while(!con); collectFine(); } public static void main(String[] args) { new Absent().takeInput(); }
private void collectFine() { if(smstrno == 1){ if(absents < 3){ System.out.println("Your fine } else System.out.println("Your fine } if(smstrno == 2){ if(absents < 3){ System.out.println("Your fine } else System.out.println("Your fine } if(smstrno == 3){ if(absents < 3){ System.out.println("Your fine } else System.out.println("Your fine } if(smstrno == 4){ if(absents < 3){ System.out.println("Your fine } else System.out.println("Your fine } if(smstrno == 5){ if(absents < 3){ System.out.println("Your fine } else System.out.println("Your fine } if(smstrno == 6){ if(absents <3 ){ System.out.println("Your fine } else System.out.println("Your fine } if(smstrno == 7 || smstrno == 8){ if(absents < 3){ System.out.println("Your fine } else System.out.println("Your fine } } }
is 100"); is 500");
is 200"); is 600");
is 300"); is 700");
is 400"); is 800");
is 500"); is 900");
is 600"); is 1000");
is 2000"); is 5000");