I can't figure out why it is saying (Vehicle.java:174: cannot find symbol) but there is a symbol, what is going on?
import java.util.Scanner;
public class Vehicle{
protected int hp;
protected int mileage;
protected int year;
public String make;
public String model;
Vehicle(){
hp = 0;
mileage = 0;
year = 0;
}
public void Set(int inputhp, int inputmileage, int inputyear){
hp = inputhp;
mileage = inputmileage;
year = inputyear;
}
//public static void Print(int hp, int mileage, int year){
/*
public void Print(Vehicle carinfo){
System.out.println("Horsepower: " + carinfo.hp + "\n Mileage: " + carinfo.mileage + "\n Year: " + carinfo.year +
"\n Make: " + carinfo.make + "\n Model: " + carinfo.model);
}
*/
public void Print(){
System.out.println("Horsepower: " + hp + "\n Mileage: " + mileage + "\n Year: " + year +
"\n Make: " + make + "\n Model: " + model);
}
/*public static void CheckYear(int year, Vehicle carinfo, int i, int yearcheck){
int count = 0;
for(i = 0; i < 1; i++){
if(yearcheck = carinfo[i].year){
System.out.println("The year inputed matches a " + carinfo.year + " " + carinfo.make + " " + carinfo.model + " in our database.");
count++;
}
}
if(count = 0){
System.out.println("There were no matches of that year");
}
}
*/
public static void main(String[] args){
Scanner keyboard = new Scanner(System.in);
int inputyear;
int inputmileage;
int inputhp;
String makeinput;
String modelinput;
int capacitypassed;
boolean isable;
int numdoorsinput;
//System.out.println("How many cars would you like to Enter the information for?");
//int input1 = keyboard.next();
Vehicle carinfo = new Vehicle();
System.out.println("Enter the horsepower of the car.");
inputhp = keyboard.nextInt();
//carinfo.hp.Set() = inputhp;
System.out.println("Enter the mileage of the car.");
inputmileage = keyboard.nextInt();
//carinfo.mileage.set = inputmileage;
System.out.println("Enter the year of the car.");
inputyear = keyboard.nextInt();
carinfo.Set(inputhp, inputmileage, inputyear);
//carinfo.year.set = inputyear;
System.out.println("Enter the make of the car.");
makeinput = keyboard.next();
carinfo.make = makeinput;
System.out.println("Enter the model of the car.") ;
modelinput = keyboard.next();
carinfo.model = modelinput;
carinfo.Print();
Truck[] truckinfo = new Truck[2];
for(int i = 0; i < truckinfo.length; i++){
truckinfo[i] = new Truck();
System.out.println("Enter the horsepower of truck number " + (i + 1));
inputhp = keyboard.nextInt();
System.out.println("Enter the mileage of truck number " + (i + 1));
inputmileage = keyboard.nextInt();
System.out.println("Enter the year of truck number " + (i + 1));
inputyear = keyboard.nextInt();
truckinfo[i].Set(inputhp, inputmileage, inputyear);
System.out.println("Enter the make of truck number " + (i + 1));
truckinfo[i].make = makeinput;
System.out.println("Enter the model of truck number " + (i + 1));
truckinfo[i].model = modelinput;
System.out.println("Enter the number of doors for truck number " + (i + 1));
numdoorsinput = keyboard.nextInt();
System.out.println("Enter the towing capacity of truck number " + (i + 1));
capacitypassed = keyboard.nextInt();
truckinfo[i].TruckSet(numdoorsinput, capacitypassed, truckinfo);
}
for(int i = 0; i < truckinfo.length; i++){
truckinfo[i].Print2(i);
}
System.out.println("How much weight are you trying to tow?");
capacitypassed = keyboard.nextInt();
for(int i = 0; i < truckinfo.length; i++){
isable = truckinfo[i].tow_check(capacitypassed, i);
if(isable = true){
System.out.println("We have a truck that can tow the desired weight");
}else System.out.println("We don't have a truck that can tow that much weight.");
}
}
}
class Truck extends Vehicle{
private int numdoors;
private int towingcap;
Truck(){
numdoors = 0;
towingcap = 0;
}
public void TruckSet(int numdoorsinput, int capacitypassed, Truck[] truckinfo){
towingcap = capacitypassed;
numdoors = numdoorsinput;
}
public void Print2(int i){
System.out.println("Horsepower: " +hp + "\n Mileage: " + mileage + "\n Year: " +year +
"\n Make: " + make + "\n Model: " + model + "\n Number of doors: " + numdoors +
"\n Towing Capacity: " + towingcap);
}
public boolean tow_check(int capacitypassed, int i){
if(capacitypassed > truckinfo[i].towingcap){
return false;
}else
return true;
}
}