Thursday, April 11, 2019

Java Class 6 | If els method

package array;
public class HomeWorkClass6 {
    public static void main(String[] args) {

// I want to be able to put car on P mode, D mode, N mode, R mode.
//1. If i am on P mode and parking type is parallal i can park between two cars.
//2. if I am on d mode i can put drive type to Snow Type, Sport type or Regular type
//3. If im on N mode i can put car into car wash station
//4. if i am on R mode i can only reverse the car and car will active back camera.
//5. if mode is incorrect print me invilid mode type, please cheek your car mode.
boolean ifDrivingModeon = true;
boolean ifNetralModeon = true;
boolean ifParkModeon = true;
boolean ifReversModon = true;
boolean carOnparallaltype = true;

if (ifParkModeon && carOnparallaltype){
    System.out.println("You Can park the car between two cars");
}else if (ifDrivingModeon){
    System.out.println("You can choice Snow mode, Sports Mode");
}else if (ifNetralModeon){
    System.out.println("You can take the car to the car wash");
}else if (ifReversModon){
    System.out.println("Yor Backup camera is Activited");
}else {
    System.out.println("Invalid mode type Please cheek car mode");}

}
}

No comments:

Post a Comment