2022-08-23 Primitive Notes
import java.util.*;
public class SimpleCalculator {
public static void main(String[] args) {
Scanner input1 = new Scanner(System.in);
System.out.println("Enter an integer for joe: ");
int joe = input1.nextInt();
input1.close();
Scanner input2 = new Scanner(System.in);
System.out.println("Enter a integer for joey: ");
int joey = input2.nextInt();
input2.close();
double amogus = (double) joe + joey;
String joseph = "Hello I am Joseph";
System.out.println("I want to add joe and joey");
Scanner input3 = new Scanner(System.in);
System.out.println("Do I add joe and joey(True/False): ");
boolean joel = input3.nextBoolean();
if(joel){
System.out.println(joseph + ", if I add joe(" + joe + ") and joey(" + joey + ") it gets me " + amogus);
}else{
System.out.println("I guess joe and joey will never meet. The name's Joseph by the way");
}
}
}
SimpleCalculator.main(null);
import java.util.*;
public class main{
public static double fortnightConverter(double fortnight) {
double days = fortnight*14;
double seconds = days * 86400;
return seconds;
}
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.println("How many fortnights?: ");
double fortnight = input.nextDouble();
System.out.println(fortnight + " fortnight in seconds is: " + fortnightConverter(fortnight));
}
}
main.main(null);