I new in learning Object Oriented Programming... I face a problem that how to do this question for loop and if....
hopefully can get some help in this website...`

this question is need to do from the previos question..
this is java need to do the question using NetBeans.IDE..

question:(at the link file)

VehicleApp.java:

package vehicleapp;

/**
 *
 * @author asus
 */
public class VehicleApp {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Vehicle car;

        car = new Vehicle("car", "manual", "electric");

        System.out.println("Accelerate: Current Speed = " + car.accelerate());

        car.brake();

        System.out.println("Brake: Current Speed = " + car.getSpeed());

        System.out.println(car.getPowertrain()+ " " + "car with" + " " + car.getTransmission() + " " + "transmission");
    }       

    }

Vehicle class..:

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package vehicleapp;

/**
 *
 * @author asus
 */
public class Vehicle {
    private String type;
    private String transmission;
    private String powertrain;
    private int speed;

    public Vehicle(String type, String transmission, String powertrain){
       this.type = type;
       this.transmission = transmission;
       this.powertrain = powertrain;
       this.speed = 60; 
    }

    public int accelerate(){
        return speed = speed + 10;
    }

    public void brake(){
        this.speed = speed - 5;
    }

    public int getSpeed(){
        return speed;
    }

    public String getType(){
        return type;
    }

   public void setType(String type){
       type = type;
   }
   public String getTransmission(){
       return transmission;
   }
    public String getPowertrain(){
       return powertrain;
   }
     public void setPowerTrain(String powertrain){
         powertrain = powertrain;
   }
}

`

Possible show us Lab Task 2 ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.