Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# programing Interface implementation Create and implement an interface. Create a Car interface with following characteristics Method displaySpeed with no parameter and void return type.

C# programing

Interface implementation

Create and implement an interface.

Create a Car interface with following characteristics

Method displaySpeed with no parameter and void return type.

Method increaseSpeed with an integer as a parameter and void return type.

Create a Suzuki class with following characteristics

Must implement interface Car.

Member variable as currentSpeed of type integer.

Initialize member variable of the class using parameterized constructor the class.

Method increaseSpeed to add speed parameter to currentSpeed.

Method displaySpeed prints the currentSpeed of the car.

Input 10 20

where

First line contains value currentSpeed.

Second line contains value of speed.

Output 30

Please fill in the partial code below:

using System; using System.Collections.Generic; using System.Linq;

//write your code here

interface Car { void increaseSpeed (int speed); void displaySpeed (); }

class DriverMain {

public static void Main () { int currentSpeed = int.Parse (Console.ReadLine ()); int speed = int.Parse (Console.ReadLine ()); Car car = new Suzuki (currentSpeed); car.increaseSpeed (speed); car.displaySpeed (); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions