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
What are the advantages to using a linked implementation as opposed to an array implementation?
aalyn [17]

Answer:

 The main advantage of using the linked implementation over the array implementation are:

  • In linked list, the size of list does not need to be mention initially in the program in dynamic memory deallocation and allocation.
  • We can easily add new elements and nodes in the linked list as there is no size limit.
  • We can easily insert and also remove the elements and nodes in the linked list without re-organize the complete structure. As, the information do not need to be stored in the memory. On the other hand, array implementation takes maximum time as compared to linked list.  

5 0
3 years ago
A _____ captures the pattern in a _____ and sends it to the computer, where special software translates the _____ into meaningfu
g100num [7]

Answer:

A bar code reader scanner captures the pattern in a barcode and sends it to the computer, where special software translates the pattern into meaningful data.

Explanation:

A barcode reader is a handheld device that captures and reads information that is contained in a bar code. It consists of a scanner, a decoder and a cable that connects the barcode reader into a computer. This scanner works by directing a beam or red light across the black and white elements of a barcode. This amount of light energy that is reflected back is measured and converted into electrical energy which is then converted into readable data by the decoder and forwarded to a computer.

4 0
3 years ago
Assume that a variable variable, number Of Sides has been initialized. Write a statement that assigns the value True to the vari
inna [77]

Answer:

public class ANot {

   public static void main(String[] args) {

   

       int numberOfSides = 20;

       boolean isQuadrilateral;

       if(numberOfSides==4){

           isQuadrilateral = true;

           System.out.println("The triangle is quadrilateral");

       }

       else{

           isQuadrilateral=false;

           System.out.println("The triangle is not quadrilateral");

       }          

}

}

Explanation:

  1. Create and Initilize the int  variable numberOfSides (You can also receive this from a user using the scanner class for example).
  2. create a boolean variable isQuadrilateral
  3. Use if and else statement to check if numberOfSides ==4 and assign true to isQuadrilateral else assign false
7 0
3 years ago
Whats an MAR? lolz better not take my points #bonkers
GaryK [48]

Answer:

\huge\mathcal{\fcolorbox{aqua}{azure}{\red{✿ʏᴏᴜʀ- ᴀɴsᴡᴇʀ ♡❖}}}

<em><u>A Medication Administration Record (MAR, or eMAR for electronic versions), commonly referred to as a drug chart, is the report that serves as a legal record of the drugs administered to a patient at a facility by a health care professional. The MAR is a part of a patient's permanent record on their medical chart</u></em>

4 0
2 years ago
Read 2 more answers
See the file attached!​
Dimas [21]
  1. Mail Merge is a handy feature that incorporates data from both Microsoft Word and Microsoft Excel and allows you to create multiple documents at once, such as letters, saving you the time and effort of retyping the same letter over and over.
  2. The Mail Merge feature makes it easy to send the same letter to a large number of people.
  3. By using Mail Merge, we don't have to type each recipient's name separately in each letter.
  4. We need to proofread only the main document network database systems object- oriented database system Hierarchical database system.
6 0
2 years ago
Other questions:
  • Below is a chart representing portions of resumes from 3 applicants. Which best explains the applicants careers?
    11·1 answer
  • For selection purposes, it is critical that application items have a proven relationship between a selection device and some rel
    5·1 answer
  • In the code segment below, assume that the int variable n has been properly declared and initialized. The code segment is intend
    5·1 answer
  • Each of the outcomes listed below is a result of executing the following script except for one. Which one? CREATE ROLE ExampleRo
    6·1 answer
  • What is ambiguous grammar, explain in maximum 50words.
    5·1 answer
  • Write a C++ program that determines if an integer is a multiple of 7. The program should prompt the user to enter and integer, d
    13·1 answer
  • What are some things all boomers say.
    12·2 answers
  • As marketing manager, you need to have ( blank) skills and (blank) skills.
    11·1 answer
  • James root lol ........................
    12·1 answer
  • Francisco is becoming a dad for the first time. He feels relatively clueless about all things involving parenting and is looking
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!