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
_____ formatting is the process of changing the way letters, numbers, punctuation marks, and symbols appear on the screen and in
MAXImum [283]
The answer would be character. " Character formatting is the process of changing the way letters, numbers, punctuation marks, and symbols appear on the screen and in print." Hope this helps!!
8 0
3 years ago
How to see how many words you have on google docs?
liberstina [14]
In the menu bar, click Tools > Word Count or hit Ctrl/Cmd + Shift + C.
4 0
3 years ago
Large computer programs, such as operating systems, achieve zero defects prior to release. Group of answer choices True False Pr
OLEGan [10]

Answer:

The answer is "False"

Explanation:

It is put to use Six Sigma had 3.4 defects per million opportunities (DPMO) from the start, allowing for a 1.5-sigma process shift. However, the definition of zero faults is a little hazy. Perhaps the area beyond 3.4 DPMO is referred to by the term "zero faults.", that's why Before being released, large computer programs, such as operating systems, must have no faults the wrong choice.

8 0
3 years ago
What is mean by cgi?
kifflom [539]

Answer:

CGI stands for common gateway interface. It is used in transferred information between world wide to the CGI program. As CGI program is the programming language which can be written in java , C and perl. It is a web server dynamically used with users. CGI is a standard used to create web pages by web servers.

4 0
3 years ago
KSJEDHGYGVWJHMJ,RHGFYDOYWUGWHBJK
Sophie [7]

Answer:

hmmm this seems sophisticated.

Explanation:

4 0
3 years ago
Other questions:
  • Which of the following is not a basic networking hardware component? Network interface card
    12·1 answer
  • Some financial institutions can be really bad about putting unexpected charges
    12·1 answer
  • Despite its vivid design, the website for Lolly's Bookstore did not seem to attract customers who lingered. In fact, most websit
    13·1 answer
  • All of the following are considered active job search methods EXCEPT _____. a. sending out resumes b. attending job training pro
    14·2 answers
  • A_____refers to the entire Excel file
    14·1 answer
  • Which tab in Microsoft Word provides access to the backstage view?
    8·2 answers
  • __________ requires unbiased and careful questioning of whether system elements are related in the most effective ways, consider
    15·1 answer
  • A technician is buying a PC that will host three VMs running at the same time with the current configuration. The technician bel
    5·1 answer
  • When the writer of a letter sends a copy to a third party without the knowledge of the person receiving the original letter, it
    11·1 answer
  • Shane is working on a new project for the sales department. The company wants a way to allow the sales force to print orders at
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!