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
How does technology improve productivity at home? (Select all that apply.)
Aliun [14]

Answer:

B, C

Explanation:

?

5 0
3 years ago
Which of these is NOT an example of lifelong learning?
oee [108]

Answer:

B. having lunch with a friend

Explanation:

Lifelong learning can be defined as a continuous, self-motivated, and self-initiated learning activity that is typically focused on personal or professional development. Thus, it's a form of education that is undertaken throughout life with the sole aim of pursuing knowledge, competencies, and skills for either personal or professional growth and development, especially after acquiring a formal education.

Some examples of lifelong learning includes the following;

I. Reading a trade magazine.

II. Reviewing a textbook.

III. Studying an encyclopedia.

7 0
2 years ago
You may declare an unlimited number of variables in a statement as long as the variables are ____.
k0ka [10]

Answer:

b. the same data type

Explanation:

Any number of variables can be declared in a statement as long as the variables have the same data type. For example:

1) int a,b,c,d,e;

Here each of the declared variables a,b,c,d,e have the type int.

2) char p,q,r,s,t,u,v,w;

In this case variables p to w all have the type char.

3) float x,y,z;

x,y and z are all of type float.

6 0
3 years ago
Write a computer program to tell if the number is even or odd please
vovikov84 [41]
There you go :) Written in C# you can add using tags yourself I believe

3 0
3 years ago
A light rag is striking the surface of earth. Which factor would make the light ray more likely to be absorbed than reflected?
Sergeu [11.5K]

Answer:

The answer is D.

Explanation:

because the other answers doesn't make sense.

6 0
3 years ago
Other questions:
  • How would a programming language that allows programs to run on any operating system be classified?
    11·1 answer
  • Why should you log out when you finish an online session?
    9·1 answer
  • Which of the following is 1000 of a second​
    15·1 answer
  • Grandma Ester normally gives you hugs for your birthday - one for every year old you are. When you turned 15, she squished you w
    8·1 answer
  • <img src="https://tex.z-dn.net/?f=6.372%20%5Ctimes%2075%20find%20the%20product" id="TexFormula1" title="6.372 \times 75 find the
    6·1 answer
  • Marla wants to transfer photos from her digital camera to her computer. She has plugged the camera's cord into the USB port. Wha
    11·2 answers
  • The security administrator for Corp.com wants to provide wireless access for employees as well as guests. Multiple wireless acce
    11·1 answer
  • Which feature is not in ms PowerPoint​
    12·1 answer
  • Suppression of politically or socially unacceptable co
    5·1 answer
  • This might sound crazy! But please help.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!