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 Game Theory?
AleksandrR [38]

Answer:

the branch of mathematics concerned with the analysis of strategies for dealing with competitive situations where the outcome of a participant's choice of action depends critically on the actions of other participants

Explanation:

In simple terms Game theory is the study of how and why people make decisions.

8 0
3 years ago
The elements of an integer-valued array can be set to 0 (i.e., the array can be cleared) recursively as follows: An array of siz
dangina [55]

Answer:

The method definition to this question can be given as:

Method definition:

public void clear(int[] arr, int num) //define method clear.

{

   if (num == 0) //if block

{

       return 0;  return value.

}

else //else block

{

 arr[num - 1] = 0; //assign value in arr.

return arr[];  //return value.

}

}

clear(arr, num - 1);   //calling

Explanation:

The description of the above method definition as follows:

  • Firstly we define a method that is "clear" that does not return any value because its return type is "void". This method accepts two integer variables that are "arr[] and num" where arr[] is an array variable and num is an integer variable.
  • Inside a method, we use a conditional statement in if block we check that num variable value is equal to 0. if this condition is true so, it will return 0 otherwise it will go to else block in else block it will assign value in variable arr[num-1] that is "0" and return arr value.

4 0
4 years ago
Two of the major sources used today for obtaining information to create computer maps are satellites and _____________.
nikdorinn [45]
The Global Positioning System or GPS.
7 0
3 years ago
Read 2 more answers
1. This are tools used to make any presentation interesting and exciting.
larisa [96]

Answer:

c. hyperlinks

Explanation:

The correct option is - c.hyperlinks

Reason -

The "hyperlink" function in PowerPoint allows users to advance from one slide to another slide in the presentation when they click on a predetermined word, shape, or image, thereby allowing for a more dynamic and interactive experience than can be obtained with serial presentation of slides alone.

4 0
3 years ago
Consumer protection laws are meant to
lord [1]
B) prevent unfair or deceptive business practices.
5 0
3 years ago
Other questions:
  • A​ ___________ identifies the content and purpose of the​ visual, along with whatever label and number​ you're using to refer to
    15·1 answer
  • Having one password for all accounts is an easy way to remember passwords, but it will expose you to what risk?
    15·1 answer
  • Assume that PrecinctReport is a structured type with these fields, address (a string), and three int fields which are counts of
    9·1 answer
  • The UNIX system does not attempt to avoid cycles. Instead, it restricts access to the linking capability of the system. Normal u
    11·1 answer
  • What are three recommendations for reducing risk and improving the privacy of your personal information while using social media
    13·1 answer
  • Rachel needs to include a new organizational chart in her project. Which type of illustration should she use?: *
    11·1 answer
  • create a function that draws a certain number of spaces, followed by a certain number of stars, followed by a newline.
    6·1 answer
  • Can some one help me answer this question plz
    8·1 answer
  • Enter the word that belongs in the blank:
    13·1 answer
  • With software prefetching, it is important to be careful to have the prefetches occur in time for use but also to minimize the n
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!