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
Paraphin [41]
3 years ago
6

Write a class named Car that has the following fields: yearMode1. The yearModel field is an int that holds the car's year model.

make. The make field is a String object that holds the make of the car, such as "Ford" "Chevrolet", "Honda", etc. speed. The speed field is an int that holds the car's current speed. In addition, the class should have the following methods . Constructor. The constructor should accept the car's year model and make as ments. These values should be assigned to the object's yearModel and make fields. The constructor should also assign 0 to the speed field. Accessor. The appropriate accessor methods get the values stored in an object's yearModel, make, and speed fields. , accelerate. The accelerate method should add 5 to the speed field each time it is called _________. brake. The brake method should subtract 5 from the speed field each time it is called.
Computers and Technology
2 answers:
Gekata [30.6K]3 years ago
8 0
Skeh wkf ahfmroztdjdy
Dmgk
Ann Write a class named Car that has the following fields: yearMode1. The yearModel field is an int that holds the car's year model. make. The make field is a String object that holds the make of the car, such as "Ford" "Chevrolet", "Honda", etc. speed. The speed field is an int that holds the car's current speed. In addition, the class should have the following methods . Constructor. The constructor should accept the car's year model and make as ments. These values should be assigned to the object's yearModel and make fields. The constructor should also assign 0 to the speed field. Accessor. The appropriate accessor methods get the values stored in an object's yearModel, make, and speed fields. , accelerate. The accelerate method should add 5 to the speed field each time it is called _________. brake. The brake method should subtract 5 from the speed field each time it is called.
Harlamova29_29 [7]3 years ago
8 0
<h2>Answer:</h2>

//Write the class definition for the class Car

public class Car {

   //Declare the instance variables(fields)

   int yearModel;

   String make;

   int speed;

   

   //Declare the constructor: Make sure the constructor has  

   //the same name as the name of the class - Car.

   //The constructor receives two parameters - yearModel and make.

   //The parameters are then assigned to their respective fields.

   //The speed field is given a value of zero.

   public Car(int yearModel, String make){

       this.yearModel = yearModel;

       this.make = make;

       this.speed = 0;

   }

   //Accessor method - get - for the yearModel

   //returns the yearModel of the car

   public int getYearModel() {

       return yearModel;

   }

   //Accessor method - get - for the make

   //returns the make of the car

   public String getMake() {

       return make;

   }

   //Accessor method - get- for the speed

   //returns the speed of the car

   public int getSpeed() {

       return speed;

   }

   

   //Method accelerate() to increase the speed of the car by 5

   //each time it is called

   public void accelerate(){

       this.speed += 5;

   }

   

   //Method brake() to decrease the speed of the car by 5

   //each time it is called

   public void brake(){

       this.speed -= 5;

   }

   

}    //End of class declaration

<h2>Explanation:</h2>

The code above has been written in Java. It contains comments explaining the code. Please go through the comments. The actual lines of code that are executable are written in bold-face to distinguish them from the comments.

You might be interested in
Please select the word from the list that best fits the definition
Tasya [4]

Answer:

d

Explanation:

because it is

3 0
3 years ago
Read 2 more answers
Satellite images are based on data obtained by ____________ (gps/landsat) satellites.
skelet666 [1.2K]
<span>Satellite images are based on data obtained by landsat satellites. </span>
8 0
3 years ago
If a user wants to add an expansion card to increase the memory of a computer, where should the user insert the card?
uysha [10]

into a port on the outside of the computer


6 0
3 years ago
Read 2 more answers
GenXTech is a growing company that develops gaming applications for military simulations and commercial clients. As part of its
ki77a [65]

Answer:

an enterprise architecture

Explanation:

Based on the information provided within the question it can be said that in this scenario it seems that GenXTech is creating an enterprise architecture. This is a blueprint made for a company that illustrates and defines all the finer details regarding the structure and operation of an organization, as well as where the organization should be heading in order to achieve the business goals that have already been set.

6 0
2 years ago
Determine whether the compound condition is True or False.
Vlada [557]

The  compound condition are:

  • 7<12 or 50!=10 is false
  • 7<12 and 50<50 is false
  • not (8==3) is true

<h3>What is compound condition?</h3>

A compound statement is known to be one that shows up as the body of another statement, e.g. as in if statement.

The  compound condition are:

  • 7<12 or 50!=10 is false
  • 7<12 and 50<50 is false
  • not (8==3) is true

Learn more about compound condition  from

brainly.com/question/18450679

#SPJ1

8 0
1 year ago
Other questions:
  • How do I connect my CSS file and HTML page together? it's just not wanting to work for me. 
    5·1 answer
  • Cobbling together elements from the previous definition and whittling away the unnecessary bits leaves us with the following def
    7·1 answer
  • Write the method public static doublell quizAverages (double (1 scores). which takes a 2D array of doubles that represent quiz s
    11·1 answer
  • Which hypervisor works on older pcs without hardware virtualization support?
    9·2 answers
  • How many pieces can be connected on to a to an SPS​
    11·1 answer
  • What is the result when you run the following line of code after a prompt??
    5·1 answer
  • You do not have to move your fingers to click the top row reach keys.<br> 1. True <br> 2. False
    15·1 answer
  • Which of the following statements is true for DMA: (only one correct answer) A. In DMA, Processor checks status until the operat
    9·1 answer
  • Describe how a user would interact with a smart-phone to do various tasks.Consider inputs and outputs.
    12·1 answer
  • WILL GIVE BRAINLIEST!!! Danielle is warehouse supervisor for a large shipping company. Most shipments need to leave the warehous
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!