Uncategorized

product maintenance Research Paper

product maintenance Research Paper

SUMMENT IN A ZIP FILE import java.util.Scanner; public class ProductMaintApp{// declare two class variablesprivate static ProductDAO productDAO = null;private static Scanner sc = null; public static void main(String args[]){System.out.println(Welcome to the Product Maintenance application); // set the class variablesproductDAO = DAOFactory.getProductDAO();sc = new Scanner(System.in); // display the command menudisplayMenu(); // perform 1 or more actionsString action = ;while (!action.equalsIgnoreCase(exit)){// get the input from the useraction = Validator.getString(sc,Enter a command: );System.out.println(); if (action.equalsIgnoreCase(list))displayAllProducts();else if (action.equalsIgnoreCase(add))addProduct();else if (action.equalsIgnoreCase(update))updateProduct();else if (action.equalsIgnoreCase(del) ||action.equalsIgnoreCase(delete))deleteProduct();else if (action.equalsIgnoreCase(help) ||action.equalsIgnoreCase(menu))displayMenu();else if (action.equalsIgnoreCase(exit))System.out.println(Bye.);elseSystem.out.println(Error! Not a valid command.);}} public static void displayMenu(){System.out.println(COMMAND MENU);System.out.println(list List all products);System.out.println(add Add a product);System.out.println(update Update a product);System.out.println(del Delete a product);System.out.println(help Show this menu);System.out.println(exit Exit this application);} public static void displayAllProducts(){System.out.println(PRODUCT LIST);System.out.println(productDAO.getProductsString());} public static void addProduct(){String code = Validator.getString(sc, Enter product code: );String description = Validator.getLine(sc, Enter product description: );double price = Validator.getDouble(sc, Enter price: ); Product product = new Product();product.setCode(code);product.setDescription(description);product.setPrice(price);productDAO.addProduct(product); System.out.println();System.out.println(description+  has been added.);} public static void updateProduct(){String code = Validator.getString(sc,Enter product code to update: );} public static void deleteProduct(){String code = Validator.getString(sc,Enter product code to delete: ); Product p = productDAO.getProduct(code); System.out.println();if (p != null){productDAO.deleteProduct(p);System.out.println(p.getDescription()+  has been deleted.);}else{System.out.println(No product matches that product code.);}}} Insure that all classes compile ModifyProductMaintApp to allow a user to update an existingProduct object Add an update command to the list of commands Add anupdateProduct method toProductMaintApp HaveupdateProduct obtain a product code from the user HaveupdateProduct allow the user to modify either the description or price for theProduct object with that product code HaveupdateProduct invoke theProductDAOupdateProduct method to change thatProduct Insure thatProductMaintApp produces a correctly updatedProduct Attachments: EX-9.2.docx

Is this the question you were looking for? If so, place your order here to get started!

×