subject

Create a UsedCarException class that extends Exception; its constructor receives a value for a vehicle identification number (VIN) that is passed to the parent constructor so it can be used in a getMessage() call. Create a UsedCar class with fields for VIN, make, year, mileage, and price. The UsedCar constructor throws a UsedCarException when the VIN is not four digits; when the make is not Ford, Honda, Toyota, Chrysler, or Other; when the year is not between 1997 and 2017 inclusive; or either the mileage or price is negative. Write an application that establishes an array of at least seven UsedCar objects and handles any Exceptions. Display a list of only the UsedCar objects that were constructed successfully. 1.
public class ThrowUsedCarException {
public static void main(String[] args) {
// Write your code here
}
}
2.
import java. util.*;
public class UsedCar {
String vin;
String make;
int year;
int mileage;
int price;
public final static String DEFAULT_VIN = "999";
final int VIN_NUM_LENGTH = 4;
final int LOW_YEAR = 1997;
final int HIGH_YEAR = 2017;
final String[] MAKES = {"Ford", "Honda", "Toyota", "Chrysler", "Other"};
public UsedCar(String num, String carMake,
int carYear, int miles, int pr) throws UsedCarException {
}
public UsedCar() {
}
public String getVin() {
}
public String toString() {
return "VIN " + vin + " Make: " + make +
"\n Year: " + year + " " + mileage + " miles $" +
price;
}
}
3.
public class UsedCarException extends Exception {
public UsedCarException(String s) {
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Which of the following statements correctly identifies a problem with sanitization methods? a. methods are not available to remove data ensuring that unauthorized personnel cannot retrieve data.b. even fully incinerated media can offer extractable data.c. personnel can perform sanitization steps improperly.d. stored data is physically etched into the media.
Answers: 1
question
Computers and Technology, 22.06.2019 06:20
In what kind of attack can attackers make use of millions of computers under their control in an attack against a single server or network availability confidentiality integrity identity automated attack software? those who wrongfully disclose individually identifiable health information can be fined up to what amount per calendar year? single most expensive malicious attack hipaa what are script kiddies? advanced persistent threat security manager security engineer what level of security access should a computer user have to do their job what process describes using technology as a basis for controlling the access and usage of sensitive data? cybercriminal
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
question
Computers and Technology, 23.06.2019 08:00
The managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an .
Answers: 3
You know the right answer?
Create a UsedCarException class that extends Exception; its constructor receives a value for a vehic...
Questions
question
Computers and Technology, 15.11.2019 15:31
question
Social Studies, 15.11.2019 15:31
question
Social Studies, 15.11.2019 15:31
Questions on the website: 13722363