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
Give an example of an outdated memory or storage device what do you think they are outdated
andreev551 [17]

Answer:

HDD technology

Explanation:

You will find that there is a big difference between the SSD and the HDD. The SSD lists out the technical advantages as well as the disadvantages related to HDD, and this has led to the wide use of the SSD rather than the HDD, which is supposed by many being an outdated product. You will find that the SSDs last longer, and they are faster. However, the SSD is more prone to damages as compared to HDD. However, SSD looks like being more advanced considering the above-mentioned advantages, and fewer number of disadvantages. And hence, many people shifted to the SSD from HDD. Remember, SSD stands for solid state drives. And HDD means hard disk drive.

8 0
3 years ago
________ employees state-of-the-art computer software and hardware to help people work better together.
natulia [17]

The correct answer is collaborative computing

Using state-of-the-art computer software and hardware to help people work better together is known as collaborative computing. Goal setting and feedback will be conducted via Web-based software programs such as eWorkbench, which enables managers to create and track employee goals.

6 0
3 years ago
Write all the hexadecimal numbers in sequence from 9F7H to A03H
Harlamova29_29 [7]

Answer:

(9F7, 9F8, 9F9, 9FA, 9FB, 9FC, 9FD, 9FE, 9FF, A00, A01, A02, A03)

Explanation:

(9F7)_{16} =  (2551)_{10}

(A03)_{16} = (2563)_{10}

This means that we must find all hexadecimal values from 2551 to 2563, or 9F7 to A03. You can convert from decimal to hexadecimal for each one, or just count.

5 0
2 years ago
Digital subscriber lines: are very-high-speed data lines typically leased from long-distance telephone companies. are assigned t
V125BC [204]

Answer: Operate over existing telephone lines to carry voice, data, and video.

Explanation:

Digital subscriber line is a means of transferring high bandwidth data over a telephone line. Such data could be a voice call, graphics or video conferencing. DSL uses a user's existing land lines in a subscriber's home, allowing users to talk on a telephone line while also being connected to the Internet. In most cases, the DSL speed is a function of the distance between a user and a central station. The closer the station, the better its connectivity.

5 0
3 years ago
Rick needs to find the lowest number in a set of numbers that includes decimals. Which statistical function in a spreadsheet wil
professor190 [17]
Umm

I’m in 10th grade so.....what is a spreadsheet and statistical function
4 0
3 years ago
Read 2 more answers
Other questions:
  • Prompt the user for an automobile service. Each service type is composed of two strings. Output the user's input. (1 pt) Ex: Ent
    9·1 answer
  • What is the first step to creating a PivotTable?
    11·1 answer
  • Which type of microscope can only be used to view non-living specimens?
    10·2 answers
  • When compared to traditional desktop customers, why are mobile phone users much more likely to book a room or airline reservatio
    12·1 answer
  • What PowerShell command can be used to clean up old update files on a WSUS server, including unused update files, old revisions,
    10·1 answer
  • At each layer of the OSI model, data is appended to the original message and then sent on to the next lower layer. What is this
    10·1 answer
  • An algorithm that could execute for an unknown amount of time because it depends on random numbers to exit a function may:______
    13·1 answer
  • What will you see on the next line?
    6·2 answers
  • HELP ME?!!?!?!?!?!?
    9·2 answers
  • TRUE OR FALSE: THE BUILDER'S CLUB IS A PAID SUBSCRIPTION.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!