package junit.learnnow;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class MyClass {
	
	private double houseLoanRate=-1;
	
	int myMethodInt(int myParm1) {
		int myReturn = 0;
		if (myParm1 <= 10) {
			// Some code goes here.
			myReturn=0;
		} else {
			// Some code goes here.
			myReturn=1;
		}
		return myReturn;
	}

	double myMethodDouble(double myParm1) {
		double myRate = .10;		
		return (myParm1 * myRate);
	}

	boolean myMethodBoolean(boolean myParm1) {
		boolean myReturn;
		myReturn = myParm1 ? true : false;
		return myReturn;
	}

	String myMethodString(String myParm1) {
		String myReturn;
		if (myParm1 == null) {
			myReturn = null;
		} else if ( myParm1.equals("Hello World")) {
			myReturn = "You won!";
		} else {
			myReturn = "No";
		}
		return myReturn;
	}
	
	public boolean goodHouseLoanRate() {
		boolean myReturn;
		if ( getHouseLoanRate() <= 3.0 ) {
			myReturn = true;
		} else {
			myReturn = false;
		}
		return myReturn; 
	}
	
	public double getHouseLoanRate() {
		return houseLoanRate;
	}

	public void setHouseLoanRate(double houseLoanRate) {
		this.houseLoanRate = houseLoanRate;
	}

	public String displayFile(String file) throws IOException  {

		FileReader fr = new FileReader(file);
		BufferedReader br = new BufferedReader(fr);
		String data = br.readLine();
		System.out.println("Data - " + data);
		br.close();
		
		return data;
	}

}
