Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. When you call this() inside a constructor, what are you doing? 2. Given the below Car class, update the default constructor so that it

1. When you call this() inside a constructor, what are you doing?

2. Given the below Car class, update the default constructor so that it calls the two argument constructor.

public class Car { private String make; private String model; public Car() { make = "Make unknown"; model = "Model unknown"; } public Car(String make, String model) { this.make = make; this.model = model; } public String getMake() { return make; } public String getModel() { return model; } public void setMake(String make) { this.make = make; } public void setModel(String model) { this.model = model; } public boolean timeForService(int currMileage) { if (currMileage < 10000) { return true; } return false; } @Override public String toString() { return "Make: " + make + " Model: " + model; } }

3. Next, override the equals method for the above Car class using the formula provided in class.

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

What is a comp?

Answered: 1 week ago