Skip to main content

Write a java program to implement multiple inheritance | VCMIT

Multiple Inheritance.


INPUT

interface Car
{
    int speed=60;
    public void distanceTravelled();
}
interface Bus
{
    int distance=100;
    public void speed();
}
public class Vehicle implements Car,Bus
{
    int distanceTravelled;
    int averageSpeed;
    public void distanceTravelled()
    {
        distanceTravelled=speed*distance;
        System.out.println("Total Distance Travelled is : "+distanceTravelled);
    }
    public void speed()
    {
        int averageSpeed=distanceTravelled/speed;
        System.out.println("Average Speed maintained is : "+averageSpeed);
    }
    public static void main(String args[])
    {
        Vehicle v1=new Vehicle();
        v1.distanceTravelled();
        v1.speed();
    }
}

OUTPUT



Comments

Popular posts from this blog

A Brief History Of Software | VCMIT

History Of Software The Early Days of Software Computer scientist Tom Kilburn is responsible for writing the world’s very first piece of software, which was run at 11 a.m. on June 21, 1948, at the University of Manchester in England. Kilburn and his colleague Freddie Williams had built one of the earliest computers, the Manchester Small-Scale Experimental Machine (also known as the “Baby”). The SSEM was programmed to perform mathematical calculations using machine code instructions. This first piece of software took “only” 52 minutes to correctly compute the greatest divisor of 2 to the power of 18 (262,144). For decades after this groundbreaking event, computers were programmed with punch cards in which holes denoted specific machine code instructions. Fortran, one of the very first higher-level programming languages, was originally published in 1957. The next year, statistician John Tukey coined the word “software” in an article about computer programming. Other pioneering programmin...

Python Simple Calculator Program | TKinter Calculator Program | VCMIT

Python Simple Calculator Program With TKinter Calculator INPUT from tkinter import Tk, Label, Button, Entry class Root(Tk):     def __init__(self):         super().__init__()         self.title_label = Label(self, text="A Simple Calculator :)")         self.title_label.pack()         self.entry = Entry(self)         self.entry.pack()         self.entry.insert(0, "1+2")         self.label = Label(self, text="")         self.label.pack()         self.button = Button(self, text="Compute", command=self.onclick)         self.button.pack()     def onclick(self):         self.label.configure(text=str(eval(self.entry.get()))) root = Root() root.mainloop() OUTPUT