Create an Automobile class for a dealership. Include fields for an ID number, make, model, color, year,
Question:
Create an Automobile class for a dealership. Include fields for an ID number, make, model, color, year, and miles per gallon. Include get and set methods for each field. Do not allow the ID to be negative or more than 9999; if it is, set the ID to 0. Do not allow the year to be earlier than 2000 or later than 2017; if it is, set the year to 0. Do not allow the miles per gallon to be less than 10 or more than 60; if it is, set the miles per gallon to 0. Include a constructor that accepts arguments for each field value and uses the set methods to assign the values. Write an application that declares several Automobile objects and demonstrates that all the methods work correctly. Save the files as Automobile.java and TestAutomobiles.java.
Step by Step Answer:
Automobile public class Automobile private int id private String make private String model private String color private int year private double mpg pu...View the full answer
Students also viewed these Computer science questions
-
The table gives the number of miles per gallon in the city and on the highway for the coupes and compact cars reported to have the best gasoline mileage, according to autobytel.com. Make a...
-
The number of miles traveled per gallon of gasoline for a certain car has a mean of 25 and a standard deviation of 2. The tank holds 20 gallons. a. Find the mean number of miles traveled per tank. b....
-
The following data represent the number of miles per gallon achieved on the highway for small cars for the model year 2011. (a) Construct a stem-and-leaf plot and (b) Describe the shape of the...
-
Magna Jets is a medium sized company that manufactures luxury goods for several well-known chain stores. In real terms, the company has experienced only a small growth in turnover in recent years,...
-
Air Borealis works only with advance reservations and experiences a 7% rate of no-shows. How many reservations could be accepted for an airliner with a capacity of 250 if there is at least a 0.95...
-
In a continuous-time framework an individual with time-additive expected power utility induces the state-price deflator t = e t ct c0 , where is the constant relative risk aversion, is the...
-
E10.1. Classification of Cash Flows (Easy) State whether the following transactions affect cash flow from operations, free cash flow, financing flows, or none of them. a. Payment of a receivable by a...
-
Maurice Allred is going to purchase either the stock or the assets of Jewel Corporation. All of the Jewel stock is owned by Charley. Maurice and Charley agree that Jewel is worth $700,000. The tax...
-
Davis Company was started on January 1, 2014. During the month of January, Davis earned $5,200 of revenue and incurred $3,300 of expenses. During the remainder of 2014, Davis earned $55,000 and...
-
The following transactions pertain to Harrison Imports for Year 1: 1. Started business by acquiring $30,000 cash from the issue of common stock. 2. Provided $90,000 of services for cash. 3. Invested...
-
What is the output of the following code segment? t = 10; if(t > 7) { System.out.print("AAA"); System.out.print("BBB"); } a. AAA b. BBB c. AAABBB d. Nothing
-
What is the output of the following code segment? t = 0; if(t > 7) System.out.print("AAA"); System.out.print("BBB"); a. AAA b. BBB c. AAABBB d. Nothing
-
What results when there is an increase in overall prices? a. Recession b. Deflation c. Peak d. Inflation
-
In this problem, we consider mild modifications of the standard MDP setting. (a) (10 points) Sometimes MDPs are formulated with a reward function R(s) that depends only on the current state. Write...
-
All-Walnut, Inc. produces two models of bookcases. The bookcases sell for the amount listed in the table below. Each bookcase requires a certain number of labor hours, machine time, and materials...
-
Problem 1 Find the number of degrees of freedom of the mechanisms (a)-(d) (a) (b)
-
3) (10 pts) The following grammar is given E EAE (E) -E | id V={E,A), T={-,(,),*,/,+,id} and starting symbol is E. a) Give the left-most derivation of w= id+id*id. Is w accepted? b) Is this a...
-
4. X, the proprietor of a departmental store, decided to calculate separate profits for his two departments L and M for the month ending 31st January. Stock on 31st January could not be valued for...
-
Ted deposited $1750 in an RRSP on March 1, 2018, at 3% compounded quarterly. Subsequently, the interest rate was changed to 4% compounded monthly on September 1, 2020, and to 4.5% compounded...
-
Consider the combustion of methanol below. If 64 grams of methanol reacts with 160 grams of oxygen, what is the CHANGE in volume at STP. 2CH3OH(g) + 3O2(g) 2CO2(g) + 4H2O(1) The volume decreases by...
-
An escape sequence always begins with a(n) _____________. a. e b. Forward slash c. Backslash d. Equal sign
-
Which Java statement produces w on one line and xyz on the next line? a. System.out.println(wxyz); b. System.out.println(w + xyz); c. System.out.println(w xyz); d. System.out.println(w x y z);
-
The remainder operator _____________. a. Is represented by a forward slash b. Must follow a division operation c. Provides the quotient of integer division d. Is none of the above
-
As a long-term investment at the beginning of the 2018 fiscal year, Florists International purchased 25% of Nursery Supplies Inc.'s 18 million shares for $66 million. The fair value and book value of...
-
Javier is currently paying $1,200 in interest on his credit cards annually. If, instead of paying interest, he saved this amount every year, how much would he accumulate in a tax-deferred account...
-
Your company is considering the purchase of a fleet of cars for $195,000. It can borrow at 6%. The cars will be used for four years. At the end of four years they will be worthless. You call a...
Study smarter with the SolutionInn App