title: Why getRoadtaxPrice() function didn't get typeVehicle input value?
body: <p>I am still beginner in programming. This is my first year.
  I have some problem with my code. I hope you guys can help me with it.</p>
  <p>This is my main (VehicleApp.java)</p>
  <pre><code>public static void main(String[] args) {
      // TODO code application logic here
      int acc, brake;
      String type, powerTrain;
      
      Scanner sc = new Scanner(System.in);
      Vehicle vehicle = new Vehicle(&quot;Car&quot;, &quot;Manual&quot;, &quot;Electric&quot;);               
             
      //input
      
      System.out.println(&quot;Type of vehicle? [Car, SUV, MPV, Lorry]: &quot;);
      type = sc.nextLine();
      vehicle.setType(type);
      
      if(type.equals(&quot;Lorry&quot;)){
          System.out.println(&quot;Enter Accelerate: &quot;);
          acc = sc.nextInt();
          vehicle.autoAccelerate(acc);
      
          System.out.println(&quot;Enter Brake: &quot;);
          brake = sc.nextInt();
          vehicle.autobrake(brake);
          
          //output
          System.out.println(&quot;===========================================\n&quot;);
          System.out.println(vehicle.getPowertrain()+&quot; &quot;+vehicle.getType()+&quot;.&quot;);
          System.out.println(&quot;\nAccelerate:\nCurrent Speed = &quot;+vehicle.autoAccelerate(acc)+&quot; kmh&quot;);      
          System.out.println(&quot;\nBrake:\nCurrent Speed = &quot;+vehicle.autobrake(brake)+&quot; kmh&quot;);
          System.out.println(&quot;\nPrice: RM &quot;+vehicle.getRoadtaxPrice());
      }
      else{
          System.out.println(&quot;Type of powertrain? [Gasoline, Hybrid, Electric]: &quot;);
          powerTrain = sc.nextLine();
          vehicle.setPowertrain(powerTrain);
      
          System.out.println(&quot;Enter Accelerate: &quot;);
          acc = sc.nextInt();
          vehicle.autoAccelerate(acc);
      
          System.out.println(&quot;Enter Brake: &quot;);
          brake = sc.nextInt();
          vehicle.autobrake(brake);
      
          //output
          System.out.println(&quot;===========================================\n&quot;);
          System.out.println(vehicle.getPowertrain()+&quot; &quot;+vehicle.getType()+&quot;.&quot;);
          System.out.println(&quot;\nAccelerate:\nCurrent Speed = &quot;+vehicle.autoAccelerate(acc)+&quot; kmh&quot;);      
          System.out.println(&quot;\nBrake:\nCurrent Speed = &quot;+vehicle.autobrake(brake)+&quot; kmh&quot;);
          System.out.println(&quot;\nPrice: RM &quot;+vehicle.getRoadtaxPrice());
      }
  }
  </code></pre>
  <p>This is my class (Vehicle.java)</p>
  <pre><code>public class Vehicle {
  private String typeVehicle, transmissionVehicle, powertrainVehicle;
  private int speedVehicle;
  
  public Vehicle(String type, String transmission, String powertrain){
      this.typeVehicle = type;
      this.transmissionVehicle = transmission;
      this.powertrainVehicle = powertrain;
      speedVehicle = 60;
  }
          
  public int accelerate(){
      return speedVehicle+=10;
  }
  
  public int brake(){
      return speedVehicle-=5;
  }
  
  //Getter
  public String getType(){
      return typeVehicle;
  }
  
  //Setter
  public void setType(String type){
      //type = this.typeVehicle;
      this.typeVehicle = type;
  }
   
  //Lab3 Start
  public int autoAccelerate(int accelerate){
      for(int i = 0; i &lt; accelerate; i++){
          speedVehicle += 10;
      }
      return speedVehicle;
  }
  
  public int autobrake(int brake){
      for(int i = 0; i &lt; brake; i++){
          speedVehicle -= 5;
          
          if(speedVehicle &lt;= 0){
              speedVehicle = 0;
          }
      }
      return speedVehicle;
  }
  
  public double getRoadtaxPrice(){
      double price = 0;
      
      if (typeVehicle == &quot;Car&quot;){
                    
          if (powertrainVehicle == &quot;Gasoline&quot;){
              price = 200;
          }
          else if (powertrainVehicle == &quot;Hybrid&quot;){
              price = 100;
          }
          else if (powertrainVehicle == &quot;Electric&quot;){
              price = 50;
          }
          else{
              price = 0;
          } 
          
      }
      
      else if (typeVehicle == &quot;SUV&quot; || typeVehicle == &quot;MPV&quot;){
                      
          if (powertrainVehicle == &quot;Gasoline&quot;){
              price = 300;
          }
          else if (powertrainVehicle == &quot;Hybrid&quot;){
              price = 150;
          }
          else if (powertrainVehicle == &quot;Electric&quot;){
              price = 100;
          }
          else{
              price = 0;
          }                
          
      }
      
      else if (typeVehicle == &quot;Lorry&quot;){
          
          powertrainVehicle = &quot;All&quot;;
          price = 400;
                      
      }
       
      return price;
  }
  //Lab3 End
        
  //Getter
  public String getTransmission(){
      return transmissionVehicle;
  }
  
  //Setter
  public void setTransmission(String transmission){
      transmission = this.transmissionVehicle;
  }
  
  //Getter
  public String getPowertrain(){
      return powertrainVehicle;
  }
  
  //Setter
  public void setPowertrain(String powertrain){
      powertrain = this.powertrainVehicle;
  }
  
  public void output(){
      System.out.println(&quot;Type of vehicle: &quot;+getType());
  }
  
  }
  </code></pre>
  <p>My input:</p>
  <pre><code>Type of vehicle? [Car, SUV, MPV, Lorry]: 
  MPV
  Type of powertrain? [Gasoline, Hybrid, Electric]: 
  Hybrid
  Enter Accelerate: 
  2
  Enter Brake: 
  2
  </code></pre>
  <p>My output:</p>
  <pre><code>===========================================
  
  Electric MPV.
  
  Accelerate:
  Current Speed = 90 kmh
  
  Brake:
  Current Speed = 80 kmh
  
  Price: RM 0.0
  </code></pre>
  <p>The output should be like this:</p>
  <pre><code>===========================================
  
  Hybrid MPV.
  
  Accelerate:
  Current Speed = 90 kmh
  
  Brake:
  Current Speed = 80 kmh
  
  Price: RM 150.0
  </code></pre>
  <p>There are problems with the Price and Powertrain.
  Please help me!
  Thank you.</p>