Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: whats wrong , better way to organize

  1. #1
    Junior Member
    Join Date
    Feb 2018
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default whats wrong , better way to organize

    import java.util.Scanner;

    public class Experiment
    {

    public static void main(String[] args)
    {

    Scanner con = new Scanner( System.in );
    final double STATE_TAX_RATE = 0.04;
    final double COUNTY_TAX_RATE = 0.02;
    double stateTax;
    double countyTax;
    double totalTax;
    double totalSale;

    System.out.print( "Enter Amount" );
    double amount = con.nextDouble();

    double stateTax = amount * STATE_TAX_RATE;
    double countyTax = amount * COUNTY_TAX_RATE;
    double totalTax = stateTax + countyTax;
    double totalSale = amount + totalTax;


    System.out.println("Amount of purchase;" + amount + "n/"
    + "State Sales Tax;" + stateTax + "n/"
    + "County Sales Tax;" + countyTax + "n/"
    + "Total Sales Tax;" + totalTax + "n/"
    + "Total Sale;"+ totalSale );

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: whats wrong , better way to organize

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Not Sure Whats Wrong
    By Blykon in forum What's Wrong With My Code?
    Replies: 14
    Last Post: September 11th, 2014, 10:13 AM
  2. Whats wrong here??
    By cbplayer in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 16th, 2013, 02:19 PM
  3. Whats going wrong here?
    By choll4c in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 24th, 2012, 03:39 PM
  4. WHATS WRONG
    By subodhkr in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 8th, 2012, 07:47 AM
  5. whats wrong?
    By whattheeff in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 25th, 2011, 02:35 PM