package hw00;

import java.util.Random;
import java.util.Scanner;

public class Fortune {
	
	private String firstName;
	private String lastName;
	private Random randGen;

	public Fortune(String firstName, String lastName) {
		this.firstName = firstName;
		this.lastName = lastName;
		randGen = new Random();
	}

	public String effort() {
		String result="Programming with objects is going to take ";
		char f=lastName.toLowerCase().charAt(2);
		if (f>'g') result +="almost no ";
		else if (f>'k') result +="a normal amount of ";
		else if (f>'q') result +="a good amount of";
		else if (f>'u') result +="a lot of";
		else result += "an enormous amount of";
		result +="effort,\nbut every drop of effort you put in will be worth it.\n";
		return result;
	}
	
	public String grade() {
		String result="You will get ";
		char f=firstName.toLowerCase().charAt(1);
		if (f>'f') result+="an amazingly good ";
		else if (f>'j') result +="a really good ";
		else if (f>'r') result +="a pretty good ";
		else if (f>'v') result +="an OK ";
		else result += "a not so good ";
		result += "grade in CS-140...\nbut grades aren't the most important thing... learning is.\n";
		return result;
	}
	
	public String fun() {
		String result="My crystal ball tells me this CS-140 class ";
		int choice=randGen.nextInt(5);
		if (choice==0) result+="is going to be a blast!.";
		else if (choice==1) result+="is going to be a lot of fun.";
		else if (choice==2) result+="will have some fun moments.";
		else if (choice==3) result+="could have been more fun, but you will learn a lot.";
		else result+="will be hard, but rewarding.";
		return result + "\n";
	}
	
	public String predict() {
		String result="Let me look into my crystal ball...\n" + firstName +
				", in your future I see... coffee?... no, Java!\n";
		int choice=randGen.nextInt(3);
		if (choice==0) result += effort() + grade() + fun();
		else if (choice==1) result += grade() + effort() + fun();
		else result += fun() + effort() + grade();
		return result + "The Great Bodhi has spoken... listen well.";
	}
	
	public static Fortune prompt() {
		System.out.print("The Great Bodhi wants your first name: ");
		@SuppressWarnings("resource")
		Scanner in = new Scanner(System.in);
		String first = in.nextLine();
		System.out.print("... and your last name: ");
		String last = in.nextLine();
		return new Fortune(first,last);
	}


	public static void main(String[] args) {
		Fortune myFuture = Fortune.prompt();
		System.out.println(myFuture.predict());
	}

}
