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
Which part of an I-statement involves a description of your needs or feelings?
kherson [118]

The part of an I-statement that involves a description of your needs or feelings is the Feelings Statement.

The feelings statement is a description of your feelings that is linked to a particular situation. Vague feelings often create frustration in the listener.

5 0
4 years ago
Https://www.blooket.com/play?id=300932<br> please
padilas [110]

Answer:

Okay, I will play with you

3 0
3 years ago
Read 2 more answers
Input header here<br>input paragraph 1 here
konstantin123 [22]

Answer:

The <input> HTML element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent. The <input> element is one of the most powerful and complex in all of HTML due to the sheer number of combinations of input types and attributes.

Explanation:

3 0
3 years ago
Which of these network connections would allow your smartphone to sync your photos to your online account? Choose all that apply
Anika [276]

Answer:

A & D

Explanation:

Wifi or IEEE 802.11a/n/g  is a wireless network medium used for communication between devices in a network (or the internet). It is used to transfer video, text, graphic, audio and all other types of files.

Cellular is a mobile networking technology used to make wireless communication over a large area of land called cell, between devices in a network or a remote network.

Both cellular and wifi connections are used to synchronize smartphones to online accounts and allows for data backup and retrieval.

5 0
3 years ago
Which is most likely to cause confusion, hinder thinking, and prevent quick access to resources in a study environment? phones c
OverLord2011 [107]
Clutter will cause the most problems when you are trying to study because <span>If you’re unable to get through the material clogging up your </span>neural<span> networks, so the theory goes, you’ll be slower and less efficient in processing information. As a result, you’ll be incapacitated when it comes to short-term memory tasks, and even in longer-range mental exercises when you have to come up with information you should know, such as names of people, that you can no longer find within your disorganized repository of knowledge.

Hope this helps, 

kwrob</span>
3 0
4 years ago
Read 2 more answers
Other questions:
  • The mass of a textbook is about 1.25 kilograms. Aproximately, how many ounces is this?
    10·1 answer
  • Why is it important to save a print copy of electronic sources?
    6·1 answer
  • A ________ is a container that provides quick access to elements at the front and the back of the list
    6·1 answer
  • A contractor is preparing a bid to install swimming pools at a new housing addition. The estimated time to build the first pool
    12·1 answer
  • Please label the parts its urgent Best answer receives a brainliest and 20 points please i need it :) :) ​
    5·2 answers
  • Write a Java application that uses the Math class to determine the answers for each of the following: a. The square root of 37 b
    10·1 answer
  • In Microsoft Word you can access _ the command to the mini toolbar
    14·2 answers
  • What is analog computer?​
    14·1 answer
  • Jettison folk 2007, Magnum opus, be moving, offers poisoned commentary on the film industry.
    7·1 answer
  • What does c++ programming mean?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!