> Blue Pelican Java Lesson 15 quiz help?

Blue Pelican Java Lesson 15 quiz help?

Posted at: 2014-12-18 
Try something like this:

public class Drive {

int miles;

int gas;

String carType;

public Drive(String carType) {

this.carType = carType;

this.miles = 1;

this.gas = 1;

} // end constructor

public String getGas() {

return Integer.toBinaryString(gas);

} // end getGas()

} // end class Drive

And for the other question, you need this:

Drive drv = new Drive("Chevy");

Good Luck!

Create a class called Drive. It should have instance fields miles and gas which are both

integers. Another instance field, carType, is a String. The constructor should receive a

String which initializes carType. The other two instance fields are both automatically

initialized to 1 in the constructor. Create a method call getGas that returns a String that is

a binary representation of the gas data member. The getGas method has no parameters.



and if u can, plz help with this question also :

Write a line of code that will be in some other class besides Drive, and in that line, create

a Drive object called drv. Pass to the constructor the String literal, “Chevy”.

Thank u and plz no bad comments