-
howd you draw class digarams
for example from the follwing code,:
import javax.swing.*;
public class PriceOfCoffee {
public static void main(String[] args) {
int numberOfUnits, unitWeight;
final double pricePerPound=5.99;
double totalPrice, totalPriceWithTax;
final double salesTax=0.0725;
String inputStr;
inputStr = JOptionPane.showInputDialog(null, "Number of bags sold: ");
numberOfUnits = Integer.parseInt(inputStr);
inputStr = JOptionPane.showInputDialog(null, "Weight per bag: ");
unitWeight = Integer.parseInt(inputStr);
// computation
totalPrice = unitWeight * numberOfUnits * pricePerPound;
totalPriceWithTax = totalPrice + totalPrice * salesTax;
System.out.println("Number of bags sold: " + numberOfUnits);
System.out.println(" Weight per Bag: " + unitWeight + "lb");
System.out.println(" Price per pound: $" + pricePerPound);
System.out.println(" Sales tax: 7.25%");
System.out.println(""); // miss a line
System.out.println(" Total price: $" + totalPriceWithTax);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks