/*
Find out what height you should put on your Tinder profile.
If you are a boy and are 5'10" or 5'11", you should round up to 6 feet.
If you're height is fragile and in the decimal, round up to nearest integer.
If you are a girl, your height remains the same because your height doesn't matter.
*/
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
boolean loop = true;
int gender, feet;
double inches;
String height = "";
Tinder.titleScreen();
//User Input
do{
System.out.println("What is your gender?");
System.out.print("Enter '1' for boy or '2' for girl: ");
gender = input.nextInt();
if (gender != 1 && gender != 2)
System.out.println(
"Please enter a valid number. If you are non-binary,"
+ "select a gender you mostly associate with."
);
else
loop = false;
}
while(loop);
System.out.println("What is your height?");
System.out.print("Feet: ");
feet = input.nextInt();
System.out.print("Inches: ");
inches = input.nextDouble();
//Display Height Based off Gender
height = gender == 1 ? Tinder.boyHeight(feet, inches) : Tinder.girlHeight(feet, inches);
//User Output
System.out.println("On your Tinder profile, you should put " + height);
}
}
public class Tinder {
public static void titleScreen() {
System.out.println("==================================================================\n");
System.out.println("\t\t David's Side Project #1");
System.out.println("\t\t\tWelcome to:");
System.out.println("\tWhat Height Should You Put on Your Tinder Profile?\n");
System.out.println("==================================================================\n\n\n");
}
/*
If a guy is 5'10" or 5'11", round up to 6 feet.
If a guy's height is fragile and is in the decimal, round decimal to exagerrate a higher height and remove decimal place.
*/
public static String boyHeight(int feet, double inches) {
return feet == 5 && inches >= 10 || feet == 5 && inches <= 11 ? "6\'0\"." : feet + "\'" + (int)Math.ceil(inches) + "\".";
}
/*
If a girl's height is in the decimal, keep decimal place. Their height does not matter.
Otherwise if the girl's height is not, remove decimal place for cleaner output (5'4" instead of 5'4.0").
*/
public static String girlHeight(int feet, double inches) {
return inches % Math.ceil(inches) != 0 ? feet + "\'" + inches + "\"." : feet + "\'" + (int)inches + "\".";
}
}