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
Initially, later, and finally are examples of what kind of words
Klio2033 [76]
Im pretty sure that the correct answer is Transition words.
3 0
3 years ago
Which of the following is a trend that began during the Vietnam War and continued with the Internet?
Blizzard [7]
<span>As far as I remember, this one - a. a move toward stricter control of mass-media communications by Congress and the FCC </span><span>is a trend that began during the Vietnam War and continued with the Internet.</span>
7 0
3 years ago
after clicking the start button on your computer screen desktop what option would you then select to examine systems components
xenn [34]
You would click on control panel to get to that area
7 0
3 years ago
PYTHON --- Toll roads have different fees based on the time of day and on weekends. Write a function calc_toll() that has three
Oduvanchick [21]

The toll program illustrates the use of conditional statements;

As a general rule, conditional statements are used to make decisions

<h3>The toll program</h3>

The toll program written in Python where conditional statements are used to make several decisions is as follows:

def calc_toll(hour, morning, weekend):

   toll_fee = 0

   if weekend == False:

       if morning == True:

           if hour < 7:

               toll_fee+=1.15

           elif hour < 10:

               toll_fee+=2.95

           elif hour <= 12:

               toll_fee+=1.90

       else:

           if hour < 3:

               toll_fee+=1.90

           elif hour < 8:

               toll_fee+=3.95

           elif hour >= 8:

               toll_fee+=1.40

   else:

       if morning == True:

           if hour < 7:

               toll_fee+=1.05

           elif hour <= 12:

               toll_fee+=2.15

       else:

           if hour < 8:

               toll_fee+=2.15

           elif hour >= 8:

               toll_fee+=1.10

   return toll_fee

   

Read more about conditional statements at:

brainly.com/question/24833629

#SPJ1

3 0
2 years ago
which part of a computer takes the text and picture on your on your screen and prints them onto paper ​
inessss [21]

Answer:

Its the printer. The details shown on screen can be tested on monitor using the software like PDF and word processor. And from there you can format and finally get the hard copy of the document via printers.

Explanation:

Various kinds of the printers are available. And all of them take the text and pictures on the computer screen, and then print that on the paper. The details are in the answer section. And some of the examples of the printers are like dot matrix printer, laser printer etc.

4 0
3 years ago
Read 2 more answers
Other questions:
  • To type the letter address, _________ space from the dateline
    9·2 answers
  • c++ You are given an array A representing heights of students. All the students are asked to stand in rows. The students arrive
    5·1 answer
  • 1. Which of the following should NOT be in a tagline?
    12·1 answer
  • One of your professors has asked you to write a program to grade her midterm exams, which consist of only 20 multiple-choice que
    15·1 answer
  • You must. place a child in a federally approved child restraint device. if the child is
    5·2 answers
  • To delete only the selected contents of the table, but not the table itself, ____.
    7·1 answer
  • when working with smart which tab would provide the ability to change the shape or size of the smart art shapes
    15·2 answers
  • Which of the following examples can be solved with unsupervised learning?
    8·1 answer
  • Decision support systems help managers use structured data to identify problems and find solutions to business-related problems.
    10·1 answer
  • Which of the phases of the software development life cycle (SDLC) would the following action take place in?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!