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
Pressing and holding _______ while clicking enables you to select multiple contiguous files or folders.
liq [111]

Answer:

Hi LizBiz! The answer is Ctrl key on Windows, or Command key for Mac.

Explanation:

The Ctrl (Windows) key or equivalent Command key on Mac has a special purpose which allows special operations to be performed when combined with another action, such as clicking on multiple pictures or files for selection.

8 0
2 years ago
Microsoft Excel used for making document and presentation.
dalvyx [7]

Explanation:

Charts that are created in Excel are commonly used in Microsoft Word documents or for presentations that use Microsoft PowerPoint slides. Excel provides options for pasting an image of a chart into either a Word document or a PowerPoint slide. You can also establish a link to your Excel charts so that if you change the data in your Excel file, it is automatically reflected in your Word or PowerPoint files.

5 0
3 years ago
An employee clicks on a link in an email from what looks like a fellow employee and is taken to a fraudulent web site which asks
Fittoniya [83]

Answer:

e. Phishing

Explanation:

Phishing is a type of fraudulent or social engineering attack used to lure unsuspecting individuals to click on a link that looks like that of a genuine website and then taken to a fraudulent web site which asks for personal information.

Attackers use it to steal sensitive user data or information.

5 0
3 years ago
Read 2 more answers
Name five different windows password policies.
rodikova [14]

The five different windows password policies are:

1. Enforce password history.

2. Minimum password length.

3. Minimum password age.

4. Maximum password age.

5. Password must meet complexity requirements. (contain symbols, numbers, letters,...) 

6 0
3 years ago
Create a new collection class named SortedLinkedCollection that implementsa collection using a sorted linked list. Include a toS
Irina18 [472]

Answer:

Since you have not mentioned the way toString method was implemented in your class, I am just providing a sample implementation of it.

Please find the code in file attached.

Explanation:

Please see attached file.

Download txt
5 0
3 years ago
Other questions:
  • based on the transcript, what did broadcasting the story through the medium of radio allow welles to do?
    8·1 answer
  • Write a script that creates a user-defined database role named OrderEntry in the MyGuitarShop database. Give INSERT and UPDATE p
    8·1 answer
  • LOOK TO THE LEFT AND RIGHT BEFORE ENTERING ANY INTERSECTION ON A GREEN LIGHT BECAUSE:
    12·2 answers
  • The second step when using the problem-solving process is to
    7·1 answer
  • ________ is a model of computing in computer processing, storage, software, and other services which are provided as a shared po
    9·1 answer
  • ECG mashine is an example of
    12·1 answer
  • Where must virtualization be enabled for VM (virtual machine) software to work?
    14·1 answer
  • What gaming PC should I get
    14·2 answers
  • How can you make a search phrase more effective?
    11·1 answer
  • Classify the following as cross-section or time-series data: Gross sales of 200 ice cream parlors in July 2009
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!