Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I keep getting a missing return statement error on my Java and I can't figure out why. Any thoughts on what I'm doing wrong? Errors

I keep getting a "missing return statement" error on my Java and I can't figure out why. Any thoughts on what I'm doing wrong? Errors start with the setYearModel mutator and continue through the end of the program.

public class Car_V2

{

private String carName;

private int yearModel;

private String carMake;

private int carSpeed;

private int carMileage;

private Owner carOwner;

private static int totalMileage;

public Car_V2(String name, int year, String make, int speed, Owner owner, int mileage)

{

carName = name;

yearModel = year;

carMake = make;

carSpeed = speed;

carOwner = owner;

carMileage = mileage;

totalMileage += mileage;

}

public String toString()

{

String response = "";

response += "Car Name is: " + carName;

response += " Car Year is: " + yearModel;

response += " Car Make is: " + carMake;

response += " Car Speed is: " + carMake;

response += " It was " + carOwner.toString();

return response;

}

public String getCarName()

{

return carName;

}

public int getYearModel()

{

return yearModel;

}

public String getMake()

{

return carMake;

}

public int getSpeed()

{

return carSpeed;

}

public String getOwner()

{

return carOwner.toString();

}

public int getMileage()

{

return carMileage;

}

public static double getTotMileage()

{

return totalMileage;

}

public void setCarName(String na)

{

carName = na;

}

public int setYearModel(int y)

{

yearModel = y;

}

public String setMake(String ma)

{

carMake = ma;

}

public int setSpeed(int s)

{

carSpeed = s;

}

public String setOwner(String o)

{

carOwner.toString();

}

public int setMileage(int mi)

{

carMileage = mi;

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago