Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax. Assume the state sales tax is 4 percent and the county sales tax is 2 percent. The program should display the amount of the purchase, the state sales tax, the county sales tax, the total sales tax, and the total of the sale (which is the sum of the amount of purchase plus the total sales tax). Hint: Use the value 0.02 to represent 2 percent, and 0.04 to represent 4 percent.
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
Java programming assign 1
1. INFORMATION AND COMMUNICATIONS UNIVERSITY
SCHOOL OF EDUCATION
An Assignment Submitted In Partial Fulfilment Of The Requirements For The Bed Degree In
Information And Communication Technology.
Assignment No. 1
Student Name: Mudimba Alex Moonde
SIN: 1505273873
Lecturer’s Name: Martin Phiri
Course: Java Programming
Email: Mudimbamoonde@gmail.com
Year: one(Second Semester)2016
Question1:
Write a program that will askthe userto enterthe amountof a purchase.The program shouldthen
compute the state and countysalestax.Assume the state salestax is4 percentandthe countysalestax
is2 percent.The program shoulddisplaythe amountof the purchase,the state salestax,the county
salestax,the total salestax,and the total of the sale (whichisthe sumof the amountof purchase plus
the total salestax). Hint:Use the value 0.02 to represent2percent,and0.04 to represent4percent.
2. Solution:
import javax.swing.JOptionPane;
public class SalesTax
{
public static void main(String []args)
{
//Datatypes Declaration.
final double Amount_of_Purchase;
double total_sales_tax ;
double total_sales ;
double state_sales_tax, county_sales_tax;
int radomNumber;
String user;
String client;
//end of datatypes declaration.
//------------------------------------------------------------
// the client performing the trasaction shoud enter name.
client=JOptionPane.showInputDialog("Enter Client name:");
user=JOptionPane.showInputDialog("Enter Amount Of Purchase.");
Amount_of_Purchase=Double.parseDouble(user);
// the random number is being genarated here..
radomNumber=(int)(Math.random()*8)+8;
3. Solution:
//state sales tax is calculated.
state_sales_tax=Amount_of_Purchase*0.04;
client.length();
//state county sales tax is calculated.
county_sales_tax=Amount_of_Purchase*0.02;
// total sales tax.
total_sales_tax = state_sales_tax + county_sales_tax;
// total sales.
total_sales = Amount_of_Purchase - total_sales_tax;
// this java option pane displays the results of the program.
JOptionPane.showMessageDialog(null, "n The Transaction Code is:" +client.length()+"/"
+radomNumber+"/"+"2016 -"+radomNumber);
JOptionPane.showMessageDialog(null,"n CLIENT NAME: "+ client+ "n------------------------
------------------"
+"n The Amount of Purchase is: Zmk " + Amount_of_Purchase+
"n------------------------------------------"+"n The Total Sales: Zmk " +
total_sales+"n------------------------------------------"
+"n The State_Sales_Tax: Zmk "+ state_sales_tax+ "n County_Sales_Tax: Zmk
" +county_sales_tax);
System.exit.(0);
} //end of program.
}