Cant figure this out! Help needed!

Hi,
Ok I need some clearing up and some help. This is a program that generates receipts for an art supply store which sells three items: a brush set; a set of oil paints; and a can of oil canvas primer. The program is able to process multiple orders. For each order placed, calculate the order and print a receipt itemizing each item @ cost, the tax, the Environmental Levy, and the total cost.
The cost of the items are:
1- Brush Set: $8.00
2- Set of Oil Paints: $40.00
3- Oil Canvas Primer: $18.75
4- Taxes: 14%
5-Environmental Levy: 2% on all oil based products (including the paint set and primer). Levy calculated on product cost only (i.e. calculate without tax).
The program should also keep track of the total numbers of each item ordered. Using these values, the user can, at any time, generate a receipt summarizing all orders placed up to that point. When the user enters the sentinel to quit the program, calculate and print one final receipt summarizing all of the orders that were placed. You should also calculate and print some receipt statistics: the average cost of the receipts and the smallest and largest receipts (in terms of cost).
Your program will make use of 2 static methods (in addition to the main() method): toCurrency() and createReceipt().
Ok the deal is that I have the input loops set up fine they all work, except for Total because nothing shows up! I dont know what to do for the output nor the calculations and where or what methods I have to use and how to call them up into Main. This is what I have so far...I added in comments to guide myself but I cant figure it out...Please help thanks
import javax.swing.*;
import java.text.NumberFormat;
class Store{
public static void main(String[]args){
String input = JOptionPane.showInputDialog(null,"Welcome to the Arts Store! \nEnter the following selections: \nOrder\nTotal\nQuit");
String header,numBrush,numOil,numCan;
while(!input.equalsIgnoreCase("quit"))
          if(input.equalsIgnoreCase("order"))
                    numBrush = JOptionPane.showInputDialog(null,"Enter the Amount of Brushes:");
                    double brush = Double.parseDouble(numBrush);
                    numOil = JOptionPane.showInputDialog(null,"Enter the Amount of Oil Paint:");
                    double paint = Double.parseDouble(numOil);
                    numCan = JOptionPane.showInputDialog(null,"Enter the Amount of Canvas Primer:");
                    double canvas = Double.parseDouble(numCan);
     else if(input.equalsIgnoreCase("total")){
          //calculate the reciept
          //call the method createReciept
     else
          System.out.println("Sorry wrong input! Try again!");
          input = JOptionPane.showInputDialog(null,"\nEnter the following selections: \nOrder\nTotal\nQuit");
     }//end while loop
//calculate and print final reciept
//call up createReciept() method
//display average cost and smallest and largest order
     }//end main
public static String toCurrency(double value) {
NumberFormat num =NumberFormat.getCurrencyInstance();
String str = num.format(value);
return str;
public static double createReceipt(String header, double numOfBrushSets, double numOfOilPaints, double numOfPrimers){
/*This method will generate a receipt in System.out.println
This method has 4 parameters: a String header that describes the order being calculated
(e.g. "Receipt Number 1", "Total of 10 Receipts", etc.) and 3 int parameters for the number of Brush Sets, Oil Paints, and Oil Canvas Primers.
Calculate the cost each item, the tax, the environmental levy (2% only on oil based products), and the total receipt cost.
Use toCurrency() to format all currency values to 2 decimal places. Finally, createReceipt()
should return the total cost to the calling method where it will be used to update the receipt statistics. */
numOfBrushSets=8.00;
numOfOilPaints=40.00;
numOfPrimers=18.75;
double total=numOfBrushSets+numOfOilPaints+numOfPrimers;
double tax;
tax=total*0.15;
System.out.println("Welcome to the Store");
System.out.println(" You have purchased this many brush sets:"+numOfBrushSets);
System.out.println(" You have purchased this many paint buckets:"+numOfOilPaints);
System.out.println(" You have purchased this many canvas primer sets:"+numOfPrimers);
return tax;
}

import java.text.NumberFormat;
import javax.swing.*;
public class StoreRx {
    public static void main(String[]args) {
        String input = JOptionPane.showInputDialog(null,"Welcome to the Arts Store!" +
                          "\nEnter the following selections: \nOrder\nQuit");
        // create some variables to remember things as we go
        int totalBrushes = 0;
        int totalPaint   = 0;
        int totalPrimer  = 0;
        double totalReceipts = 0;
        double smallestReceipt = Double.MAX_VALUE;
        double largestReceipt  = Double.MIN_VALUE;
        int count = 0;
        while(!input.equalsIgnoreCase("quit")) {
            if(input.equalsIgnoreCase("order")) {
                String numBrush = JOptionPane.showInputDialog(null,
                                 "Enter the Amount of Brushes:");
                int brush = Integer.parseInt(numBrush);
                String numOil = JOptionPane.showInputDialog(null,
                                 "Enter the Amount of Oil Paint:");
                int paint = Integer.parseInt(numOil);
                String numCan = JOptionPane.showInputDialog(null,
                                 "Enter the Amount of Canvas Primer:");
                int canvas = Integer.parseInt(numCan);
                double total = createReceipt(brush, paint, canvas);
                if(total < smallestReceipt)
                    smallestReceipt = total;
                if(total > largestReceipt)
                    largestReceipt = total;
                totalBrushes  += brush;
                totalPaint    += paint;
                totalPrimer   += canvas;
                totalReceipts += total;
                count++;
            else
                System.out.println("Sorry wrong input! Try again!");
            input = JOptionPane.showInputDialog(null,
                        "\nEnter the following selections: \nOrder\nQuit");
        }//end while loop
        // "quit" brings us here
        System.out.println("Welcome to the Store");
        System.out.println(" You have purchased this many brush sets: " +
                             totalBrushes);
        System.out.println(" You have purchased this many paint buckets: " +
                             totalPaint);
        System.out.println(" You have purchased this many canvas primer sets: " +
                             totalPrimer);
        //display average cost and smallest and largest order
        double average = totalReceipts/count;
        System.out.println("smallestReceipt = " + toCurrency(smallestReceipt) + "\n" +
                           "largestReceipt  = " + toCurrency(largestReceipt)  + "\n" +
                           "average receipt = " + toCurrency(average));
    }//end main
    public static String toCurrency(double value) {
        NumberFormat num = NumberFormat.getCurrencyInstance();
        String str = num.format(value);
        return str;
     * This method will generate a receipt in System.out.println
     * This method has 4 parameters: a String header that describes the order being
     * calculated (e.g. "Receipt Number 1", "Total of 10 Receipts", etc.) and 3 int
     * parameters for the number of Brush Sets, Oil Paints, and Oil Canvas Primers.
     * Calculate the cost each item, the tax, the environmental levy (2% only on oil
     * based products), and the total receipt cost. Use toCurrency() to format all
     * currency values to 2 decimal places. Finally, createReceipt()
     * should return the total cost to the calling method where it will be used to
     * update the receipt statistics.
    public static double createReceipt(int brushes, int paints, int primers) {
        double priceOfBrushSets =  8.00;
        double priceOfOilPaints = 40.00;
        double priceOfPrimers   = 18.75;
        double taxRate = 0.14;
        double environLevy = 0.02;
        double subTotal = brushes * priceOfBrushSets +
                          paints  * priceOfOilPaints +
                          primers * priceOfPrimers;
        double total = subTotal * (1.0 + taxRate + environLevy);
        return total;
}

Similar Messages

Maybe you are looking for

  • TNS-12560 TNS:protocal adapter error

    Hi, I installed vmware 5.5.3 in my desktop and installed RHEL 4 and Oracle 10.2.0.1 on RHEL 4.Created a database and is working fine.But when I tried to start the listener ,i'm getting the following error and the listener did not start. TNS-12537: TN

  • Relative Path and FileWriter

    I have the following code and it works fine when running standalone. I have to add that entries.xml and my Java file are in the same package. String filename = this.getClass().getResource(".").getPath() + "entries.xml"; FileWriter writer = new FileWr

  • How to create template for Report Designer

    I have to create 20 reports in report Designer and each one of them have same header, footer and column fields. Is there any way i can create a Report Template which can be used in each report? Kindly advice. Thanks

  • I need to reset the monitor profile. It is being overiden and too dark

    Something is overiding the color profile upon start up. After migrating files from one macbook pro to another, the same corrupted startup monitor profile is making the screen dark, on one user profile. The other admin profiles are fine. I bought a ne

  • My photo prints are bad

    when i print on 8x10 it orints fine.when i print 4x6 color photo the colors and all mixed up washedout nad bad. what wrong?