Question

l. According to the system description below, draw a Data Flow Diagram (DFD). As one of our project topic is e-commerce platform, suppose we are developing one with the following functions: Login Validation: A user first inputs a username and password to the system for validation. The system will retrieve the username from the list of user names and associated passwords. If either the input username or password is wrong, the system will return a message to the user and stay at the login interface. If successfully logging in, the user can choose one of the following actions. Search Items: With the username, the user can search for an item by inputting the item name. After retrieving the list of items, the system will show several alternative items for the user to choose. Once the final item is chosen, it will be stored in the users shopping cart. Pay Items: Another option after login is to directly pay all the items in the shopping cart. The user will provide his/her e-banking account information. The system will check from the e-banking account database (if invalid, return a message to user), retrieve the items information from the shopping ca and print a receipt on screen to the user. Also the items to pay will be stored in the users buying history

0 0
Add a comment Improve this question Transcribed image text
Answer #1

package beans;

public class BookBean
{
   private String bookid;
   private String bookname;
   private String authorname;
   private String status;
  
   public void setBookId(String bookid)
   {
       this.bookid = bookid;
   }
   public String getBookId()
   {
       return bookid;
   }
   public void setBookName(String bookname)
   {
       this.bookname = bookname;
   }
   public String getBookName()
   {
       return bookname;
   }
   public void setAuthorName(String authorname)
   {
       this.authorname = authorname;
   }
   public String getAuthorName()
   {
       return authorname;
   }
   public void setStatus(String status)
   {
       this.status = status;
   }
   public String getStatus()
   {
       return status;
   }
} // BookBean class.

//DBCONNECTION

package beans;

import java.io.*;
import java.sql.*;
import java.util.ArrayList;

public class DbConnector
{
   private int found=0;

   public Connection getConnection()
   {
       Connection con = null;
       try
       {
           Class.forName("oracle.jdbc.driver.OracleDriver");
           con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","scott","tiger");
       }
       catch(Exception e)
       {
           e.printStackTrace();
       }
       return con;
   }

   public ArrayList search(String category)
   {
       Connection con = getConnection();
       PreparedStatement ps = null;
       ResultSet rs = null;
       ArrayList al = new ArrayList();

       try
       {
           String searchQuery;
           searchQuery = "SELECT BOOKID, BOOKNAME, AUTHORNAME, STATUS " +
                                   " FROM SELECT_BOOKS WHERE CATEGORY = ? ";
           ps = con.prepareStatement(searchQuery);

           ps.setString(1, category);
           rs = ps.executeQuery();

           while(rs.next())
           {
               BookBean b = new BookBean();
               b.setBookId(rs.getString(1));
               b.setBookName(rs.getString(2));
               b.setAuthorName(rs.getString(3));
               b.setStatus(rs.getString(4));
               al.add(b);
           }
           rs.close();
       }
       catch(Exception e)
       {
       e.printStackTrace();
       }
       finally
       {
           if(ps != null)
           {
               try
               {
                   ps.close();
               }
               catch(Exception e)
               {
                   e.printStackTrace();
               }
           }
           if(con != null)
           {
               try
               {
                   con.close();
               }
               catch(Exception e)
               {
                   e.printStackTrace();
               }
           }
       } // finally
       return al;
   } // search()
} // class

//SELECTION BOOK

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import beans.DbConnector;

public class SelectedBooks extends HttpServlet
{
   public void doPost(HttpServletRequest req, HttpServletResponse res)
   {
       try
       {
           String cat = req.getParameter("category");
           String checkAction=req.getParameter("source");

           DbConnector dbc = new DbConnector();

           ArrayList al = dbc.search(cat);
           req.setAttribute("list", al);
           req.setAttribute("category", cat);

           String target;
           if(checkAction.equalsIgnoreCase("Html"))
                   target = "HtmlPrint.jsp";
           else
                   target = "ExcelScreen.jsp";

           RequestDispatcher rd = null;
           rd = req.getRequestDispatcher(target);
           if(rd != null)
               rd.forward(req,res);
       } // try
       catch(Exception e)
       {
           e.printStackTrace();
       }
   } // doPost()
} // class

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
   <welcome-file-list>
       <welcome-file>Search.jsp</welcome-file>
   </welcome-file-list>

   <servlet>
   <servlet-name>search</servlet-name>
   <servlet-class>SelectedBooks</servlet-class>
   </servlet>

   <servlet-mapping>
   <servlet-name>search</servlet-name>
   <url-pattern>/BookSearchServlet</url-pattern>
   </servlet-mapping>
</web-app>

Add a comment
Know the answer?
Add Answer to:
According to the system description below, draw a Data Flow Diagram (DFD). As one of our...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please provide a SQL Table diagram with their relationships based on the following prompt: Consider the...

    Please provide a SQL Table diagram with their relationships based on the following prompt: Consider the design of a database for an online store. Each item is identified by a unique item ID, a title, a description of the item, the date the item is posted, price, and a list of categories (each category is a single word in lower cases). Only registered users can post, buy, and review an item. Each registered user is identified by a user ID,...

  • This assignment requires the development of C++ software that supports order processing, account ...

    This assignment requires the development of C++ software that supports order processing, account management, and inventory control activities of an imaginary food service. Assume that customers of this food service will use a separate Web-based app (not included in this assignment) to browse product catalogs and then create shopping lists stored in specially formatted text files (see input definitions below). Each shopping list may include: Food item names and quantity. Coupon information that includes the name of the food and...

  • Analyse any three functional, nonfunctional and system requirements of the below given system this question repost...

    Analyse any three functional, nonfunctional and system requirements of the below given system this question repost to edit the answer Al Nada Hyper market, Muscat has recently introduced an Automated Shopping Cart facility to its customers to ease their purchase experience. It allows shoppers to create a shopping list before or during the process of shopping using “Shopping List” feature on the automated cart. Budget can be set prior to the start of purchase by the shoppers using “Budget Alert”...

  • Solve the code below: CODE: """ Code for handling sessions in our web application """ from bottle import request, response import uuid import json import model import dbsche...

    Solve the code below: CODE: """ Code for handling sessions in our web application """ from bottle import request, response import uuid import json import model import dbschema COOKIE_NAME = 'session' def get_or_create_session(db): """Get the current sessionid either from a cookie in the current request or by creating a new session if none are present. If a new session is created, a cookie is set in the response. Returns the session key (string) """ def add_to_cart(db, itemid, quantity): """Add an...

  • I need help writting a Javascript function that does the following its for a HTML/CSS Shopping...

    I need help writting a Javascript function that does the following its for a HTML/CSS Shopping Cart Page CODE This page contains a list of the selected products that includes an image, name, price, quantity, and cost) Because the process is implemented not as real, three products along with its image and price are displayed on the page. The product ID of each product is stored in a hidden textbox. The default amount of each product is 1 and the...

  • # No plagiarism #Decide on the type of motherboard to use in the computer system you...

    # No plagiarism #Decide on the type of motherboard to use in the computer system you are designing. Explain what it is and why you chose it. This from Lab 5.1 Using the information you recorded previously in Step 5, consult Table 5-1 to find out how to enter your system’s setup utility. (Alternatively, when you first turn on your PC, look for a message on your screen, which might read something like “Press F2 to access setup.” Table 5-1:...

  • CASE 8 Unlocking the Secrets of the Apple iPhone in the Name of access the male...

    CASE 8 Unlocking the Secrets of the Apple iPhone in the Name of access the male San Bernardino suspect's iPhone 5c. Cook stated: Antiterrorism We are challenging the FBI's demands with the deepes respect for American democracy and a love of our country. We believe it would be in the best interest of everyone to step back and consider the implications While we believe the FBI's intentions are good, if would be wrong for the w e nt to force...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT