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
Sloan [31]
3 years ago
6

Write a class named Car that has the following member variables: - yearModel. An int that holds the car’s year model. - make. A

string that holds the make of the car. - speed. An int that holds the car’s current speed. The class should have the following member functions: - Appropriate accessor functions to get the values stored in an object’s yearModel, make, and speed member variables. - accelerate function that adds 5 to the speed member variable each time it is called. - brake function that subtracts 5 from the speed member variable each time it is called.
Computers and Technology
1 answer:
Wewaii [24]3 years ago
6 0

Answer:

public class Car {

//Member variables    

private int yearModel;

   private String make;

   private int speed;

   //Constructor

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

       this.yearModel = yearModel;

       this.make = make;

       this.speed = speed;

   }

   //Accessor Methods getters and setters

   public int getYearModel() {

       return yearModel;

   }

   public void setYearModel(int yearModel) {

       this.yearModel = yearModel;

   }

   public String getMake() {

       return make;

   }

   public void setMake(String make) {

       this.make = make;

   }

   public int getSpeed() {

       return speed;

   }

   public void setSpeed(int speed) {

       this.speed = speed;

   }

   //Accelerate function

   public void accelerate(){

       this.speed+=5;

   }

   // Brake function

   public void brake(){

       this.speed-=5;

   }

}

Explanation:

  • As required by the question, The class Car is created using Java programming language
  • The members variables, the constructor, The accessor methods are all created as required by the question (Please pay attention to the comments added to the code)
  • The accelerate and brake functions that add and subtract 5 from the speed member variable respectively are also created.
You might be interested in
Choose all items that represent HTML characteristics.
hram777 [196]

Answer:

A,C,D,E are the answers at least on the test i took

Explanation:

3 0
3 years ago
Read 2 more answers
The darker shadow of an eclipse is called the penumbra.<br><br> True<br><br> False
Kryger [21]
The correct answer for your  question is true, Hope this helps
8 0
3 years ago
Show the steps of a Selection Sort for the numbers ( 5 3 9 5 ).
Sedbober [7]

Answer:

Sorted array will be:-

3 5 5 9

Explanation:

In Selection Sort algorithm it sorts the array by repeatedly finds the minimum in the array form the array that is unsorted and swaps it with the value at the first position.

The unsorted array:- 5 3 9 5

In first iteration

minimum is 3.

3 will be swapped with 5.

Now the array is 3 5 9 5

sorted array 3

In second iteration

unsorted array is 5 9 5

sorted array 3 5

and the minimum from it is 5

No swapping will occur.

In third iteration

unsorted array is 9 5

minimum is 5

sorted array 3 5 5

swap it with 9.

Now the array is sorted.

3 5 5 9

3 0
3 years ago
The main path of the Internet along which data travels the fastest is known as the Internet ________. Group of answer choices
Svetradugi [14.3K]

Answer:

<em>Internet backbone</em>

Explanation:

The internet backbone is made up of multiple networks from multiple users. It is the central data route between interconnected computer networks and core routers of the Internet on the large scale. This backbone does not have a unique central control or policies, and is hosted by big government, research and academic institutes, commercial organisations etc. Although it is governed by the principle of settlement-free peering, in which providers privately negotiate interconnection agreements, moves have been made to ensure that no particular internet backbone provider grows too large as to dominate the backbone market.

7 0
3 years ago
Stacy is in the process of creating a storyboard for her personal website, but she is unable to decide which storyboarding techn
Shalnov [3]

Answer:

Webbed storyboard technique

Explanation:

There are several storyboard techniques; however, the best for a website is the webbed storyboard technique.

Coined from the word "web", this technique does not only help in linking pages within the website where a page can be access from other pages, it also links pages of the website to external pages.

An illustration is as follows:

From the homepage of a website, one can access the contact page, the about page, etc.

Each of the listed pages also have link back to the homepage and to every other pages.

5 0
2 years ago
Other questions:
  • What's a qat on a computer
    12·2 answers
  • List of functional programming languages
    6·1 answer
  • ________ is a dot on the screen that contains a color.
    11·1 answer
  • Which of the statements below are true about Digital Signatures?
    15·1 answer
  • Which line in the following program contains the header for the showDub function? 1 #include 2 using namespace std; 3 4 void sho
    9·1 answer
  • Mary can view the thumbnails of her presentation slides when she’s creating the slides which element of the programs interface i
    8·1 answer
  • True or False: Mapping annotations are exclusive - an annotated method will only be accessible to requests sent to a matching UR
    14·1 answer
  • Custom actions help your users by
    6·1 answer
  • Hannah wants to write a book about how scientists and society interact, and she has generated ideas for chapters. Which chapter
    13·1 answer
  • Explain any two types of board band connection​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!