I need help with c and d page 314 and 315 https://www.bau.edu.jo/inst/hamza/SAbo
ID: 3824577 • Letter: I
Question
I need help with c and d
page 314 and 315 https://www.bau.edu.jo/inst/hamza/SAbook.pdf
As the lead analyst on the Hoosier Burger project, you have had the opportunity to learn more about the systems development process, work with project team members, and interact with the system's end users, especially with Bob and Thelma. You have just completed the design work for the various forms and reports that will be used by Bob, Thelma, and their employees. Now it is time to prepare logical and physical database designs for the new Hoosier Burger system. During a meeting with Hoosier Burger project team members, you review the four steps in logical database modeling and design. It will be your task to prepare the logical models for the Customer Order Form, Customer Account Balance Form, Daily Delivery Sales Report, and Inventory Low-in-Stock Report. At the next meeting, the E-R model will be translated and a final logical model produced. a. Develop logical models for each of the interfaces mentioned in the case scenario. b. Integrate the logical models prepared for part a into a consolidated logical model. c. What types of problems can arise from view integration? Did you encounter any of these problems when preparing the consolidated logical model? d. Using your newly constructed logical model, determine which fields should be indexed. Which fields should be designated as calculated fields? Consolidated logical model The above identified fields are inserted into the table and made it final. The above shown fields are in consolidated logical model. In order to create or design the logical model into the consolidated logical model, the individually designed or separated sets of relations in normalized form are clubbed or combined into a single relation or table. This process of merging the separate sets of logical models is known as View integration and it results in the creation of the consolidated logical model. Relations in the consolidated Logical Model are as shown: Customer_Order_Form(Customer_order_form_id, customer_order_Desc, customer_name, customer_id, quantity_id, quantity_ordered, sale_Date, total_amount) Customer_Account_Balance_Form (customer_id, amount_paid, amount_due, date) Daily_Delivery_Sales_Report(receipt_id, Date, Products_delivered, Customer_id) lnventory_Low_in_Stock (product_id, item_Desc, quantity_in_stock, minimum_order_quantity, quantities_left_in_Stock) Fields indexed and calculated field Fields indexed are Customer_order_form_id in the Customer_Order_Forms as it is the only id with which user can know the Customer_order. Customer_id in Customer_Account_Balance can be indexed as primary key as it is key with which the customers are uniquely identified. Daily_Sale_Service_Report contains the receipt_id as the primary key Inventory_Low_in_Stock contains the product_id as the primary key. amount_due in the Customer_Account_Balance_Form is the calculated field as this data is obtained when a calculation is performed on the amount_paid. quantities_left_in_stock in Inventory_Low_in_Stock is a calculated field which is obtained from the quantity_in_stockExplanation / Answer
emp class:
package beans;
public class Employee implements java.io.Serializable
{
int id;
String name;
int deptno;
double salary;
String desg;
String dname;
public Employee()
{}
public Employee(int id,
String name,
double salary,
String desg,
String dname)
{
this.id=id;
this.deptno=deptno;
this.salary=salary;
this.desg=desg;
this.dname=dname;
}
public int getId()
{
return id;
}
public void setId(int id)
{
this.id=id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name=name;
}
public int getDeptno()
{
return deptno;
}
public void setDeptno(int deptno)
{
this.deptno=deptno;
}
public double getSalary()
{
return salary;
}
public void setSalary(double salary)
{
this.salary=salary;
}
public String getDesg()
{
return desg;
}
public void setDesg(String desg)
{
this.desg=desg;
}
public String getDname()
{
return dname;
}
public void setDname(String dname)
{
this.dname=dname;
}
}
main servlet:
import beans.Employee;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.ArrayList;
public class MainServlet extends HttpServlet
{
ModelBean mb = null;
HttpSession hs = null;
public void init(ServletConfig config)throws ServletException
{
super.init(config);
mb = new ModelBean();
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
{
doPost(req, res);
} // doGet()
public void doPost(HttpServletRequest req, HttpServletResponse res)
{
try
{
hs = req.getSession();
String sourcePage, target= null;
sourcePage = req.getParameter("source");
if(sourcePage.equalsIgnoreCase("login"))
{
String un = req.getParameter("uname");
String pw = req.getParameter("pwd");
boolean userExists = mb.authenticate(un, pw);
if(userExists)
{
ArrayList list = mb.getAllDepartmentNames();
hs.setAttribute("DeptNameDetails", list);
target = "Process.html";
}
else
{
req.setAttribute("msg", new String("Invalid Username/Password"));
target = "Login.jsp";
}
} // if
else if (sourcePage.equalsIgnoreCase("search"))
{
String eno = req.getParameter("eid");
String dname = req.getParameter("dept");
String ename = req.getParameter("ena");
String desg = req.getParameter("desg");
if(dname==null || dname.length() == 0)
dname = "%";
else
dname.concat("%");
ename = (ename==null||ename.length() == 0 ? "%" : ename.concat("%"));
desg = (desg==null||desg.length() == 0 ? "%" : desg.concat("%"));
ArrayList list = mb.getSearchResults(eno, ename, desg, dname);
req.setAttribute("SearchResults", list);
target = "Results.jsp";
} // else if
// Forwarding the control to "target" page.
RequestDispatcher rd = req.getRequestDispatcher(target);
rd.forward(req, res);
} // try
catch(Exception e)
{
e.printStackTrace();
}
} // doPost()
public void destroy()
{
mb = null;
}
} // MainServlet
model class:
import java.sql.*;
import java.io.*;
import java.util.*;
import beans.Employee;
public class ModelBean
{
static Connection con = null;
static
{
try
{
InputStream is = new FileInputStream("d:\details.props");
Properties p = new Properties();
p.load(is);
String dname = p.getProperty("driver");
String url = p.getProperty("url");
String user= p.getProperty("user");
String pass = p.getProperty("password");
Class c = Class.forName(dname);
con = DriverManager.getConnection(url,user, pass);
} // try
catch(ClassNotFoundException ce)
{
ce.printStackTrace();
}
catch(IOException ie)
{
ie.printStackTrace();
}
catch(SQLException se)
{
se.printStackTrace();
}
} // static block
public boolean authenticate(String username, String password)
{
PreparedStatement ps = null;
ResultSet rs = null;
boolean result = false;
try
{
String query;
query = "SELECT COUNT(*) FROM MY_USERS " +
" WHERE USERNAME=? AND PWD=? ";
ps = con.prepareStatement(query);
ps.setString(1, username);
ps.setString(2, password);
rs = ps.executeQuery();
rs.next(); // Moves the record pointer to the first record.
if(rs.getInt(1) != 0)
result = true;
} // try
catch(SQLException se)
{
se.printStackTrace();
}
finally
{
if(rs != null)
{
try
{
rs.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
if(ps != null)
{
try
{
ps.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
} // finally
return result;
} // authenticate() method
public ArrayList getAllDepartmentNames()
{
PreparedStatement ps = null;
ResultSet rs = null;
ArrayList list=new ArrayList();
try
{
String query;
query = "SELECT DISTINCT DNAME FROM MY_DEPT";
ps = con.prepareStatement(query);
rs = ps.executeQuery();
// All department names are added to ArrayList.
while(rs.next())
{
list.add(rs.getString("DNAME"));
}
} // try
catch(SQLException se)
{
se.printStackTrace();
}
finally
{
if(rs != null)
{
try
{
rs.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
if(ps != null)
{
try
{
ps.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
} // finally
return list;
} // getAllDepartmentNames() method
public ArrayList getSearchResults(String eno, String ename,
String desg, String dname)
{
PreparedStatement ps = null;
ResultSet rs = null;
ArrayList list=new ArrayList();
try
{
String query;
query = " SELECT MY_EMP.DEPTNO, ENO, ENAME,SAL, DESG, DNAME " +
" FROM MY_EMP,MY_DEPT " +
" WHERE MY_EMP.DEPTNO = MY_DEPT.DEPTNO " +
" AND MY_EMP.ENAME LIKE ? " +
" AND MY_EMP.DESG LIKE ? " +
" AND MY_DEPT.DNAME LIKE ? ";
if(eno != null && eno.length() != 0)
query.concat(" AND MY_EMP.ENO = ? ");
ps = con.prepareStatement(query);
ps.setString(1, ename);
ps.setString(2, desg);
ps.setString(3, dname);
if(eno != null && eno.length() != 0)
ps.setInt(4, Integer.parseInt(eno));
rs = ps.executeQuery();
// Each record data present in the ResultSet object,
// is stored in a Employee instance, and all instances
// are added to ArrayList.
while(rs.next())
{
Employee emp=new Employee();
emp.setDeptno(rs.getInt("deptno"));
emp.setId(rs.getInt("eno"));
emp.setName(rs.getString("ename"));
emp.setDesg(rs.getString("desg"));
emp.setSalary(rs.getDouble("sal"));
emp.setDname(rs.getString("dname"));
list.add(emp);
}
} // try
catch(SQLException se)
{
se.printStackTrace();
}
finally
{
if(rs != null)
{
try
{
rs.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
if(ps != null)
{
try
{
ps.close();
}
catch(SQLException se)
{
se.printStackTrace();
}
}
} // finally
return list;
} // getSearchResults() method
} // ModelBean
wed.xml
<web-app>
<welcome-file-list>
<welcome-file>Login.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>XYZ</servlet-name>
<servlet-class>MainServlet</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>XYZ</servlet-name>
<url-pattern>/controller</url-pattern>
</servlet-mapping>
</web-app>
database:
create table student_info(stu_id number,stu_name varchar2(20),stu_add varchar2(20));
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.