Thursday, 5 September 2013

Program compiles and runs but doesn't output anything

Program compiles and runs but doesn't output anything

I've never had this issue and since there are no errors given, I am unsure
of where to even look. I've had a heck of a time with this program (it is
my first time doing methods). Prior to this issue, it kept throwing
exceptions. While I researched that piece, and managed to fix the error, I
get the feeling it isn't right. Any help would be much appreciated and
please let me know if the entire code is off (preferably some constructive
criticism) or if I'm close. Again, I'm new at all this. Thanks again
import java.io.*;
public class InsuranceMethod2//class name here, same as file name
{
// use BufferedReader class to input from the keyboard
// declare a variable of type BufferedReader
private BufferedReader input = new BufferedReader(new
InputStreamReader(System.in));
//declare variable for input
private String inputString;
String carChoice;
boolean insurable;
int year;
public void InsuranceMethod2()throws IOException{//constructor, place
class name here
String carChoice;
boolean insurable;
int year;
initialize();
insureProcess();
cleanUp();
}//end constructor
public void initialize(){
System.out.println();
System.out.println("Insurance Process Intializing");
}//end initialize
public void insureProcess() throws IOException {
String carChoice;
boolean insurable;
int year;
System.out.println("Enter your vehicle model: ");
inputString = input.readLine();
carChoice = inputString;
if(carChoice.equalsIgnoreCase("ford") ||
carChoice.equalsIgnoreCase("chevy") ||
carChoice.equalsIgnoreCase("toyota"))
{
System.out.println("Enter the vehicle year: ");
inputString = input.readLine();
year = Integer.parseInt(inputString);
if(year >= 1990)
{
System.out.println("Your vehicle is insurable");
}
}
}
public boolean checkModel(){
if(carChoice.equalsIgnoreCase("Ford")||
carChoice.equalsIgnoreCase("Chevy")||
carChoice.equalsIgnoreCase("Toyota"))
{
return true;
}
else
{
return false;
}
}//end checkModel
public boolean checkYear(int year){
return false;
}//end checkYear
public void printResults(boolean insurable){
}//end printResults
public void cleanUp(){
System.out.println("Program ending");
}//end cleanUp
public static void main(String [] args) throws IOException // main method
{
new InsuranceMethod2(); //class constructor name
} // end the main method
} // end the program

No comments:

Post a Comment