Basic Primitive and Wrapper Classes Usage
int a = 1;
float b = 2.45f;
float sum = (a + b);
System.out.println(sum);
String x = "aadya";
String y = "daita";
String name = x + " " + y;
System.out.println(name);
boolean is_taking_CSA = true;
boolean is_taking_CSP = false;
if (is_taking_CSP){
System.out.println("aadya is taking CSP");
}
else if (is_taking_CSA){
System.out.println("aadya is taking CSA");
}
import java.util.Scanner;
import static java.lang.Math
try {
Scanner numerator = new Scanner(System.in); // creating a scanner object
String score_text = "enter the score you got"; //usage of string to print a message
System.out.println(score_text); // score they got is a float, because the points recieved could be fractional
float score = Integer.parseInt(numerator.nextLine()); // read user input
System.out.println(score);
Scanner denominator = new Scanner(System.in); // creating another scanner object
String out_off_text = "enter what the score is out off"; //usage of strings again
System.out.println(out_off_text);
int out_off = Integer.parseInt(denominator.nextLine()); // out off is an int - something is out off is typically a whole #
System.out.println(out_off);
float temp_score = (score / out_off);
float final_score = temp_score * 100f; //divide the two numbers, and multiple by a 100 - in float form bc score/out_off
// could be fractional
System.out.println(final_score + "%"); // print the percentage as a float
boolean passed = false; //using boolean to see if you have passed the class
if (final_score > 68.0){
passed = true;
System.out.println("You passed: " + passed);
}
else {
System.out.println("You passed: " + passed);
}
} catch (Exception e) {
//TODO: handle exception
}