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

Draw The Moving Car On The Screen Program In C | VCMIT

The Moving Car Program In C  INPUT #include <stdio.h> #include <graphics.h> #include <conio.h> #include <dos.h> int main() { int gd = DETECT, gm; int i, maxx, midy; initgraph(&gd, &gm, "C:\\TURBOC3\\BGI"); maxx = getmaxx(); midy = getmaxy()/2; for (i=0; i < maxx-150; i=i+5) { cleardevice(); setcolor(WHITE); line(0, midy + 37, maxx, midy + 37); setcolor(YELLOW); setfillstyle(SOLID_FILL, RED); line(i, midy + 23, i, midy); line(i, midy, 40 + i, midy - 20); line(40 + i, midy - 20, 80 + i, midy - 20); line(80 + i, midy - 20, 100 + i, midy); line(100 + i, midy, 120 + i, midy); line(120 + i, midy, 120 + i, midy + 23); line(0 + i, midy + 23, 18 + i, midy + 23); arc(30 + i, midy + 23, 0, 180, 12); line(42 + i, midy + 23, 78 + i, midy + 23); arc(90 + i, midy + 23, 0, 180, 12); line(102 + i, midy + 23, 120 + i, midy + 23); line(28 + i, midy, 43 + i, midy - 15); line(43 + i, midy - 15, 57 + i, midy - 15); line(57 + i, midy - 15, 57 + i, midy); line(57 +...

Perform 2D Rotation On A Given Object Program In C | VCMIT

2D Rotation On A Given Object Program INPUT #include<stdio.h> #include<graphics.h> void main() { int gd=DETECT,gm; initgraph(&gdriver,&gmode,"C//TurboC3//BGI"); int x1,y1,x2,y2 ; float b1,b2; float t,deg; printf(“Enter the coordinates of Line: ”); scanf(“%d%d%d%d”,&x1,&y1,&x2,&y2); setcolor(6); line(x1,y1,x2,y2); getch(); //cleardevice(); printf(“Enter the angle of rotation: “); scanf(“%f”,&deg); t=(22*deg)/(180*7); b1=abs((x2*cos(t))-(y2*sin(t))); b2=abs((x2*sin(t))+(y2*cos(t))); line(x1,y1,b1,b2); getch(); closegraph(); } OUTPUT

What is Software Engineering? | VCMIT

What is Software Engineering? Software engineering is defined as a process of analyzing user requirements and then designing, building, and testing software application which will satisfy those requirements. Let's look at the various definitions of software engineering: IEEE, in its standard 610.12-1990, defines software engineering as the application of a systematic, disciplined, which is a computable approach for the development, operation, and maintenance of software. Fritz Bauer defined it as 'the establishment and used standard engineering principles. It helps you to obtain, economically, software which is reliable and works efficiently on the real machines'. Boehm defines software engineering, which involves, 'the practical application of scientific knowledge to the creative design and building of computer programs. It also includes associated documentation needed for developing, operating, and maintaining them.'
// Assuming you have fetched the search query and blog posts // Function to calculate the similarity score between search query and post function calculateSimilarity(query, post) { // You can use a similarity algorithm here, like TF-IDF or cosine similarity // Return a score that represents how relevant the post is to the query } // Function to suggest relevant posts based on search query function suggestPosts(searchQuery, blogPosts) { const suggestedPosts = []; for (const post of blogPosts) { const similarityScore = calculateSimilarity(searchQuery, post); if (similarityScore > 0) { suggestedPosts.push({ post, similarityScore }); } } // Sort the suggested posts based on similarity score suggestedPosts.sort((a, b) => b.similarityScore - a.similarityScore); // Return the sorted list of suggested posts return suggestedPosts.map(item => item.post); } // Example usage const searchQuery = "your search query"; const allBlogPosts = [/* array of your blog posts */]; const suggestedPosts = suggestPosts(searchQuery, allBlogPosts); // Now you can display suggestedPosts to the user