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
Scorpion4ik [409]
3 years ago
13

Write the code that creates a public class named Vehicle that has one private data member. The private data member is an integer

variable named modelYear. Create two constructors: Code a constructor that has no parameters and initializes the modelYear variable to 2018. Code a constructor that has one parameter and uses that parameter value to update the modelYear variable.
Computers and Technology
1 answer:
maxonik [38]3 years ago
3 0

Answer:

Following are the program in java

public class Vehicle // class vehicle of type public

{

private int modelYear;

Vehicle() //  no parameters

{

modelYear=2018;

}

vehicle(int t)  // update the value of modelYear

{

modelYear=t;

}

public static void main(String args[]) // main function

{

vehicle ob=new vehicle();// creating instance

vehicle ob1=new vehicle(45);

}

}

Explanation:

Here we create a private data member i.e modelYear of integer type .

We create default constructor and initializes modelYear variable  with 2018.

we create a parametrized constructor  which update the value of modelYear variable.

From the main function we call both the constructors.

You might be interested in
What is occurring when an attacker manipulates commonplace actions that are routinely performed in a business?
serg [7]

Answer:

Vulnerable business processes, also called business process compromise (BPC), occurs when an attacker manipulates commonplace actions that are routinely performed.

4 0
3 years ago
I need some help pleas hurry
Alexandra [31]
Opinion is the answer, every thing else can be compared with the data
8 0
2 years ago
What would be the most popular piece of technology on Earth?
spin [16.1K]

Answer:

the smart phone

Explanation:

It is the most widley used and accepted

8 0
3 years ago
Read 2 more answers
The keywords used in programming languages that use decisions to redirect the flow of a program are called __
olchik [2.2K]
The keywords used in programming languages that use decisions to redirect the flow of a program are called control structures.
6 0
3 years ago
When mysql automatically converts one data type to another, itâs known as a/an ______________________ conversion?
lubasha [3.4K]
<span>MySQL is an open-source relational database management system (RDBMS)</span>
When MySQL automatically converts one data type to another, is known as an implicit conversion. Implicit conversion refers to the mixing and matching data types within the same operation. Example for implicit conversion is when MySQL automatically converts numbers to strings and vice versa. 
5 0
3 years ago
Other questions:
  • Which of the following is the best definition of a workplace policy?
    13·2 answers
  • Does time complexity depend on, which base arithmetic you use? like base 10, 2 or whatever else? Does time coplexity depned on t
    13·1 answer
  • Would anyone know this
    10·2 answers
  • Suppose that the domestic production of computer games creates enjoyment for those who play the games. Domestic production of co
    14·1 answer
  • Which of the following statements are true of software engineers? Check all of the boxes that apply. They are responsible for wr
    11·2 answers
  • What is Patch tool ???<br><br>​
    15·2 answers
  • The valid call to the function installApplication is
    5·1 answer
  • If you have 128 oranges all the same size, color, and weight except one orange is heavier than the rest. Write down a C++ Code/A
    7·1 answer
  • Discuss at least 1 Microsoft Windows security features that could protect data?
    5·1 answer
  • Give an idea of a law u would like to create
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!