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
Write an application that encodes English-language phrases into pig Latin. Pig Latin is a form of coded language. There are many
deff fn [24]

Answer:

Answer has been attached to this response as a source code file saved as "PigLatinWord.java"

Explanation:

Explanation has been added to the source code in the form of comments. Please go through the comments in the code.

Hope this helps!

Download java
3 0
4 years ago
Assume you define a vector in the following way:
salantis [7]

Answer:

vec[0].push_back(10)

Explanation:

Given

Declaration: vector <int> vec

Required

Assign 10 to the first element

This can be done using the push_back keyword.

The syntax is:     <em>vectorname[position].push_back(value); </em>

In this case:

vectorname = vec

position = 0 i.e. first element

value = 10

So, we have:

vec[0].push_back(10)

6 0
3 years ago
URGENT!!! If Pete selects the green square or little green camera icon on his camera dial, what mode is he selecting?
SOVA2 [1]

B Shutter Priority Mode

7 0
3 years ago
Which of the selections below is not a benefit of imaging the computers on your network? There are fewer licensing fees because
Stella [2.4K]
Among the selections, the statement that is not a benefit of imaging the computers on your network is: It helps to lessen the impact of spyware on the network. 
The area that studies covering digital images - images that can be stored on a computer like bit-mapped images is called Computer imaging or digital imaging. 
8 0
3 years ago
Mike wants to build an amplifier. which technology can he use?
STatiana [176]
A.
Not B because a guitar has no moving parts.
Not C because guitars receive all the power they need from a cord.
And not D because a guitar is not a car and doesn't need to move!
4 0
3 years ago
Other questions:
  • Type the correct answer in the box. Spell the word correctly.
    14·2 answers
  • which type of website would a business selling merchandise on the internet use? A person B information C commercial D social
    9·1 answer
  • Which tasks can be completed within the File tab?
    8·1 answer
  • 4. Where do you find the command to create bibliography citations or a table of contents?
    14·2 answers
  • The information that’s displayed in a datalist control is defined by _____.
    10·1 answer
  • Which of the following statements is true regarding Wireshark?
    11·1 answer
  • Which of the following describes a characteristic of organic light-emitting diodes (OLEDs) used in clothing?
    6·2 answers
  • The process of recording and reporting the financial data for a business is known as:
    6·2 answers
  • Write the issue related to the cyber ethnic. ​
    7·2 answers
  • A thesis statement is the last sentence of the conclusion. It summarizes the entire paper.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!