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
In order to look up ipv4 and ipv6 dhcp leases, what two files should be viewed?​
Zigmanuir [339]
The answers are  /var/lib/dhcpd/dhcpd.leases   &                                                                       /var/lib/dhcpd/dhcpd6.leases
In order to look up ipv4 and ipv6 dhcp leases, The two files that should be viewed are  /var/lib/dhcpd/dhcpd.leases &  /var/lib/dhcpd/dhcpd6.leases                                             
7 0
3 years ago
____ map a set of alphanumeric characters and special symbols to a sequence of numeric values that a computer can process.
Neporo4naja [7]
The answer is : coding schemes
4 0
3 years ago
What Network does zoom run on? Does anyone use it (hint Hint)
rewona [7]

Answer:

  • The bandwidth used by Zoom will be optimized for the best experience based on the participant's' network. It will automatically adjust for 3G, WiFi, or wired environments.
  • i use g00gle meet bc zoom does not work on my school macbook...

Explanation:

:)

3 0
3 years ago
Which of the following is primarily operated by a touchscreen?
LUCKY_DIMON [66]

Answer: The correct answer is Mobile device

Explanation:

A Mobile device is any portable equipment that can be easily connected to an internet. Example of mobile devices include; smart phones, palmtop, smart watch and other computer gadgets. The use of touchscreen for input or output on mobile devices can not be overemphasized. Mobile devices are handy and can be used for making work easy. As such, in order to effectively use mobile devices, touchscreen can be primarily used.

4 0
3 years ago
Rebecca has finished with the research and outline portion of her slide presentation now the next logical step is to begin worki
e-lub [12.9K]

Answer:

The answer is creating and layout and template style

Explanation:

APEX VERIFIED just did it

4 0
3 years ago
Read 2 more answers
Other questions:
  • Macy reviewed Steve's presentation. Images in the slides were distracting from the presentation. What advice should
    7·2 answers
  • 25 Points Discuss games you have played that have poor game design puzzles and how you might improve them.
    10·1 answer
  • Elisa and Josh need to access General Help. Elisa will press the F1 key. Josh will click on ? in the upper-right corner of the W
    14·2 answers
  • In 1-2 sentences, describe some keyboard shortcuts you have used during this lesson to save you time.
    13·2 answers
  • Clunker Motors Inc. is recalling all vehicles in its Extravagant line from model years 1999-2002 as well all vehicles in its Guz
    15·1 answer
  • What are the cues that a website is safe to use for exchanging sensitive information?
    10·1 answer
  • Which of the selections below represents a recursive query?
    12·1 answer
  • Search..
    14·1 answer
  • I need neveahbowe to see this.
    10·1 answer
  • 30 Points!!
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!