ErSKS / Java

Java Training
http://khec.edu.np/
MIT License
16 stars 17 forks source link

Implement Java Inheritance - Vehicle #37

Closed ErSKS closed 7 years ago

ErSKS commented 7 years ago

Vehicle

Car extends Vehicle

Truck extends Vehicle

milan604 commented 7 years ago

package vehicletest;

/*

}

Class Vehicle package vehicletest;

/*

}

Class Car package vehicletest;

/*

}

Class Truck package vehicletest;

/*

}

Output screenshot from 2017-08-14 17-57-09

jagdish4249 commented 7 years ago

package task14august1;

/*

}

class Vehicle package task14august1;

import javax.swing.JOptionPane;

/*

class Truck package task14august1;

import javax.swing.JOptionPane;

/*

class Car package task14august1;

import javax.swing.JOptionPane;

/*

capture

capture1

RakenShahi commented 7 years ago

/*

/*

}

/*

/*

/*

/*

}

/*

/*

OUTPUT vech

maheshyakami commented 7 years ago

/*

/*

} /*

/*

} /*

/*

/*

}

screen shot 2017-08-14 at 12 06 38 pm
Sudan15423 commented 7 years ago

/*

import static java.lang.Integer.parseInt; import javax.swing.JOptionPane;

/*

}

Class Vehicle

/*

/*

}

Class Car

/*

/*

}

Class Truck

/*

/*

} choice car accelerate maxspeed decelerate stopped

karmi214 commented 7 years ago

/*

import java.util.Scanner; import javax.swing.JOptionPane;

/*

} /*

/*

} /*

/*

} /*

import javax.swing.JOptionPane;

/*

sajanbasnet75 commented 7 years ago

/*

import javax.swing.JOptionPane;

/*

Class Vechile /*

/*

}

Class Car /*

/*

}

Class Truck /*

/*

}

1

2 n4w 4 5 6

kajalmaharjan commented 7 years ago

/*

import static java.lang.Float.parseFloat; import static java.lang.Integer.parseInt; import javax.swing.JOptionPane;

/*

import javax.swing.JOptionPane;

/*

import javax.swing.JOptionPane;

/*

import javax.swing.JOptionPane;

/*

ajay987 commented 7 years ago

/*

import static java.lang.Integer.parseInt; import javax.swing.JOptionPane; import static jdk.nashorn.internal.objects.NativeJava.type;

/*

}

/*

/*

}

/*

/*

} op1 op2 op3 op4 op5 op6 op7 op8

duwalshraddha commented 7 years ago

/*

import java.util.Scanner;

/*

} /*

//import java.util.Scanner; /*

} /*

import java.util.Scanner;

/*

/*

ghost commented 7 years ago

package day11task;

import static java.lang.Integer.parseInt; import javax.swing.JOptionPane;

/*

}

public class VechicleClass {

private String color = "White";
private String noOfWheels = "4";
private String noOfGears = "5";
private String speed = "75kmph";
private String noOfDoors = "4";

public String getColor() {
    return color;
}

public void setColor(String color) {
    this.color = color;
}

public String getNoOfWheels() {
    return noOfWheels;
}

public void setNoOfWheels(String noOfWheels) {
    this.noOfWheels = noOfWheels;
}

public String getNoOfGears() {
    return noOfGears;
}

public void setNoOfGears(String noOfGears) {
    this.noOfGears = noOfGears;
}

public String getSpeed() {
    return speed;
}

public void setSpeed(String speed) {
    this.speed = speed;
}

public String getNoOfDoors() {
    return noOfDoors;
}

public void setNoOfDoors(String noOfDoors) {
    this.noOfDoors = noOfDoors;
}

} public class CarClass extends VechicleClass {

private double price = 200000;
private double controlspeed = 120;

public double getPrice() {
    return price;
}

public void setPrice(double price) {
    this.price = price;
}

public double getControlspeed() {
    return controlspeed;
}

public void setControlspeed(double controlspeed) {
    this.controlspeed = controlspeed;
}

} public class TruckClass extends VechicleClass {

private double Controlspeed = 75;

public double getControlspeed() {
    return Controlspeed;
}

public void setControlspeed(double Controlspeed) {
    this.Controlspeed = Controlspeed;
}

} capture capture2 capture3 capture4 capture5 capture6 capture 7jpg