KK, was trying to decide to use a Double of an int.
public class AbsoluteValue {
public static void main(String args[]) {
double input;
System.out.print("Enter a number and I'll tell you it's absolute value: ");
input = TextIO.getlnDouble();
System.out.print("The Absolute Value is: ");
if(input >= 0)
System.out.println(input);
else
System.out.println(0-input);
}
}
public class Comparison {
public static void main(String args[]) {
double A, B;
System.out.print("Enter Value A: ");
A = TextIO.getlnDouble();
System.out.print("Enter Value B: ");
B = TextIO.getlnDouble();
if (A>B)
System.out.println("The value of A is greater then the value of B.");
else if(A==B)
System.out.println("The value of A is equal to the value of B.");
else
System.out.println("The Value of A is less then the value of B.");
}
}
public class DetermineAge {
public static void main(String args[]) {
int iBorn, iCur;
System.out.print("Please enter the last two digets of the year you were born: ");
iBorn = TextIO.getlnInt();
System.out.print("Please enter the last two digets of the current year: ");
iCur = TextIO.getlnInt();
if (iBorn >= 100 || iBorn < 0 || iCur > 100 || iCur <0) {
System.out.println("Hey but muncher! Dont lie to me. Good bye!");
return;
}
int iAge;
if (iBorn >= 6)
iAge = (100 - iBorn) + iCur;
else if(iBorn == iCur)
iAge = 0;
else
iAge = iCur - iBorn;
String cModi;
System.out.print("Has your birthday already happend this year? (y/n): ");
cModi = TextIO.getlnString();
if (cModi.toLowerCase().equals("n") || cModi.toLowerCase().equals("no"))
iAge -= 1;
System.out.println("You are " + iAge + " years old.");
}
}
So boring!
~-~(HDX)~-~