Placeholder

CMIS 242 Project 2 Computes the Sales Tax

$19.00

Description

A constructor that allows the make and purchase price to be initialized.price.
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:
A method named salesTax that returns the base sales tax computed as 5% of the sales
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:
A constructor that allows the automobile’s make and model, purchase price and weight to be initialized.
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.
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:
A constructor that allows the automobile’s make and model, purchase price and miles per gallon to be initialized.
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.
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:
Image transcription textAutomobile Sales Tax Calculator X Make and Model Sales Price Automobile Type Hybrid Miles per Gallon Electric
Weight in Pounds Other Compute Sales Tax Clear Fields Display Report
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: 30000
Sales Tax: 1390.00
Hybrid Vehicle
MPG: 45
Make and Model: Ford Fusion Sales Price: 21000
Sales Tax: 1050.00
Be sure to follow good programming style, which means making all instance variables private, naming all constants and avoiding the duplication of code. Furthermore you must select enough different kinds of automobiles to completely test the program
SCREENSHOTS
SOLUTION
PAYMENT
CMIS 242 Project 2
CMIS 242 Automobile Sales Tax Calculator
CMIS 242 Project 2 Screenshot
CMIS 242 Automobile
CMIS 242 Sales Tax Calculator
The solution consists of:
All Java programs for this assignment.
A Netbeans Project in case you want to run theses programs on your computer.
Screenshots while running programs
Attachments [Move over files to preview content of those files]
CMIS242_Project_2.zip (293.47 KB)
Netbeans Project
CMIS242Project2
pom.xml
src
main
java
Automobile.java
Electric.java
Hybrid.java
Project2.java
test
java
target
classes
.netbeans_automatic_build
Automobile.class
Electric.class
Hybrid.class
Project2.class
generated-sources
annotations
maven-status
maven-compiler-plugin
compile
default-compile
createdFiles.lst
inputFiles.lst
test-classes
.netbeans_automatic_build
readme.txt
Screenshots
CMIS242-PROJECT-2-SCREENSHOT-1.png
CMIS242-PROJECT-2-SCREENSHOT-2.png
CMIS242-PROJECT-2-SCREENSHOT-3.png
CMIS242-PROJECT-2-SCREENSHOT-4.png
CMIS242-PROJECT-2-SCREENSHOT-5.png
Source Code
Automobile.java
Electric.java
Hybrid.java
Project2.java
Preview Automobile.java
xxxxxx xxxxx xxxxxxxxxx {
//xxx xxxxxxxx xx xxxxxxxxx xx //xxxxxx xxxx xxx xxxxxxx xxxxxxxx xxx xxxxxx
xxxxxxxxx xxxxxx xxxxxxxxxxxx;
protected double purchasePrice; protected final double TAX_RATE=0.05;
public Automobile(String makeAndModel, double price) { this.makeAndModel = makeAndModel; this.purchasePrice = price; }
xxxxxx xxxxxx xxxxxxxx() {
xxxxxx xxxxxxxxxxxxx * xxx_xxxx;
}
xxxxxx xxxxxx xxxxxxxx() {
Preview Electric.java
xxxxxx xxxxx xxxxxxxx xxxxxxx xxxxxxxxxx {
//xxxxxxxx xxxxxxxx
xxxxxxx xxxxxx xxxxxx;
public Electric(String makeAndModel, double price, double weight) { super(makeAndModel, price); this.weight=weight; }
//Calculate discount based on weight
//xxxxxxxx xx 200 xx xxxxxx xx xxxxx 3000
//xxxxxxxxx xx xx 150
xxxxxx xxxxxx xxxxxxxx() {
xxxxxx xxxxxxxx = 0;
xx(xxxxxx < 3000) xxxxxxxx = 200; Preview Hybrid.java xxxxxx xxxxx xxxxxx xxxxxxx xxxxxxxxxx { //xxxxxxxx xxxxxxxx xxxxxxx xxxxxx xxx; public Hybrid(String makeAndModel, double price, double mpg){ super(makeAndModel, price); this.mpg=mpg; } //Calculate sales tax //xxxxxxxxx xxx xxxxxx xxxxxx xxxxxxxx() { xxxxxx xxxxxxxx = 0; xx(xxx < 40) xxxxxxxx = 100; xxxx Preview Project2.java xxxxxx xxxxxxx2() { xxxxxxxxxxxxxx(); xxxxxxxxxxxxxxx.xxxxxxxxx(xxx xxxxxxxxxxxx(xxx xxxxxxxxxx(xxxxx.xxxx), "xxxxxxxxxx xxxx", xxxxxxxxxxxx.xxxxxxx_xxxxxxxxxxxxx, xxxxxxxxxxxx.xxxxxx, xxx xxxx("xxxxxxxxx", xxxx.xxxx, 13), xxxxx.xxxxx)); } @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() {buttonGroup = new javax.swing.ButtonGroup(); makeandmodelLabel = new javax.swing.JLabel(); salePriceLabel = new javax.swing.JLabel(); makeandmodelTextField = new javax.swing.JTextField(); salePriceTextField = new javax.swing.JTextField(); automobilePanel = new javax.swing.JPanel(); hybridRadioButton = new javax.swing.JRadioButton(); electricRadioButton = new javax.swing.JRadioButton(); xxxxxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxxxxxxxx(); xxxxxxxx = xxx xxxxx.xxxxx.xxxxxx(); xxxxxxxx = xxx xxxxx.xxxxx.xxxxxx(); xxxxxxxxxxxx = xxx xxxx.xxx.xxxxxxxxx(); xxxxxxxxxxxx = xxx xxxx.xxx.xxxxxxxxx(); xxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxxx(); Preview readme.txt xx xxxx xxxxxxxx, xx xxxxxxxx xxxxxx xxxx xxx xxxxxxxx xxxxxxx. xxx xxx xxxxxxx xxxxxxxx xx xxxx xxx xxx xxx xxxxxxxx xxxxxxx xx xxx xxx xxxx xxx xx xxxxxx xxxxxxx xxx xxxx xxxxxx xxxx xx "xxx" xxxxxx. If you are using Netbean. Please choose Netbeans and JDK version as follow: based on the NetBeans release documentation, here is a summary of the JDK versions you can use with all recent versions of NetBeans: NetBeans 11.0: JDK 8, JDK 11, JDK 12 NetBeans 11.1: JDK 8, JDK 11, JDK 12 xxxxxxxx 11.2: xxx 8, xxx 11, xxx 13 xxxxxxxx 11.3: xxx 8, xxx 11, xxx 14 xxxxxxxx 12.0: xxx 8, xxx 11, xxx 14 Preview Automobile.java xxxxxx xxxxx xxxxxxxxxx { //xxx xxxxxxxx xx xxxxxxxxx xx //xxxxxx xxxx xxx xxxxxxx xxxxxxxx xxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxxxx; protected double purchasePrice; protected final double TAX_RATE=0.05; public Automobile(String makeAndModel, double price) { this.makeAndModel = makeAndModel; this.purchasePrice = price; } xxxxxx xxxxxx xxxxxxxx() { xxxxxx xxxxxxxxxxxxx * xxx_xxxx; } xxxxxx xxxxxx xxxxxxxx() { Preview Electric.java xxxxxx xxxxx xxxxxxxx xxxxxxx xxxxxxxxxx { //xxxxxxxx xxxxxxxx xxxxxxx xxxxxx xxxxxx; public Electric(String makeAndModel, double price, double weight) { super(makeAndModel, price); this.weight=weight; } //Calculate discount based on weight //xxxxxxxx xx 200 xx xxxxxx xx xxxxx 3000 //xxxxxxxxx xx xx 150 xxxxxx xxxxxx xxxxxxxx() { xxxxxx xxxxxxxx = 0; xx(xxxxxx < 3000) xxxxxxxx = 200; Preview Hybrid.java xxxxxx xxxxx xxxxxx xxxxxxx xxxxxxxxxx { //xxxxxxxx xxxxxxxx xxxxxxx xxxxxx xxx; public Hybrid(String makeAndModel, double price, double mpg){ super(makeAndModel, price); this.mpg=mpg; } //Calculate sales tax //xxxxxxxxx xxx xxxxxx xxxxxx xxxxxxxx() { xxxxxx xxxxxxxx = 0; xx(xxx < 40) xxxxxxxx = 100; xxxx Preview Project2.java xxxxxx xxxxxxx2() { xxxxxxxxxxxxxx(); xxxxxxxxxxxxxxx.xxxxxxxxx(xxx xxxxxxxxxxxx(xxx xxxxxxxxxx(xxxxx.xxxx), "xxxxxxxxxx xxxx", xxxxxxxxxxxx.xxxxxxx_xxxxxxxxxxxxx, xxxxxxxxxxxx.xxxxxx, xxx xxxx("xxxxxxxxx", xxxx.xxxx, 13), xxxxx.xxxxx)); } @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() {buttonGroup = new javax.swing.ButtonGroup(); makeandmodelLabel = new javax.swing.JLabel(); salePriceLabel = new javax.swing.JLabel(); makeandmodelTextField = new javax.swing.JTextField(); salePriceTextField = new javax.swing.JTextField(); automobilePanel = new javax.swing.JPanel(); hybridRadioButton = new javax.swing.JRadioButton(); electricRadioButton = new javax.swing.JRadioButton(); xxxxxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxxxxxxxx(); xxxxxxxx = xxx xxxxx.xxxxx.xxxxxx(); xxxxxxxx = xxx xxxxx.xxxxx.xxxxxx(); xxxxxxxxxxxx = xxx xxxx.xxx.xxxxxxxxx(); xxxxxxxxxxxx = xxx xxxx.xxx.xxxxxxxxx(); xxxxxxxxxxxxx = xxx xxxxx.xxxxx.xxxxxxx(); Price: $19 You May Also Like: CMIS 242 Project 1 Minimum Maximum and Average CMIS 242 Project 3 Draws Two Types of Shapes CMIS 242 Project 4 Manage a Real Estate Database

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.