Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Given the following heading of a method, answer questions: ublic int Determin

ID: 3861749 • Letter: 1

Question

1. Given the following heading of a method, answer questions: ublic int Determine Result (int value1, chat value2. string value3) What is the signature of above method? (1 pts) Determine Result Cint value r value Suri alue 3) 2) Which of the following is a valid overloaded method for above Determine Result method? pts) a. Public double DetermineResult(int valuel, chat value2, strlng value 3) b. public int DecideResult (int valu el, char value2, String value public void DetermineResult (double value2, int valuel, string value3) public int Determine Result (int x, char y, string z e. Public void DecideResult (int x, double value string 21 2. According to the following UML diagram, write a complete class Car. Car -year Model int 1900 "make: String -speed double 0.0 +Car() +getYearModel(): int +getMake( String +getSpeed(): double +setYearModel(int): void +setMake(String): void +accelerate() void +brake( void +toString(): String l) Write the zero-arguments constructor Car p) 2) Write accessor for each of above three instance variables. The first one was given to you as an example. (2 public int get YearModel return year Model:

Explanation / Answer

2.

There are two ways to overload the methods

Answer is (C) option.

2.

1.Zero argument constructor:

public Car(){

yearModel=1990;

make='Benz';

speed=0.0;

}

2.The accesor methods are getter methods.

public String getMake(){
return make;
}
public double getSpeed(){
return speed;
}

3.

public void setYearModel(int yearModel){

}

public void setMake(String make){

this.make=make;

}

4.

public void accelerate(){

this.speed=this.speed+10;

}

public void brake(){

this.speed=this.speed-5;

}

public String toString(){

return "Year : "+yearModel + "/n Make : "+ make+ " /n Speed : "+speed;

}