Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Prepare a pilot example of your case study solution using JSPs, beans, and servl

ID: 3599547 • Letter: P

Question

Prepare a pilot example of your case study solution using JSPs, beans, and servlets. Attached you will find an example main menu page for a pilot project. The grade for this project will be a combined grade with the 404 class which will have the same assignment. Prepare a group PowerPoint presentation to brief your pilot. Zip into a single file all JSP, bean, and servlet source code files used in creating your pilot project and attach them to the weekly assignment. All pilot projects deliverables, with the exception of the PowerPoint presentation, must be from individual work, not from group work. Do not forget to fully document all of your source code.

A menu page that links to all the pages in your project.

A page to create all required tables and insert the initial records needed for the application to function.

A page to drop all tables used in the project.

A form, that when submitted, inserts data into a database table(s).

A page the displays the data in the table(s) updated for verification.

The pages for this project should not be plain white pages. Add a few images, styles sheets, etc. that enhance the pages' appearance. It also needs a table to display all wineries, add accounts, importers, and a login page.

It's all with a winery, so I need it to show images of wine, wineries, and etc. It also needs

Explanation / Answer

package com;
import java.util.ArrayList;

public class ArrayWithExponentAsIndexPolynomial implements PolynomialInterface

{

int polynomial[];

int highExp;

ArrayWithExponentAsIndexPolynomial()

{

polynomial=new int[200];

}

ArrayWithExponentAsIndexPolynomial(String pol)

{

polynomial=new int[200];

highExp=0;

int co=0;//Coefficient

int exp=0;//exponent

//Convert the polynomial string into linked list of polynomial terms

for(int i=0;i<pol.length();i++)

{

co=0;

exp=0;

//Find coefficient

while(pol.charAt(i)!='x' && pol.charAt(i)!='X' )

{

if(pol.charAt(i)=='-')

{

i++;

while(i<pol.length())

{

if(pol.charAt(i)!='x' && pol.charAt(i)!='X' )

{

String sub=pol.substring(i,i+1);

co=co*10+Integer.parseInt(sub);

}

else

break;

i++;

}

co=co*-1;

}

else if (pol.charAt(i)=='+')

{

i++;

}

else

{

String sub=pol.substring(i,i+1);

co=co*10+Integer.parseInt(sub);

i++;

}

if(i>=pol.length())

break;

}

i++;//skip x

if(i==pol.length())

{

if(pol.charAt(i-1)=='x' || pol.charAt(i-1)=='X')

exp=1;

}

i++;//skip ^

if(i<pol.length())

while(pol.charAt(i)!='-' && pol.charAt(i)!='+' )

{

String sub=pol.substring(i,i+1);

exp=exp*10+Integer.parseInt(sub);

i++;

if(i>=pol.length())

break;

}

if(highExp<exp)

highExp=exp;

addATerm(exp,co);

i--;

}

}

// stores the coefficient at index(exp)

void addATerm(int exp,int co)

{

// store the coefficient at index(exp)

polynomial[exp]=co;

}

int getHigh()

{

return highExp;

}

@Override

//Adds two polynomials and returns the resultant polynomial

public PolynomialInterface add(PolynomialInterface other)

{

int high;

ArrayWithExponentAsIndexPolynomial temp=new ArrayWithExponentAsIndexPolynomial();

ArrayWithExponentAsIndexPolynomial otherPoly=(ArrayWithExponentAsIndexPolynomial)other;

if(this.getHigh()<otherPoly.getHigh())

{

high=otherPoly.getHigh();

temp.highExp=otherPoly.getHigh();

}

else

{

high=this.getHigh();

temp.highExp=this.getHigh();

}

for(int i=0;i<=high;i++)

{

if(this.polynomial[i]!=0 && otherPoly.polynomial[i]!=0)

{

temp.polynomial[i]=this.polynomial[i]+otherPoly.polynomial[i];

}

else if (this.polynomial[i]==0 && otherPoly.polynomial[i]!=0)

{

temp.polynomial[i]=otherPoly.polynomial[i];

}

else if (this.polynomial[i]!=0 && otherPoly.polynomial[i]==0)

{

temp.polynomial[i]=this.polynomial[i];

}

}

return temp;

}

@Override

//Substracts one polynomial from another and returns the resultant polynomial

public PolynomialInterface subtract(PolynomialInterface other)

{

int high;

ArrayWithExponentAsIndexPolynomial temp=new ArrayWithExponentAsIndexPolynomial();

ArrayWithExponentAsIndexPolynomial otherPoly=(ArrayWithExponentAsIndexPolynomial)other;

if(this.getHigh()<otherPoly.getHigh())

{

high=otherPoly.getHigh();

temp.highExp=otherPoly.getHigh();

}

else

{

high=this.getHigh();

temp.highExp=this.getHigh();

}

for(int i=0;i<=high;i++)

{

if(this.polynomial[i]!=0 && otherPoly.polynomial[i]!=0)

{

temp.polynomial[i]=this.polynomial[i]-otherPoly.polynomial[i];

}

else if (this.polynomial[i]==0 && otherPoly.polynomial[i]!=0)

{

temp.polynomial[i]=0-otherPoly.polynomial[i];

}

else if (this.polynomial[i]!=0 && otherPoly.polynomial[i]==0)

{

temp.polynomial[i]=this.polynomial[i];

}

}

return temp;

}

public String toString()

{

String poly="";

//Convert the linked list into polynomial string

for(int i=this.getHigh();i>=0;i--)

{

if(polynomial[i]!=0)

{

if(i==1)

{

if(polynomial[i]<0)

poly=poly+"-"+polynomial[i]*-1+"x";

else

poly=poly+polynomial[i]+"x";

}

else if(i!=0)

{

if(polynomial[i]<0)

poly=poly+"-"+polynomial[i]*-1+"x^"+i;

else

{

if(i!=this.getHigh())

poly=poly+"+"+polynomial[i]+"x^"+i;

else

poly=poly+polynomial[i]+"x^"+i;

}

}

else

{

if(polynomial[i]<0)

poly=poly+"-"+polynomial[i]*-1;

else

poly=poly+"+"+polynomial[i];

}

}

}

return poly;

}


}