Article View: aus.computers.java
Article #1181Maybe someon Can help???
From: mrbafner
Date: Sat, 03 Jul 1999 00:00
Date: Sat, 03 Jul 1999 00:00
73 lines
3009 bytes
3009 bytes
Hi,
I am pretty new to java, and I know you probably think this is a stupid
question. Though I am trying to get input from on 3 different lines and add
them, then take away tax from the final figure.
Here is what I have written so far, can you help me please?
================================================
import java.io.*;
public class SalesTax1 {
final static double Tax_Rate = 0.3; // salestax percentage
public static void main (String[] args)
throws IOException
{
System.out.println ("SALES TAX CALCULATOR"); // create a text input
stream
BufferedReader stdin = new BufferedReader
(new InputStreamReader (System.in)); // this
allow people to input something, then the computer can work of these figures
String initString;
int initialPrice; // stores user input
int initialPrice1; // stores user input
int initialPrice2; // stores user input
double finalPrice; // stores salary minus tax
double tax; // stores payable tax
System.out.print ("Enter the Price: \n");
System.out.print ("Enter the Price: \n");
System.out.print ("Enter the Price: ");
initString = stdin.readLine();
initialPrice = Integer.parseInt (initString); // calculate
payable tax
initialPrice1 = Integer.parseInt (initString);
initialPrice2 = Integer.parseInt (initString);
if (initialPrice == (initialPrice + initialPrice1 + initialPrice2) )
{
tax = initialPrice / Tax_Rate ;
}
else
{
tax = initialPrice * Tax_Rate;
} // calculate netto income
finalPrice = initialPrice - tax; // Output
System.out.println();
System.out.println("Original Price : " + initialPrice );
System.out.println("Original Price : " + initialPrice1 );
System.out.println("Original Price : " + initialPrice2 );
System.out.println("Sales Tax (" + Tax_Rate + " %): " + tax );
System.out.println("--------------------------------");
System.out.println("New Price : " + finalPrice );
}
}
=================================================
any comments would be much appreciated thankyou
MrBafner
Technical Details
Message-ID:
<wB4f3.196$ZS2.11889@nsw.nnrp.telstra.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,503f5806ef440889,start X-Google-Attributes: gid10d6db,public From: "mrbafner" <mrbafner@ozlinx.com.au> Subject: Maybe someon Can help??? Date: 1999/07/03 Message-ID: <wB4f3.196$ZS2.11889@nsw.nnrp.telstra.net> X-Deja-AN: 496445587 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: abuse@telstra.net X-Trace: nsw.nnrp.telstra.net 930928092 203.58.80.244 (Sat, 03 Jul 1999 01:08:12 EST) Organization: Customer of Telstra Big Pond Direct X-MSMail-Priority: Normal NNTP-Posting-Date: Sat, 03 Jul 1999 01:08:12 EST Newsgroups: aus.computers.java