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
Low-end CRM systems are designed for companies like Boeing because they only have a few, large customers.
Arlecino [84]

Answer: False

Explanation:Low-end CRM system are specifically designed for those companies which are small scale but can connect to many businesses or organization at a time. These are the customer relationship management system that happens to analyze the functioning of the business with high count of small companies with appropriate amount of customers.Thus, the statement given is false.

6 0
2 years ago
Ideally, Internet of Things (IoT) devices have the ability to:
Stella [2.4K]

Answer:

I believe the answer would be D

8 0
2 years ago
Question 3 / 5
Andrej [43]

Answer:

False

Explanation:

3 0
3 years ago
Interactive sites where users write about personal topics and comment to a threaded discussion are called A. networking sites. B
Viefleur [7K]

The answer is definitely C: Blogs.

Blog is somewhat very similar to a website. It is sort of a journal that is mostly maintained by one person, the blogger. They are updated regularly and can contain information related to a specific topic. In most cases, blogs are used as dairy diaries about politics, people’s personal lives, or social commentaries. They give you, as a blogger, opportunities to interact with your visitors while promoting your products.

3 0
3 years ago
Read 2 more answers
Christopher is part of a film production. His job is to analyze the movie script and create a shooting schedule. What is Christo
Oksi-84 [34.3K]
I am pretty sure he would be the production manager
3 0
3 years ago
Read 2 more answers
Other questions:
  • What step can Miguel take to solve his dilemma? Miguel is working on a project that requires him to switch back and forth freque
    12·2 answers
  • N, or central processing unit, is also known as the
    10·2 answers
  • Question # 4
    8·2 answers
  • Write a program that has an array of at least 50 string objects that hold people’s names and phone numbers. The program then rea
    12·1 answer
  • A special type of loans for houses
    9·2 answers
  • Are the blank space around the edges of the page
    5·1 answer
  • View which is used to specify the tables fields , their data types and properties ​
    9·2 answers
  • Electronically, or on paper draw a Binary Search Tree using the values below. Note: Insert each value into the tree in order fro
    12·1 answer
  • Explain the different type of shift register counter ​
    14·1 answer
  • 5. An external CSS file is saved with D. Answer the following questions. 1. Explain the purpose and advantages of using CSS.​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!