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
Which windows command always navigates the command-line interface back to the root directory?
Pie
The answer is "cd \".
5 0
3 years ago
Stuff that's displayed on a web page (Has to be 7 characters) (third letter is N, and fifth letter is E) little urgent
melomori [17]

Answer:

content

Explanation:

3 0
3 years ago
#Electrical Engineering
GrogVix [38]

Answer:

yes

Explanation:

where's our question

5 0
3 years ago
What is the most complex part of a PC?
rjkz [21]

Answer:

From a hardware standpoint, the CPU is most likely the main component. From a software standpoint, macOS and Windows are complex software systems.

Explanation:

6 0
2 years ago
patty works at Mcdonald's as a chef. it is her job to make hamburgers as each order arrives on her computer screen. one day patt
il63 [147K]
Angela should make sure the hamburger patty is disposed of and a new one prepared for the hamburger. She should reprimand Patty as what she did is wrong. Patty could well be fired for what she did. It is unsafe and unsanitary to give a customer food that has fallen on the floor. Angela should make sure this never happens again.

4 0
3 years ago
Read 2 more answers
Other questions:
  • This type of connection uses radio waves to connect devices on a network.
    9·2 answers
  • Person-name: String+setName(String name): void+getName(): String^Student-studentID: long+Student(String sname, long sid)+setID()
    10·1 answer
  • Assume that there is a class called BankAccountHolder that represents an individual member of a bank. There is also a BankAccoun
    5·2 answers
  • Stating a document is PDF or XPS document refers to document _______​
    10·1 answer
  • Consider the following program where the zu format specifier is used to display as an integer the result of sizeof. #include #in
    11·1 answer
  • What do the following standards cover?
    7·1 answer
  • What will be the results of executing the following statements? x.setEditable(true); x.setText("Tiny Tim"); a. The text field x
    7·1 answer
  • Question 21 pts How many lines should an email signature be? Group of answer choices "5 to 6" "7 to 8" "1 to 2" "3 to 4"
    10·1 answer
  • KAPWING Video Editing Software allows you to use existing You Tube Videos in your design.
    8·1 answer
  • Consider the following code:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!