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
Several different tunneling protocols can be used in dial-up situations. Which of the following would best be used as a VPN tunn
melomori [17]

Answer:

The answer is the point - to -point protocol, which allows user to set a secure VPN connection for client and server connectivity.

Explanation:

A virtual private network is a private-public network because of encryption and tunneling to ensure the integrity of the data. VPN requires a tunnel to work and encryption.

In VPNs, there are different protocols can be used, such as point- to - Point Tunneling Protocol (PPTP), IPSec, and L2TP.

Point to Point Protocol is a Microsoft protocol which allows user to set a connection and secure VPN destination. Point to point protocol is designed for client and server connectivity. It developed a connection between two computers. The data link layer that transmits over IP networks is used for point to point tunneling.

Such as option A is not correct because it is distracter and IPSecis primary tunneling protocol. It supports only IP networks. L2TP is not a VPN but extend VPN over the various network.

3 0
4 years ago
Technician A says that front and rear U-joints on a RWD axle should operate at different angles to prevent vibration. Technician
sleet_krkn [62]

Answer:

Technician B is correct only

Explanation:

The actions of technician b helps to eliminate uneven rotating speed which causes vibrations.

6 0
4 years ago
You want to decide whether you should drive your car to work or take the train. You know the one-way distance from your home to
tester [92]

<u>Explanation:</u>

Remember, an algorithm in simple words means a set of instructions or steps to be followed in other to solve a problem.

Note, to decide which commute is cheaper, it means the output of the algorithm should be the cheaper way to commute.

Using pseudocode do the following;

  • determine the inputs and outputs of the problem
  • arrange the identified problem into micro-tasks
  • describe each micro-tasks in the pseudocode
  • Test the pseudocode by solving the problem.

                       

3 0
3 years ago
Write a recursive function called DrawTriangle() that outputs lines of '*' to form a right side up isosceles triangle. Function
lorasvet [3.4K]

Answer:

Code:-  

# function to print the pattern

def draw_triangle(n, num):

     

   # base case

   if (n == 0):

       return;

   print_space(n - 1);

   print_asterisk(num - n + 1);

   print("");

 

   # recursively calling pattern()

   pattern(n - 1, num);

   

# function to print spaces

def print_space(space):

     

   # base case

   if (space == 0):

       return;

   print(" ", end = "");

 

   # recursively calling print_space()

   print_space(space - 1);

 

# function to print asterisks

def print_asterisk(asterisk):

     

   # base case

   if(asterisk == 0):

       return;

   print("* ", end = "");

 

   # recursively calling asterisk()

   print_asterisk(asterisk - 1);

   

# Driver Code

n = 19;

draw_triangle(n, n);

Output:-  

# Driver Code n = 19;| draw_triangle(n, n);

4 0
3 years ago
What type of microsoft server serves as an email server?
kari74 [83]
The serverof outlook
5 0
4 years ago
Other questions:
  • Which is true regarding pseudocode?
    9·2 answers
  • Write about the future of Reliability and Security in Software Engineering.
    13·1 answer
  • ________ is a mobile broadband technology that relies on microwave transmissions to blanket large metropolitan areas from microw
    11·1 answer
  • -..
    11·1 answer
  • How many votes does a candidate need to become president of the US ?
    12·2 answers
  • What should you do if you do not understand the directions on a test?
    12·2 answers
  • Python: Write a program for a small restaurant that sells pizzas. You may consider it as a prototype of a realistic online appli
    13·1 answer
  • Hi question
    8·1 answer
  • Higher Order Functions used for simulations of dice rolls. Definition: An n-sided dice function takes no arguments and always re
    12·1 answer
  • Alice has an item x and Bob has a set of five distinct items y1, y2, y3, y4 and y5. Design a protocol through which Alice (but n
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!