0

I really am stuck as to what I am doing wrong with this program. Help would be much appreciated :D.

// DiscountPrices.java - This program calculates total cost for discounted items. 
// Input:  Interactive.
// Output:  Original price, discount, discounted price, and total price for all items. 

import javax.swing.*;

public class DiscountPrices
{
 public static void main(String args[]) 
 {
  final double DISCOUNT_ONE = .05;
  final double DISCOUNT_TWO = .10;
  final double DISCOUNT_THREE = .15;
  double price;
  String priceString;
  int quantity;               
  String quantityString; 
  double originalPrice;
  priceString = JOptionPane.showInputDialog("Enter price of item: ");
  originalPrice = Double.parseDouble(priceString); 
  quantityString = JOptionPane.showInputDialog("Enter quantity ordered: ");
  quantity = Integer.parseInt(quantityString); 
  
  // Test price here and call calculatePrice method.  
  {
    While (originalPrice < 5.00);
    {
      price = originalPrice * DISCOUNT_ONE;}
    
  While(originalPrice < 10.00);
  {
    price = originalPrice * DISCOUNT_TWO;
  }
   While(originalPrice >10.00);
   { price = originalPrice * DISCOUNT_THREE;
  }
 
calculatePrice(price, quantity);

System.out.println(done);  
  
   
    
 
  System.exit(0);
  }
   // End of main() method.
 
 
 // Write calculatePrice method here.
  {
  public static double calculatePrice(){
    double total = (price * quantity)*
     string done = ("Price: = " + originalPrice + "Discount Percent: " + ((originalPrice - price)/100) + "Quantity: " + quantity + "Total: " + total);
return done;
}


} // End of DiscountPrices class.

thanks.

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by masijade
0

Ok let me clarify where the one error is. It's in the last module, and tells me that the 'public static double calculatePrice(){ line is an illegal start to the expression. I'd really appreciate some advice on it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.