1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Leni [432]
3 years ago
13

Using your choice of C# or Java (NOT in Pseudocode), write an abstract class Vehicle. The Vehicle class contains at least these

two attributes: id (int type) and model (String type) and an abstract method vehicleDetail() that will have two arguments for the vehicle id and model. Then write two concrete classes Car and Bus that inherit the Vehicle class and implement the abstract method that displays vehicle id and model. You don't need to include the main () method.
Computers and Technology
2 answers:
vodka [1.7K]3 years ago
7 0

Answer:

public abstract class Vehicle

   {

       private int  id;

       public int  ID

       {

           get { return id; }

           set { id = value; }

       }

       private string model;

       public string Model

       {

           get { return model; }

           set { model = value; }

       }

       public abstract string VehicleDetail(int id, string model);

   }

   public class Car : Vehicle

   {

       public Car()  {  }

       public Car(int id, string model)

       {

           ID = id;

           Model = model;

       }

       public override string VehicleDetail(int id, string model)

       {

           return $"{id} - {model}";

       }

   }

   public class Bus : Vehicle

   {

       public Bus(int id, string model, string make)

       {

           ID = id;

           Model = model;

           Make = make;

       }

       public string Make { get; set; }

       public override string VehicleDetail(int id, string model, string make)

       {

           return $"{id} - {model}" - {make};

       }

   }

Explanation:

konstantin123 [22]3 years ago
3 0
<h2>Answer:</h2>

//Declare the abstract class  

//by using the "abstract" keyword as follows

abstract class Vehicle {

 

   //declare the attributes of the class

   int id;

   String model;

   

   //declare the abstract method, vehicleDetail()

   //which has two arguments: id and model

   //and has no implementation

   abstract void vehicleDetail(int id, String model);

   

}   //End of abstract class declaration

 

========================================================

//Create the Car class to inherit from the Vehicle class

//by using the "extends" keyword as follows

public class Car extends Vehicle {

   //Implement the abstract method in the Vehicle class

   //writing statements to print out the id and model as follows;

   void vehicleDetail(int id, String model) {

       System.out.println("Id : " + id);

       System.out.println("Model : " + model);

       

   }  //End of vehicleDetail method

   

}  //End of class declaration

==========================================================

//Create the Bus class to inherit from the Vehicle class

//by using the "extends" keyword as follows

public class Bus extends Vehicle {

   //Implement the abstract method in the Vehicle class

   //by writing statements to print out the id and model as follows;

   void vehicleDetail(int id, String model) {

       System.out.println("Id : " + id);

       System.out.println("Model : " + model);

       

   }   //End of vehicleDetail method

   

}  //End of class declaration

================================================================

<h2>Explanation:</h2>

The above code has been written in Java and it contains comments explaining every line of the code. Please go through the comments.

The actual lines of code have been written in bold-face to differentiate them from comments.

You might be interested in
Anyone help me on this ?
HACTEHA [7]

Answer:

The first one is Mobile Marketing Second Box is social media and the last is Search engine

Explanation:

4 0
3 years ago
An i/o system call returns a one-bit information about the status of the call.
amid [387]

An i/o system call returns one-bit information about the call's status, Therefore the given statement is true.

<h3>What is an i/o system?</h3>
  • I/O (Input/Output) is a type of data processing system that sends and receives data from a computer hardware component, device, or network. A network allows data to be sent between devices. Computers would be unable to communicate with other systems or devices if I/O was not present.
  • The primary function of an i/o system is processor communication, which includes a variety of tasks such as data transfer between the processor and an I/O module, accepting and decoding commands sent by the processor, reporting current status, and the ability for the I/O module to recognize its own unique address.
  • A system call allows a user program to communicate with the operating system. The program requests a number of services, and the operating system responds by invoking a series of system calls to fulfill the request.

To learn more about i/o system call  refer to :

brainly.com/question/1763761

#SPJ4

6 0
1 year ago
A video conference on the topic: "The internet solves more problems than it causes". You will then be asked to discuss this ques
uysha [10]

Answer:

Internet help us in daily life. i save our time, also it let us to connect with our friends and family, faster with no time

Explanation:

Hi, that what do i know

3 0
3 years ago
A ______ is a device that provides a connection between two lans that use the same protocol, or it can separate them into two se
zaharov [31]

I guess the answer in the blank is Bridge.

A bridge is a device that provides a connection between two LANs that use the same protocol, or it can separate them into two sections.

7 0
3 years ago
Answer ASAP and I'll give brainliest.
Naddika [18.5K]
The simple answer is that Sweden grows more trees than it chops down.Annual growth stands at around 120 million forest cubic metres, and each year around 90 million forest cubic metres of that growth is harvested. That’s because Sweden employs a sustainable forestry model.
8 0
3 years ago
Read 2 more answers
Other questions:
  • What is the definition of hardware
    5·2 answers
  • What is the role of the digital cinematographer?
    9·2 answers
  • You want to substitute one word with another throughout your document. What tool(s) should you use?
    9·1 answer
  • Which tab will you use to format data in cells?
    11·2 answers
  • (Q003) The difference between a parameter and an exogenous variable is that Group of answer choices a parameter is allowed to ch
    14·1 answer
  • What is the major difference between the intranet and extranet?
    11·1 answer
  • Being the Sales Manager of a company you have to hire more salesperson for the company to expand the sales territory. Kindly sug
    13·1 answer
  • What does a pencil icon in the row selector area indicate?
    7·1 answer
  • How to become a web developer ?​
    12·1 answer
  • Assume you are using the text's array-based queue and have just instantiated a queue of capacity 10. You enqueue 5 elements and
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!