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
my homework guides Write the definition of a method printDottedLine, which has no parameters and doesn't return anything. The me
Masteriza [31]

Answer:

   public static void printDottedLine(){

       System.out.print(".....\n");

   }

Explanation:

This method returns nothing so its return type is void

It also accepts no parameters so the argument list is empty

When called it executes the  System.out.print(".....\n"); which prints out 5 dots

See a complete program below:

public class TestClock {

   public static void main(String[] args) {

   printDottedLine();

   }

   public static void printDottedLine(){

       System.out.print(".....\n");

   }

}

8 0
3 years ago
Decision trees are onlyapplicable to problems under certainty.<br> True<br> False
lions [1.4K]

Answer: False

Explanation:Decision tree is the tree like structured flowchart which is used for the evaluation of the possible outcomes or result of the particular problem. It usually has two or more branches as the the result node . Decision tree are applicable to many problems for solving it. So, decision trees is not only applicable on certainty problems but also on other problems as well. Therefore the given statement is false.

6 0
3 years ago
Which devices are most likely to communicate with the internet? Select 3 options.
Anon25 [30]
<h2>Answer:</h2>

<h3>smart phone </h3>

<h3>cars </h3>

<h3>delivery trucks</h3>
5 0
3 years ago
1. Comments can be placed anywhere in Python, including in the middle of a line of code.
viva [34]

Answer:

This is true

Explanation:

Comments don't effect your program at all.

The computer doesn't even read the line with the comment, what you right before the comment tells the computer to skip this line.

So you can place them anywhere

6 0
3 years ago
Daniel has a list of numbers that are not in any order. He wants to find the order of the numbers with the help of a spreadsheet
Mademuasel [1]
Answer:
The rank function.
3 0
3 years ago
Read 2 more answers
Other questions:
  • Someone please help! Please fill this out
    10·1 answer
  • Describe Ms word environment.​
    14·1 answer
  • Explain how can we determine that where is the strength of magnetic force maximum in a
    13·1 answer
  • Three uses for Auto Formatting in Word 2016.
    5·1 answer
  • Written and artistic expressions are protected by
    8·1 answer
  • Variables set equal to patterns are said to be:_______.
    7·1 answer
  • 1
    5·2 answers
  • Public-key cryptography can be used for encryption (ElGamal for instance) and key exchange. Furthermore, it has some properties
    9·2 answers
  • Complete the do-while loop to output every number form 0 to countLimit using printVal. Assume the user will only input a positiv
    9·1 answer
  • a FOR loop that will draw 3 circles with a radius of 20 exactly 50 points apart in a vertical line. the first points should be (
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!