Advertisement
FahimFaisal

CSE110_1

Feb 11th, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.74 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package cse110;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11.  *
  12.  * @author acer
  13.  */
  14. public class class2 {
  15.      public static void main(String[] args) {
  16.          //prob12();
  17.           //prob15();
  18.           multiple_16();
  19.           //grade(52);
  20.      }
  21.      public static void prob12(){
  22.          Scanner sc=new Scanner(System.in);
  23.          System.out.println("Enter your name");
  24.          String name=sc.nextLine();
  25.          System.out.println("Enter a number");
  26.          int x=sc.nextInt();
  27.          for(int i=0;i<x;i++){
  28.              System.out.println(name);
  29.          }
  30.      }
  31.      
  32.      public static void prob15(){
  33.          Scanner sc=new Scanner(System.in);
  34.  
  35.          System.out.println("Enter a number");
  36.          int x=sc.nextInt();
  37.          int no=1;
  38.          int i=1;
  39.          while(no<=x){
  40.              System.out.println("no"+no);
  41.              no=7*i;
  42.              i++;
  43.              
  44.          }
  45.      }
  46.      
  47.      public static void multiple_16() {
  48.          int mult1=0;
  49.          int mult2=0;
  50.          int i=1;
  51.          int sum1=0;
  52.           int sum2=0;
  53.            int sum=0;
  54.          while(mult1<=(300-7)){
  55.                 i++;
  56.         mult1=7*i;
  57.         sum1+=mult1;
  58.         System.out.println("mult1: "+mult1);
  59.          }
  60.          i=1;
  61.          while(mult2<=(300-9)){
  62.              i++;
  63.          mult2=9*i;
  64.          sum2+=mult2;
  65.              System.out.println("mult2: "+mult2);
  66.          }
  67.          sum=sum1+sum2;
  68.          System.out.println("Sum: "+sum);
  69.        
  70.     }
  71.      
  72.      public static void grade(int marks){
  73.          double cgpa=0;
  74.          String grade="";
  75.          String comment="";
  76.          
  77.          if(marks>50){
  78.              if(marks>=90){
  79.                  cgpa=4.0;
  80.                  grade="A+";
  81.                  comment="Excellent";      
  82.              }
  83.              else if(marks<90 && marks>=85){
  84.                  cgpa=3.7;
  85.                  grade="A-";
  86.                  comment="Excellent";
  87.              }
  88.               else if(marks<85 && marks>=80){
  89.                  cgpa=3.3;
  90.                  grade="B+";
  91.                  comment="Excellent";
  92.              }
  93.               else if(marks>=75 && marks<80){
  94.                  cgpa=3.0;
  95.                  grade="B";
  96.                  comment="Good";      
  97.              }
  98.              else if(marks<75 && marks>=70){
  99.                  cgpa=2.7;
  100.                  grade="B-";
  101.                  comment="Good";
  102.              }
  103.               else if(marks<70 && marks>=65){
  104.                  cgpa=2.3;
  105.                  grade="C+";
  106.                  comment="Good";
  107.              }
  108.                else if(marks<65 && marks>=60){
  109.                  cgpa=2.0;
  110.                  grade="C";
  111.                  comment="Fair";
  112.              }
  113.                else if(marks<60 && marks>=57){
  114.                  cgpa=1.7;
  115.                  grade="C-";
  116.                  comment="Fair";
  117.              }
  118.                else if(marks<57 && marks>=55){
  119.                  cgpa=1.3;
  120.                  grade="D+";
  121.                  comment="Fair";
  122.                }
  123.                else if(marks<55 && marks>=52){
  124.                    cgpa=1.3;
  125.                  grade="D";
  126.                  comment="poor";
  127.                }
  128.                else{
  129.                  cgpa=1.0;
  130.                  grade="D-";
  131.                  comment="poor";  
  132.                }
  133.          }
  134.          else{
  135.               cgpa=0.0;
  136.               grade="F";
  137.               comment="Failure";
  138.          }
  139.          System.out.println("your grade is: "+grade+"\nCGPA: "+cgpa+"\nstudent category: "+comment);
  140.      }
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement