Chat with us, powered by LiveChat For this assignment, you will need to use a Netbeans project which you will need to name using your Last name followed by your first name followed by -Homework2?? to name it After completin - Essayabode

For this assignment, you will need to use a Netbeans project which you will need to name using your Last name followed by your first name followed by -Homework2?? to name it After completin

For this assignment, you will need to use a Netbeans project which you will need to name using your Last name followed by your first name followed by “-Homework2” to name it After completing the assignment, zip the project directory and turn in via blackboard by the due date. For this assignment, you may begin with the result of homework #2 (note: you may use my solution if you want). If you do, please rename according to rules above. Part I: (25%): Validation 1. As a reminder, you were asked to create POST and PUT endpoints for reviews in homework #2. We’re going to setup validation requirements for BOTH of those endpoints. 2. (5%) You will need to ensure both endpoints are setup to ensure only valid products. 3. (10%) You need to setup the following constraints for the employee: a. SKU must be present and in the correct range (7-digit number) b. Name cannot be blank and must be no longer than 30 characters c. Description cannot be blank and must be no longer than 300 characters d. Category cannot be blank and must be no longer than 30 characters e. SellerID must be present and in the correct range (7-digit number) f. Price must be a positive value number 4. (10%) You will need to setup an exception handler which handles validation issues. Copy the exception handler we used in class for this purpose into your project. Part II: New GET endpoints 1. (15%) Get all products from a given seller (do NOT use custom queries) using the seller’s name a. If seller doesn’t exist, return an empty list b. otherwise, return all products listed by a given seller 2. (15%) Get all products offered in a given state (please use the two letter abbreviation) a. Given the state abbreviation, return all products that are sold in the given state. Part III: (30%) Generating HTML files for the project 1. All pages should be in static folder of the project so that they appear when the web server runs. 2. (20%) Create several web pages that show the products sorted in different ways (Hint: use orderby in your queries). Note I should see BOTH the code and the actual pages. a. index.html – a page which contains the products sorted by their SKUs (ascending) b. name.html – a page which contains the products sorted by their name (ascending) c. seller.html – a page which contains the products sorted by their sellers name (ascending) d. price.html – a page which contains the products sorted by their price (ascending) 3. (10%) The lists shown in these pages should be in a HTML table that shows the SKU, Names, Seller’s Name, and Price for each product. (you should alternate colors between rows and have a table header identifying what item goes where) Part IV: (20%) Creating an Add Product form 1. (20%) Create an addProduct.html page which has a form with the following elements: a. (2%) The action should be addProduct.html and the method should be GET b. (5%) The forms should have input text fields for all fields in the product except category and a textarea for the description. c. (5%) The form should have a select box to select from a list of categories available. d. (2%) The form should include a submit button and a reset button e. (1%) The title of the page and the heading on the page should read “Add New Product”. Part V: (25%) Creating the website 1. (10%) In the pages for the different review lists, change the column headers to be links to the appropriately sorted page. 2. (5%) In the pages for the different review lists, create a link to the add product page. 3. (5%) In the add product page, create a link to the list (index.html) 4. (10%) For all pages, use an external style sheet to beautify the pages in some way. Note: • For Part III/IV/V, the pages should be static and generated via java code within the project. You may handwrite Part IV/Part V, but not Part III. • If the project or the zipped file is NOT named correctly, I will take 10 points off the total score. • If the files within the project are named incorrectly, I will take 10 points off the total score. • If the project doesn’t contain sufficient comments, I will take 10 points off the total score. • This is an individual assignment and what you turn in should represent only your work. • Do NOT try to do this last minute!

CST367467-Homework2Setup/pom.xml

4.0.0 com.mycompany CST367467-Homework2Setup 1.0-SNAPSHOT jar UTF-8 21 21 com.mycompany.cst367467.homework2setup.CST367467Homework2Setup

CST367467-Homework2Setup/src/main/java/com/mycompany/cst367467/homework2setup/InitDB.java

CST367467-Homework2Setup/src/main/java/com/mycompany/cst367467/homework2setup/InitDB.java

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
 */
package  com . mycompany . cst367467 . homework2setup ;


import  java . sql . Connection ;
import  java . sql . DriverManager ;

/**
 * I actually just renamed SetupDB (MySQLTest) to InitDB
 * 
 * and changed the table/column names...
 *  @author  mruth
 */
public   class   InitDB   {

     /**
     *  @param  args the command line arguments
     */
     public   static   void  main ( String []  args )   {
        
         try   {
             Connection  conn  =   DriverManager . getConnection  (
             "jdbc:mysql://localhost:3306/database" ,
             "user" ,   "user" );
            
             //jdbc:mysql://localhost/db?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
             System . out . println ( "If Table Exists... drop it like it's hot" );
             try   {
                
                 String  sql  =   "DROP TABLE PRODUCTS" ;
            
                conn . createStatement (). execute ( sql );
            
                 System . out . println ( "Table Dropped!" );
             }   catch   ( Exception  e )   {
                 System . out . println ( "Table Didn't Exist" );
             }
             try   {
                
                 String  sql  =   "DROP TABLE SELLERS" ;
            
                conn . createStatement (). execute ( sql );
            
                 System . out . println ( "Table Dropped!" );
             }   catch   ( Exception  e )   {
                 System . out . println ( "Table Didn't Exist" );
             }
            
             String  sql  =   "CREATE TABLE SELLERS (" ;
            sql  =  sql  +   " SID INTEGER PRIMARY KEY," ;
            sql  =  sql  +   " NAME VARCHAR(50)," ;
            sql  =  sql  +   " CITY VARCHAR(50)," ;
            sql  =  sql  +   " STATE VARCHAR(2))" ;
           
            conn . createStatement (). execute ( sql );
            
             System . out . println ( "Table SELLERS created!" );
            
            sql  =   "CREATE TABLE PRODUCTS (" ;
            sql  =  sql  +   " SKU INTEGER PRIMARY KEY," ;
            sql  =  sql  +   " NAME VARCHAR(50)," ;
            sql  =  sql  +   " DESCRIPTION VARCHAR(200)," ;
            sql  =  sql  +   " CATEGORY VARCHAR(50)," ;     
            sql  =  sql  +   " SID INTEGER," ;
            sql  =  sql  +   " PRICE DOUBLE ," ;
            sql  =  sql  +   " FOREIGN KEY (SID) REFERENCES SELLERS(SID))" ;
                    
            
            conn . createStatement (). execute ( sql );
            
            
             System . out . println ( "Table PRODUCTS created!" );
             System . out . println ( "DB Complete!" );
            conn . close ();
            
         }   catch   ( Exception  e )   {
             System . out . println ( e );
         }
     }
    
}

CST367467-Homework2Setup/src/main/java/com/mycompany/cst367467/homework2setup/PopulateDB.java

CST367467-Homework2Setup/src/main/java/com/mycompany/cst367467/homework2setup/PopulateDB.java

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
 */
package  com . mycompany . cst367467 . homework2setup ;


import  java . sql . Connection ;
import  java . sql . DriverManager ;
import  java . sql . ResultSet ;
import  java . sql . SQLException ;
import  java . util . ArrayList ;
import  java . util . Random ;

/**
 * Renamed PopulateDBFixedBetter (MySQLTest) to PopulateDB
 *  @author  mruth
 */
public   class   PopulateDB   {

     public   static   Connection  conn ;
    
     /**
     *  @param  args the command line arguments
     */
     public   static   void  main ( String []  args )   {
         try   {
            
            conn  =   DriverManager . getConnection  (
             "jdbc:mysql://localhost:3306/database" ,
             "user" ,   "user" );
            
            
            generateSellers ();
            generateProducts ( 50 );
            
   
            
            
         }   catch   ( Exception  e )   {
             System . out . println ( e );
         }
     }
    
     public   static   void  generateSellers ()   {
        
            

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?