With the addition of electric cars, we have a need to create a subclass of our Car class. In this exercise, we are going to create the Electric Car subclass so that we can override the miles per gallon calculation since electric cars don’t use gallons of gas.
The Car class is complete, but you need to complete the ElectricCar class as outlined in the starter code with comments.
Once complete, use the CarTester to create both a Car and ElectricCar object and test these per the instructions in the CarTester class.
Classes
public class CarTester
{
public static void main(String[] args)
{
// Create a Car object
// Print out the model
// Print out the MPG
// Print the object
// Create an ElectricCar object
// Print out the model
// Print out the MPG
// Print the object
}
}
////////////////////////////
public class ElectricCar extends Car {
// Complete the constructor
public ElectricCar(String model){
}
// Override the getMPG here.
// It should return: "Electric cars do not calculate MPG.
// Override the toString() here.
// (model) is an electric car.
}
//////////////////////////////////
public class Car {
//This code is complete
private String model;
private String mpg;
public Car(String model, String mpg){
this.model = model;
this.mpg = mpg;
}
public String getModel(){
return model;
}
public String getMPG(){
return mpg;
}
public String toString(){
return model + " gets " + mpg + " mpg.";
}
}

Answers

Answer 1

Hey will you please help me with my essay and I’ll get back to yours please ASAP//

Related Questions

How have technology and social media changed reading?
O A. Physical books can only be read on the web.
B. Now reading is a conversation of give and take.
O C. People no longer have to read anything at all.
D. Reading often takes much longer to undergo.

Answers

Answer:

B?

Explanation:

I'm super sorry if I get this wrong for you but after thinking so much I probably think it would be B

Answer:

the guy above is right it is B

Explanation:

because 2+2=4

What does the top-level domain in a URL indicate?
A. the organization or company that owns the website
B. the organization or company that operates the website
C. the protocol used to access the website D. the type of website the URL points to

Answers

Answer:

b i think

Explanation:

A top-level domain (TLD) is the last segment of the domain name. The TLD is the letters immediately following the final dot in an Internet address. A TLD identifies something about the website associated with it, such as its purpose, the organization that owns it or the geographical area where it originates.

Answer:

The answer is D. The type of website the URL points to.

Explanation:

I got it right on the Edmentum test.

Other Questions
explain cross elasticity of demand for unrelated goods Glue that holds us together literary device A riddle for the day I am less than 7 tens and more than 4 tens I am a odd number if you add both my digits you will get 11 which number am I? 47656774 please answer it soon Which word from the text is a conjunction? 1 he2 that3 but4 long Look at the Position vs. Time and Velocity vs. Time plots. What is the person's velocity when his position is at its maximum value (around 6 m ) Amanda scored 25, 17, 38, 11, and 24 points during her basketball games. What is the mean number of points she scored?21232738 What was Martin Luther Kings experience with conflict!??? the stock market measures earnings per share of stock of companies on monday, company abc opened and closed at $22.31 per share. on tuesday it rose $0.27 per share. on wednesday it fell $1.12 per share. on thursday it fell another $1.16 per share. on friday it gained $0.10 per share. what was the price of a share of stock for company abc at the close of the stock market on friday How does El Nio affect climate? (1 point)O Warm water move westward, making coastal South America cooler.O Warm waters move eastward, making coastal South America warmer.O Winds blow the warm water southward, making coastal Alaska cooler.Winds blow the warm waters northward, making coastal Alaska warmer. Explain the meaning of probability. What does it mean if an event has a probability of 0? Give an example. What does it mean if an event has a probability of 1? Give an example. What does it mean if an event has a probability of 1/2? Give an example. (LONG ANSWERS ONLY) You weigh a bear by making him stand on four scales as shown. Draw a free-body diagram showing all the forces acting on the bear. If his weight is 1,500 newtons, what is the reading onthe fourth scale? Which of the following questions should be asked to determine whether aresource is renewable?A. Does it occur naturally on Earth?B. Can it be replaced naturally in a short time?C. Is it hard to get from the environment?D. Will it benefit humans? Calculate the mass percent (m/m) of a solution prepared by dissolving 51.56 g of NaCl in 164.2 g of H2O. Express your answer to four significant figures. View Available Hint(s) Type the expression that results from the following seriesof steps:Start with x and multiply by itself. 1: A50 L balloon is at 4 atm of pressure. What is the volume at 2 atm of pressure? Complete the missing parts of the table for the following function. y=7x Explain how an equation is like a balanced hanger plzzz answer due today What is external factor help pls i can give brainliest?Identify the solution to the system of equations.