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
Gekata [30.6K]
3 years ago
12

Design a class named Car that has the following fields:

Computers and Technology
1 answer:
Archy [21]3 years ago
3 0

Answer:

public  class Car {

   private int yearModel;

   private String make;

   private int speed;

   

   public Car(){

       yearModel = 2000;

       make = "Nissan";

       speed = 4;

   }

   

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

       this.yearModel = yearModel;

       this.make = make;

       this.speed =speed;

   }

   

   public void setYearModel(int yearModel){

       this.yearModel = yearModel;

   }

   public void setMake(String make){

       this.make = make;

   }

   public void setSpeed(int speed){

       this.speed = speed;

   }

   

   public int getYearModel(){ return yearModel; }

   public String getMake(){ return make; }

   public int getSpeed(){ return speed; }

   

   public String toString(){

       return "Car's year model: " + getYearModel() + ", make: " + getMake() + ", speed: " + getSpeed();

   }

}

Explanation:

<em>Variables</em> are declared.

<em>No-arg constructor</em> is created with default values.

<em>A constructor with parameters</em> is created.

The required <em>set methods</em> and <em>get methods</em> are created.

<em>toString</em> method is created to return car's specifications.

You might be interested in
Discuss about the main frame computer​
Nimfa-mama [501]

Answer:

Mainframes (also called "big iron")[1] are powerful computers used for large information processingjobs. They are mainly used by governmentinstitutions and large companies for tasks such as census, industry and consumer statistics, enterprise resource planning, and financial transaction processing. Mainframe computers are specially used as servers on the World Wide Web (WWW). They are distinct from supercomputers.

7 0
2 years ago
What is the use of html in websites
Alborosie
HTML is a very basic markup language and requires memorization of a few dozen HTML commands that structure the look and layout of a web page. Before writing <span>any HTML code or designing your first web page, you must decide on an HTML editor or text editor, such as Notepad or Word Pad.</span>
4 0
3 years ago
Read 2 more answers
A friend of yours started her own dog walking business. At first she only had a couple customers, and she used Word to create al
GaryK [48]
Hire more people to help type her documents, or make Batch invoices
4 0
3 years ago
Which of the following is CORRECT about database managementsystem's languages?
scZoUnD [109]

Answer:

Data manipulation languages are used for the retrieval of the,insertion,deletion and modification of data.

Explanation:

Data Manipulation Languages(DML) are used to insert,delete,update,modify the data in the database.

The commands used to do these operations are as following:-

INSERT INTO :-This command is used to insert values in the database.

DELETE:-It is used to delete existing records from the table.

UPDATE:- It is used to modify the records in the table.

SELECT:- It is used to select data from database.

3 0
3 years ago
How can cars get faster
Varvara68 [4.7K]
Tape a spoiler to the trunk.
5 0
3 years ago
Other questions:
  • The project started the development of inter-network connections using tcp/ip that has evolved into the internet today.
    5·1 answer
  • Desktop publishing design tools are represented by
    11·1 answer
  • Which style of leadership would be most helpful to Charles in the following situation? Charles has just started an internship at
    15·1 answer
  • Digital dashboards provide the decision makers with a quick overview of key performance indicators and other key operational sta
    13·1 answer
  • The 10 and 2 o'clock hand position on the steering wheel is no longer recommended because _____.
    13·1 answer
  • Character positions in<br> arrays start counting with<br> the number 1.<br> True<br> False
    14·1 answer
  • "True or False? Software designers use layering and other techniques to organize large software systems."
    13·1 answer
  • Please NEED HELP ASAP WILL MARK BRAINLIEST ONLY #8
    8·1 answer
  • MyProgramming Lab
    5·1 answer
  • What is pollution?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!