// Inventory Program Part 1
/* Choose a product that lends itself to an inventory (for example; products at your workplace,
office supplies, music CDs, DVD movies, or software). */
/* Create a Java application that displays:
product number prodNum
name of the product prodName
number of units in stock unitStock
price of each unit unitPrice
value of the inventory (number of units in stock * price of each unit). invValue */
import static java.lang.Math.*;
public class Inventory1
{
// main method begins execution of Java application
public static void main( String args[] )
{
DecimalFormat df = new DecimalFormat( double df( ###0.00 ) );
Software software;
software = new Software( "Adobe Dreamweaver CS3", 1532.01, 8, 423.98 );
System.out.println( software );
System.out.println( "\nSoftware number: dev" + software.getProdNum() );
System.out.println( "Software title: " + software.getProdName() );
System.out.println( "Inventory on hand: " + software.getUnitStock() );
System.out.println( "Software price each: " + software.getUnitPrice() );
System.out.printf( "Inventory value: $%.2f\n" + software.invValue() );
software = new Software( "Adobe PhotoShop Elements CS3", 1450.03, 11, 450.98 );
System.out.println( software );
System.out.println( "\nSoftware number: pho" + software.getProdNum() );
System.out.println( "Software title: " + software.getProdName() );
System.out.println( "Inventory on hand: " + software.getUnitStock() );
System.out.println( "Software price each: $" + software.getUnitPrice() );
System.out.printf( "Inventory value: $%.2f\n" + software.invValue() );
software = new Software( "PDF Converter Professional 5", 1248.02, 7, 99.99 );
System.out.println( software );
System.out.println( "\nSoftware number: util" + software.getProdNum() );
System.out.println( "Software title: " + software.getProdName() );
System.out.println( "Inventory on hand: " + software.getUnitStock() );
System.out.println( "Software price each: $" + software.getUnitPrice() );
System.out.printf( "Inventory value: $%.2f\n" + software.invValue() );
software = new Software( "Quest Toad", 1537.04, 10, 580.98 );
System.out.println( software );
System.out.println( "\nSoftware number: dev" + software.getProdNum() );
System.out.println( "Software title: " + software.getProdName() );
System.out.println( "Inventory on hand: " + software.getUnitStock() );
System.out.println( "Software price each: $" + software.getUnitPrice() );
System.out.printf( "Inventory value: $%.2f\n" + software.invValue() );
software = new Software( "Corel Paint Shop Pro Photo", 1476.02, 6, 69.99 );
System.out.println( software );
System.out.println( "\nSoftware number: pho" + software.getProdNum() );
System.out.println( "Software title: " + software.getProdName() );
System.out.println( "Inventory on hand: " + software.getUnitStock() );
System.out.println( "Software price each: $" + software.getUnitPrice() );
System.out.printf( "Inventory value: $%.2f\n" + software.invValue() );
software = new Software( "System Mechanic", 1283.01, 7, 49.99 );
System.out.println( software );
System.out.println( "\nSoftware number: util" + software.getProdNum() );
System.out.println( "Software title: " + software.getProdName() );
System.out.println( "Inventory on hand: " + software.getUnitStock() );
System.out.println( "Software price each: $" + software.getUnitPrice() );
System.out.printf( "Inventory value: $%.2f\n" + software.invValue() );
} // end method main
} // end class Inventory1
Here are the errors I receive:
Inventory1.java:18: '.class' expected DecimalFormat df = new DecimalFormat( double df( ###0.00 ) ); ^ Inventory1.java:18: ';' expected DecimalFormat df = new DecimalFormat( double df( ###0.00 ) ); ^ Inventory1.java:18: illegal character: \35 DecimalFormat df = new DecimalFormat( double df( ###0.00 ) ); ^ Inventory1.java:18: illegal character: \35 DecimalFormat df = new DecimalFormat( double df( ###0.00 ) ); ^ Inventory1.java:18: illegal character: \35 DecimalFormat df = new DecimalFormat( double df( ###0.00 ) ); ^ Inventory1.java:18: ';' expected DecimalFormat df = new DecimalFormat( double df( ###0.00 ) ); ^ Inventory1.java:18: illegal start of expression DecimalFormat df = new DecimalFormat( double df( ###0.00 ) ); ^ Inventory1.java:18: ';' expected DecimalFormat df = new DecimalFormat( double df( ###0.00 ) ); ^ 8 errors

New Topic/Question
Reply



MultiQuote






|