public class PrimitiveExamples {
    public static void main(String[] args) {
      int exampleInt = 94;
      double exampleDouble = 100.4;
      boolean exampleBoolean = false;


      String exampleString = "Argentina winning the world cup!";   
      String exampleStringFormal = new String("Lionel Messi along with the Argentinian National Team are the favorites for this World Cup");
  
      System.out.println("Integer Example: " + exampleInt);
      System.out.println("Double Example: " + exampleDouble);
      System.out.println("Boolean Example: " + exampleBoolean);
      System.out.println("String Example: " + exampleString);
      System.out.println("Formal String Example: " + exampleStringFormal);
    }
  }
  PrimitiveExamples.main(null)
Integer Example: 94
Double Example: 100.4
Boolean Example: false
String Example: Argentina winning the world cup!
Formal String Example: Lionel Messi along with the Argentinian National Team are the favorites for this World Cup
import java.util.Scanner;


public class PranavPrimitivesExamples {
    public static void main(String[] args) {    
        Scanner input;

       
        input = new Scanner(System.in);
        System.out.print("Type An Integer: ");
        try {
            int PersonInt = input.nextInt();
            System.out.println(PersonInt);
        } catch (Exception e) {  
            System.out.println("This Isn't An Integer (form like 159), " + e);
        }
        input.close();

        
        input = new Scanner(System.in);
        System.out.print("Type A Double: ");
        try {
            double PersonDouble = input.nextDouble();
            System.out.println(PersonDouble);
        } catch (Exception e) {  
            System.out.println("This Isn't A Double (form like 9.99), " + e);
        }
        input.close();

        
        input =  new Scanner(System.in);
        System.out.print("Type A Boolean: ");
        try {
            boolean PersonBoolean = input.nextBoolean();
            System.out.println(PersonBoolean);
        } catch (Exception e) { 
            System.out.println("This Isn't A Boolean (true or false), " + e);
        }
        input.close();

        
        input =  new Scanner(System.in);
        System.out.print("Type A String: ");
        try {
            String PersonString = input.nextLine();
            System.out.println(PersonString);
        } catch (Exception e) { 
            System.out.println("This Isn't A String, " + e);
        }
        input.close();
    }
}
PranavPrimitivesExamples.main(null);
Type An Integer: 5
5
Type A Double: 10.7
10.7
Type A Boolean: true
true
Type A String: yooooo
yooooo
public class PranavPrimitiveDivision {
    public static void main(String[] args) {
        int b1 = 9, b2 = 3;
        System.out.println("Division For Integers");
        System.out.println("int output with concatenation: " + b1 + "/" + b2 + " = " + b1/b2);
        System.out.println(String.format("int output with format: %d/%d = %d",b1, b2, b1/b2));
        System.out.printf("\tint output with printf: %d/%d = %d\n",b1, b2, b1/b2);

        double c1 = 9, c2 = 3;
        System.out.println("Division For Doubles");
        System.out.println("\tdouble output with concatenation: " + c1 + "/" + c2 + " = " + c1/c2);
        System.out.println(String.format("\tdouble output with format: %.2f/%.2f = %.2f",c1, c2, c1/c2));
        System.out.printf("\tdouble output with printf: %.2f/%.2f = %.2f\n",c1, c2, c1/c2);

        System.out.println("Casting and Remainders");
        System.out.printf("\tint cast to double on division: %d/%d = %.2f\n",b1, b2, b1/(double)b2);
        System.out.println("\tint using modulo for remainder: " + b1 + "/" + b2 + " = " + b1/b2 + " remainder " + b1%b2);
    }
}
PranavPrimitiveDivision.main(null);
Division For Integers
int output with concatenation: 9/3 = 3
int output with format: 9/3 = 3
	int output with printf: 9/3 = 3
Division For Doubles
	double output with concatenation: 9.0/3.0 = 3.0
	double output with format: 9.00/3.00 = 3.00
	double output with printf: 9.00/3.00 = 3.00
Casting and Remainders
	int cast to double on division: 9/3 = 3.00
	int using modulo for remainder: 9/3 = 3 remainder 0
public class PranavSchoolGradeCalculator {
    
    ArrayList<Double> grades;   

    
    public PranavSchoolGradeCalculator() {
        this.grades = new ArrayList<>();
        this.enterGrades();
    }

    
    private boolean isZero(double value){
        double threshold = 0.001;
        return value >= -threshold && value <= threshold;
    }


  
    private void enterGrades() {
        Scanner input;

        while (true) {
            input = new Scanner(System.in);
            System.out.print("Enter a double, 0 to exit: ");
            try {
                double sampleInputDouble = input.nextDouble();
                System.out.println(sampleInputDouble);
                if (isZero(sampleInputDouble)) break;      
                else this.grades.add(sampleInputDouble);    
            } catch (Exception e) {  
                System.out.println("Not an double (form like 9.99), " + e);
            }
            input.close();
        }
    }

    
    public double average() {
        double total = 0;  
        for (double num : this.grades) {    
            total += num;  
        }
        return (total / this.grades.size());  
    }

  
    public static void main(String[] args) {
        PranavSchoolGradeCalculator grades = new PranavSchoolGradeCalculator(); 
        System.out.println("Average: " + String.format("%.2f", grades.average())); 
    }
}

PranavSchoolGradeCalculator.main(null);
Enter a double, 0 to exit:  10.5
10.5
Enter a double, 0 to exit:  11
11.0
Enter a double, 0 to exit:  12.3
12.3
Enter a double, 0 to exit:  14.5
14.5
Enter a double, 0 to exit:  55.5
55.5
Enter a double, 0 to exit:  65.6
65.6
Enter a double, 0 to exit:  0
0.0
Average: 28.23
public class PranavSchoolGradeCalculator {
    
    ArrayList<Double> grades;   

    
    public PranavSchoolGradeCalculator() {
        this.grades = new ArrayList<>();
        this.enterGrades();
    }

    
    private boolean isZero(double value){
        double threshold = 0.001;
        return value >= -threshold && value <= threshold;
    }


  
    private void enterGrades() {
        Scanner input;

        while (true) {
            input = new Scanner(System.in);
            System.out.print("Enter a double, 0 to exit: ");
            try {
                double sampleInputDouble = input.nextDouble();
                System.out.println(sampleInputDouble);
                if (isZero(sampleInputDouble)) break;      
                else this.grades.add(sampleInputDouble);    
            } catch (Exception e) {  
                System.out.println("Not an double (form like 9.99), " + e);
            }
            input.close();
        }
    }

    
    public double average() {
        double total = 0;  
        for (double num : this.grades) {    
            total += num;  
        }
        return (total / this.grades.size());  
    }

  
    public static void main(String[] args) {
        PranavSchoolGradeCalculator grades = new PranavSchoolGradeCalculator(); 
        System.out.println("Average: " + String.format("%.2f", grades.average())); 
    }
}