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
Yanka [14]
3 years ago
15

Design a class named Car that has the following fields:

Computers and Technology
1 answer:
snow_tiger [21]3 years ago
4 0

Answer:

// The class car is defined

public  class Car {

  // instance variable yearModel

  private int yearModel;

  // instance variable make

  private String make;

  // instance variable speed

  private int speed;

 

  // empty constructor

  // with instances inside it

  // the instances are from the question

  public Car(){

      yearModel = 2000;

      make = "Nissan";

      speed = 4;

  }  

  // overloaded constructor

  // constructor defined with three arguments

  public Car(int yearModel, String make, int speed) {

      // the arguments are assigned to the object's variable

      this.yearModel = yearModel;

      this.make = make;

      this.speed =speed;

  }

  // setter(mutator) method

  public void setYearModel(int yearModel){

      this.yearModel = yearModel;

  }

  // setter(mutator) method

  public void setMake(String make){

      this.make = make;

  }

  // setter(mutator) method

  public void setSpeed(int speed){

      this.speed = speed;

  }

  // getter(accessor) method

  public int getYearModel(){

      return yearModel;

   }

  // getter(accessor) method

  public String getMake(){

      return make;

   }

  // getter(accessor) method

  public int getSpeed(){

      return speed;

   }  

  // toString is override to display the car object properties

  public String toString(){

      return "Car's year model: " + getYearModel() + ", make: " + getMake() + ", speed: " + getSpeed();

  }

}

Explanation:

The code is well commented.

You might be interested in
Over the past three hours the pressure has been steadily increasing at a rate of what
Lyrx [107]

Answer:

We need to find first the location, and then we need to note down the barometric pressure of each hour in tenth place without decimal like 1013.3 mb is equal to 133 and so on. And the rate can be steadily increasing, steady, steadily decreasing, steadily increasing and then falling, steadily falling and then increasing, and so on. To find the rate of increase in barometric pressure, we need to find the rate of change of barometric pressure, and this will be clear if we prepare the chart of the barometric pressure of each hour during the past three hours. The graph plotted will give us a clear indication through its slope.

Explanation:

Please check the answer.

3 0
4 years ago
from january 2005 through july 2015, approximately how many electronic data records in the United States were breached, exposing
Brums [2.3K]
From January 2005 through July 2017, approximately 853 million electronic data records in the US were breached.
This allowed the attackers to take control over people's personal data, such as their various credit card numbers, and other important data, as well as their addresses, etc. The cyber police, as well as the regular police have been working hard to stop this from happening, but the hackers are very strong and smart.
4 0
3 years ago
Robert's got a quick hand
Alina [70]
verry
good
song
love
it
6 0
3 years ago
Read 2 more answers
Which of these is a way that a doctor can examine a patient?
SIZIF [17.4K]

Answer:

D. all the above

Explanation:

because doctor uses stethoscope to listen patients heart, he also used hammer to check patients reflexes and also doctor has to listen to the patient.

5 0
3 years ago
Definition of Computer forensics?
zysi [14]

Answer:

Computer forensics is the application of investigation and analysis techniques to gather and preserve evidence from a particular computing device in a way that is suitable for presentation in a court of law. The goal of computer forensics is to perform a structured investigation and maintain a documented chain of evidence to find out exactly what happened on a computing device and who was responsible for it.

Explanation:

If this helped you, please consider brainly.

Thank you ,

Miss Hawaii

5 0
3 years ago
Read 2 more answers
Other questions:
  • A __________ network is good for connecting computers over boundaries.
    6·2 answers
  • While in slide show mode, if you are not careful you can close the application by clicking the x on the menu bar. question 38 op
    12·2 answers
  • Which of the following is not true about designing classes? In order for class information to be printed instead of a memory add
    12·1 answer
  • Technology has proliferated in Kenya and Somaliland, with text messages used to replace cash, creating mobile money use that, on
    11·1 answer
  • Write a function all_cats that consumes a comma-separated string of animals and prints whether all of the animals have "cat" in
    12·1 answer
  • What are two options available for highlighting changes in the Highlight Changes dialog box?
    11·2 answers
  • Why do many experts recommand longer time horizonal if you are doing high risk investment
    7·1 answer
  • Question 1 (3 points)
    6·2 answers
  • Can someone reply me
    11·1 answer
  • Multiple Select Which of these are ways a hacker might learn someone's password? Select 3 options. o social engineering keylogge
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!