subject

Need asap. i need an example of how to do this right.

the second programming project involves writing a program that computes the sales tax for a collection of automobiles of different types. this program consists of four classes. the first class is the automobile class, which contains the automobile’s make and model, and purchase price, which is specified in whole dollars. it should have three methods:

1. a constructor that allows the make and purchase price to be initialized.

2. a method named salestax that returns the base sales tax computed as 5% of the sales price.

3. a tostring method that returns a string containing the make and model of the automobile, the sales price, and the sales tax, appropriately labeled.

the automobile class has two subclasses. the first is electric. it has an additional instance variable that contains its weight in pounds stored as an integer. it should have the same three methods:

1. a constructor that allows the automobile’s make and model, purchase price and weight to be initialized.

2. an overridden method salestax that returns the total sales tax. the sales tax for an electric automobile consists of the base sales tax of 5% that applies to all automobiles minus a discount. if the weight is less than 3000 pounds the discount is $200. otherwise it is $150.

3. an overridden tostring method that returns a string containing the make and model of the automobile, the sales price, sales tax and the weight, appropriately labeled.

the second subclass is hybrid. it has an additional instance variable that contains the number of miles per gallon stored as an integer. it should have the same three methods:

1. a constructor that allows the automobile’s make and model, purchase price and miles per gallon to be initialized.

2. an overridden method salestax that returns the total sales tax the sales tax for a hybrid automobile consists of the base sales tax of 5% minus a discount. if the number of miles per gallon is less than 40, the discount is $100. otherwise there is an additional discount of $2 for every mile per gallon in excess of 40.

3. an overridden tostring method that returns a string containing the make and model of the automobile, the sales price, sales tax and the number of miles per gallon, appropriately labeled.

no additional public methods should be included in any of the above three classes.

finally there should be a fourth class named project2 that contains the main method. it should generate the gui shown below:

after entering the information about the make and model, its sales price and the type of the automobile, clicking the compute sales tax button should display the sales tax in the text field to its right. in addition, the object should be stored in an array of type automobile.

that array should allow space for up to the last five automobiles entered.
if non integer values are entering in any of the fields that require integers, an error message should be displayed in a joptionpane window.
clicking the clear fields button should clear all text fields.

clicking the display report button should produce a report on the console that includes the information about all the automobiles currently stored in the array. an example of the report that should be displayed is shown below:

make and model: toyota prius sales price: 3 sales tax: 1390.00 hybrid vehicle mpg: 45

make and model: ford fusion sales price: 21000 sales tax: 1050.00

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
You should try to photograph people on bright sunny days because the light will be best a) true b) false
Answers: 1
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 15:10
Which activity should be part of a long-term plan to positively affect yourhealth? oa. wearing regular clothing when handling toxinsob. not worrying about secondhand smokeoc. avoiding excessive exposure to sunlightod. drinking only well water
Answers: 1
question
Computers and Technology, 22.06.2019 15:50
The file sales data.xlsx contains monthly sales amounts for 40 sales regions. write a sub that uses a for loop to color the interior of every other row (rows 3, 5, etc.) gray. color only the data area, columns a to m. (check the file colors in excel.xlsm to find a nice color of gray.)
Answers: 2
You know the right answer?
Need asap. i need an example of how to do this right.

the second programming project in...
Questions
Questions on the website: 13722361