Page 179 - CA_Blue( J )_Class9
P. 179

19              System.out.println("Annual Taxable Income: Rs. " + ytaxinc);
                  20              System.out.println("Tax: Rs. " + inctax);

                  21          }
                  22      }

                 You will get the following output:













                  Program 2      Suppose  a student wants to take  admission  in class XI. The admission  depends  on the
                                 following criteria:
                                 Marks Combination                               Stream
                                 Physics>=80, Chemistry>=80, Maths>=80           Pure Science
                                 Physics>=80, Chemistry>=80, Biology>=80         Bio Science
                                 Physics>=50, Chemistry>=50, Maths>=70           Commerce with Maths
                                 Physics>=50, Chemistry>=50, Maths>=50           Commerce with BST

                    1     import java.util.*;
                    2     class stream

                    3     {
                    4         public static void main()

                    5         {
                    6               Scanner sc= new Scanner(System.in);
                    7             int p,c,b,m;

                    8               System.out.print("Enter Physics marks: ");

                    9             p=sc.nextInt();
                  10              System.out.print("Enter Chemistry marks: ");
                  11              c=sc.nextInt();

                  12              System.out.print("Enter Biology marks: ");

                  13              b=sc.nextInt();
                  14              System.out.print("Enter Maths marks: ");
                  15              m=sc.nextInt();

                  16              if(p>=80 && c>=80 && m>=80)
                  17              {

                  18                  System.out.println("Stream – Pure Science");





                                                                                     Conditional Constructs in Java  177
   174   175   176   177   178   179   180   181   182   183   184