It is due by Monday, March 21, 2011, please help I need a program for my busines
ID: 3624428 • Letter: I
Question
It is due by Monday, March 21, 2011, please helpI need a program for my business to help me calculate the sales tax owed on each transaction and the total sales tax I owe to the state Department of Revenue every quarter. The location of the transaction determines the tax rate to use, based on the following:
A-Atlanta. 8%, C-Cobb County. 6%, D-Dekalb County, D-Dekalb, 7%
F-Fulton County, 7% G-Gwinnet County, 6% 0-Out of state, no tax due
X-Exempt, no tax due
As a single program, write statements to:
a) create your basic program structure, importing the necessary libraries for the tasks involved
b) define all necessary variables and initialize them properly
c) Create a looping statement to process all transactions entered until the user enters an appropriate sentinel value
d) display a single dialogue box where the user will enter one complete transaction (Not one data item per dialogue for four dialogs per transaction). Each transaction contains the transaction date, transaction number, location code, and amount, formatted as: mm/dd/yyyy number locationCode amount.
e) read in and parse each transaction from the input dialog box, storing the data items in appropriate variables.
f) Calculate the tax owed for this transaction and the total tax so far, and store in appropriate variables.
g) display the transaction information to the user in a message dialog box, indicating the transaction date, transaction number, location (spelled out as a word), the amount of the transaction, and the amount of tax owed on the transaction.
h) after all transactions have been processed, use a final message box to display the total amount of sales tax I should send in. Make sure all money amounts are properly formatted.
The file is:
10/11/2009 7754 C 15.00
10/12/2009 7755 C 21.99
10/17/2009 7756 G 17.50
10/17/2009 7757 G 12.00
10/17/2009 7758 G 35.00
11/02/2009 7759 A 14.95
11/19/2009 7760 F 77.50
11/19/2009 7761 X 121.00
11/27/2009 7762 D 42.00
12/05/2009 7763 O 81.20
12/06/2009 7764 O 15.95
12/21/2009 7765 C 45.00
Explanation / Answer
import java.io.*; // needed for file classes
import javax.swing.*;
public class salesTax
{
//main method
public static void main (String[] args)
{
String locationCode;
String date;
int transactionNumber;
double amount;
double totalTax=0;
String choice;
do
{
transactionNumber=Integer.parseInt(
JOptionPane.showInputDialog
("Enter transaction number:"));
locationCode=JOptionPane.showInputDialog
("Enter the location code:");
date=JOptionPane.showInputDialog
("Enter transaction date:");
amount=Double.parseDouble
( JOptionPane.showInputDialog
("Enter transaction Amount:"));
if(locationCode=="A")
totalTax+=0.08*amount;
else if(locationCode=="C")
totalTax+=0.06*amount;
else if(locationCode=="D")
totalTax+=0.07*amount;
else if(locationCode=="G")
totalTax+=0.08*amount;
else if(locationCode=="O")
totalTax+=0.06*amount;
else if(locationCode=="X")
totalTax=0;
//outputting data
System.out.println(
"Transaction ID:"+transactionNumber);
System.out.println(
"Location Code:"+locationCode);
System.out.println("Date:"+date);
System.out.println("Amount:"+amount);
System.out.println("Total tax:"+totalTax);
choice=JOptionPane.showInputDialog("Would
you like to make another
transcation(Yes):");
}while(choice=="Yes");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.