Import java



HTML + CSS

Sample Coding

doc1.htm

HTML Basics

Welcome!

I cause a blank line after me and my letters are bold.

Now I will break in the line without a blank line after me

I look like forward movement. Italics

doc2.htm

Numbered or

Ordered

List

Unnumbered List:

Vermont

New Hampshire

Nested Bullets:

Michigan

Indiana

My text stays as it is typed.

I don’t interpret program code. #!/bin/csh

cd $SCR

I can't display HTML code

I display HTML code on a HomePage

Click here for news ...

Fizzics2.htm

New Advances in Physics

New Advances in Physics

Turning Gold into Lead

In a startling breakthrough, scientist B.O. "Gus" Fizzics

has invented a practical technique for

transmutation! For more details, please see

our transmutation thesis.

Perpetual Inactivity Machine

In a radical approach that turned traditional attempts to

develop perpetual motion machines on their heads, Prof.

Fizzics has developed a verified, bona fide perpetual

inaction machine. To purchase your own for

only $99.00 (plus $43.29 shipping and handling), please see

our order form.

Fizzics.css

H1 { text-align: center;

font-family: Blackout }

H2 { font-family: MeppDisplayShadow }

STRONG { text-decoration: underline }

Cabinets.htm

Joe's Cabinets

Joe's Cabinets

Welcome to Joe's Cabinets. We specialize in

Custom Cabinets

Kitchen Remodeling

Cabinets.css

.banner { background: url(images/boards.jpg) repeat-x;

font-size: 50pt;

font-family: Arial Rounded MT Bold }

Bates.htm

An Open Letter to the IRS

April 1, 2001

William A. Bates

Macrosoft Corporation

Blumond, WA 12345

Internal Revenue Service

Philadelphia, PA 67890

Dear Sirs,

I am writing to inform you that, due to financial difficulties,

I will be unable to pay my taxes this year.

You see, my company has had reduced profits this year. In fact

gross revenues have now dropped below the GDP of twelve

foreign countries! Given this intolerable situation, I am sure

you will understand.

Sincerely,

William A. Bates

Bates.css

P { margin-top: 5px }

P.rhead { text-align: right;

margin-right: 0.5in;

font-family: sans-serif }

P.lhead { font-family: sans-serif }

P.body { text-align: justify;

text-indent: 0.5in }

P.foot { margin-left: 60%;

line-height: 300% }

JavaScript Programs

Hello

// This is a comment in JavaScript

document.write("Hello folks!");

Welcome to this class!

For in Loop

for (var i in window) {

document.write (i + "")

}

Arguments & Parameters

All done.

Convert to Upper Case (onChange)

function convertField(field) {

if (document.form1.convertUpper.checked) {

field.value = field.value.toUpperCase()}

}

function convertAllFields() {

document.form1.lastName.value = document.form1.lastName.value.toUpperCase()

document.form1.firstName.value = document.form1.firstName.value.toUpperCase()

}

Last name:

First name:

Convert fields to upper case

Hidden object

Jazz

Radio Buttons

Soul and R&B

Jazz

Classical

Selected Music:

Radio Buttons with CGI submit

Soul and R&B

Jazz

Classical

Selected Music:

Submit Confirmation

// With JavaScript, can get the user the confirm before submitting a form.

function submitMe(form) {

if (confirm("Are you sure you want to submit this form?"))

return (true)

else

return (false)

}

Selection List

// Displays a selection list and a scrolling list. Then shows the selections.

function testSelect(form) {

index = form.music_type_single.selectedIndex

alert(form.music_type_single.options[index].text+" and "+

form.music_type_multi.selectedIndex)

}

Choose the music type for your free CD:

R&B Jazz Blues

Choose the music types for your free CDs:

R&B Jazz Blues

Text Selection

creates a text object that is 25 characters long. The text field appears immediately to the right of the words "Last name:". The text field is blank when the form loads.

Last name:

creates two text objects on a form. Each object has a default value. The city object has an onFocus event handler that selects all the text in the field when the user tabs to that field. The state object has an onChange event handler that forces the value to upper case.

City:

State:

Windows Manipulation

Window object example: Window 1

window2=open('win2.htm','secondWindow','scrollbars=yes,width=250,height=400')

document.writeln("The first window has no name: " + window.name + "")

document.writeln("The second window is named: " + window2.name + "")

Event Handler (onBlur)

A Literary Exercise

The novel A Void does not contain a single "e".

Can you create a sentence without one?

Simple Validation (Empty & E-mail fields)

Enter your name:

Enter your e-mail address:

Simple Validation (Range)

A Simple Form Validation Example

Enter a number between 1 and 9:

Simple Clock

JavaScript Clock

Now you can add a clock to your pages!

SRC = *.js property

Using JavaScript SRC = *.JS Extension

Cookie

Widgets "R" Us

Widgets "R" Us

First Name:

Last Name:

Account Number:

Widget Name:

Illustrating the concept of Abstract Classes

(Account, SavingsAccount, and TestAccountSystem)

/**

* Abstract class Account - write a description of the class here

*

* @author (your name here)

* @version (version number or date here)

*/

public abstract class Account

{

// instance variables

String accountHolder;

int balance;

public Account (String accountHolder, int balance) {

this.accountHolder = accountHolder;

this.balance = balance;

}

public abstract void deposit(int amountToBeDeposited);

public abstract int withdraw(int amountToBeWithdrawn);

public void print() {

System.out.println("accountHolder = " + accountHolder);

System.out.println("balance = " + balance);

}

}

/**

* Write a description of class SavingsAccount here.

*

* @author (your name)

* @version (a version number or a date)

*/

public class SavingsAccount extends Account

{

float interestRate;

public SavingsAccount (String accountHolder, int balance, float interestRate) {

super(accountHolder, balance);

this.interestRate = interestRate;

}

public void deposit (int amountToBeDeposited)

{

balance += amountToBeDeposited;

}

public int withdraw (int amountToBeWithdrawn)

{

balance -= amountToBeWithdrawn; // pretend that we always have enough fund

return 0; // always succeed, i.e., status of 0

}

public void print() {

super.print();

System.out.println("interestRate = " + interestRate);

}

}

/**

* Write a description of class TestAccountSystem here.

*

* @author (your name)

* @version (a version number or a date)

*/

public class TestAccountSystem

{

public static void main (String args[]) {

//Account acct = new Account("Billy", 1000); //will cause error

SavingsAccount acct = new SavingsAccount("Billy", 1000, 0.03f);

System.out.println("The state of the acct object:");

acct.print();

acct.withdraw(2000); // balance is now -$1000

acct.deposit(80000000); // won the lottery $80 millions

System.out.println("The state of the acct object:");

acct.print();

}

}

// output:

// The state of the acct object:

// accountHolder = Billy

// balance = 1000

// interestRate = 0.03

// The state of the acct object:

// accountHolder = Billy

// balance = 79999000

// interestRate = 0.03

Exception Handling: Try-Catch-Finally

public class TestNoTryCatch {

public static void main(String argv[]) {

int x = 0;

int y;

y = 1/x;

System.out.println("Testing 123…");

System.out.println ("Testing 456…");

}

}

public class TestTryCatch {

public static void main(String argv[]) {

try {

int x = 0;

int y;

y = 1/x;

System.out.println("Testing 123…");

} catch (ArithmeticException e) {

System.out.println("Div by 0");

}

System.out.println ("Testing 456…");

}

}

public class TestTryCatch2 {

public static void main(String argv[]) {

try {

int x = 0;

int y;

y = 1/x;

System.out.println("Testing 123…");

} catch (ArrayIndexOutOfBoundsException e) {

System.out.println("ArrayIndexOutOfBoundsException!");

}

System.out.println ("Testing 456…");

}

}

public class TestTryCatch3 {

public static void main(String argv[]) {

try {

int x = 0;

int y;

y = 1/x;

System.out.println("Testing 123…");

} catch (ArrayIndexOutOfBoundsException e) {

System.out.println("ArrayIndexOutOfBoundsException!");

}

catch (Exception e) {

System.out.println("General exception!");

}

System.out.println ("Testing 456…");

}

}

public class TestTryCatch4 {

public static void main(String argv[]) {

try {

int x = 0;

int y;

y = 1/x;

System.out.println("Testing 123…");

} catch (ArrayIndexOutOfBoundsException e) {

System.out.println("ArrayIndexOutOfBoundsException!");

}

finally {

System.out.println("Clean Up, always!");

}

System.out.println ("Testing 456…");

}

}

public class TestTryCatchFinally {

public static void main(String argv[]) {

try {

int x = 0;

int y;

y = 1/x;

System.out.println("Testing 123…");

} catch (ArithmeticException e) {

System.out.println("Div by 0");

} finally {

System.out.println("Clean Up, always!");

}

System.out.println ("Testing 456…");

}

}

Servlets: Java and HTML files

()

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

public class MyFirstServlet extends HttpServlet {

public void doGet (HttpServletRequest request,

HttpServletResponse response)

throws ServletException, IOException {

response.setContentType("text/html"); // sending HTML

ServletOutputStream out = response.getOutputStream();

out.println("");

out.println("First Servlet");

out.println("");

out.println("Hello There!");

out.println("Thank you for visiting our site!");

out.println("");

}

}

FormWithStuff.html

User Information

User Information

First Name:

Last Name:

Gender: Male

Female

Position:

CEO

Professor

Java Programmer

Indutry: (Hold the CTRL key to select multiple entries)

Education

Manufacturing

Government

Retail

Hobbies:

Sports

Reading

Travel

MySecondServlet

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

// Use getParameter() and getParameterValues()

public class MySecondServlet extends HttpServlet {

public void doPost (HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

String first = request.getParameter("firstname");

String last = request.getParameter("lastname");

String gender = request.getParameter("gender");

if (gender == null)

gender = "";

String position = request.getParameter("position");

String multi[] = request.getParameterValues("industry");

String temp = "";

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

temp += multi[i] +"; ";

String sports = request.getParameter("sports");

if (sports == null)

sports = "";

String reading = request.getParameter("reading");

if (reading == null)

reading = "";

String travel = request.getParameter("travel");

if (travel == null)

travel = "";

String hobbies = sports + "; " + reading + "; " + travel;

// now go and generate a semi-customized page for the user!

String message = "Hello "+first+" "+last+"";

message += "I see that you are a " + gender + " " +position+"";

message += "Our expertise coincides with the industries you are in, namely " + temp+"";

message += "Believe it or not, we also share the hobbies of " + hobbies;

reply(request, response, message);

}

private void reply (HttpServletRequest request, HttpServletResponse response, String

message) throws ServletException, IOException {

// text/html is the default MIME type for the response so this isn't needed!

response.setContentType("text/html");

PrintWriter out = response.getWriter();

out.println("");

out.println("Second Servlet");

out.println("Our Analysis of Your Request");

if (message != null) out.println(""+message+"");

out.println("We are perfect for one another. Let's talk!");

out.println("Thank you for selecting our service!");

out.println("");

}

public void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

reply(request, response, "Hi John Doe");

}

}

SessionExampleWithAttribute

// Adopted from Deitel's book. Rreplaced the old methods with the new ones.

// Fig. 29.13: SessionExample.java

// Using sessions.

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import java.util.*;

public class SessionExampleWithAttribute extends HttpServlet {

private final static String names[] =

{ "C", "C++", "Java", "Visual Basic 6" };

private final static String isbn[] = {

"0-13-226119-7", "0-13-528910-6",

"0-13-012507-5", "0-13-456955-5" };

public void doPost( HttpServletRequest request,

HttpServletResponse response )

throws ServletException, IOException

{

PrintWriter output;

String language = request.getParameter( "lang" );

// Get the user's session object.

// Create a session (true) if one does not exist.

HttpSession session = request.getSession( true );

// add a value for user's choice to session

session.setAttribute( language, getISBN( language ) );

response.setContentType( "text/html" );

output = response.getWriter();

// send HTML page to client

output.println( "" );

output.println( "Sessions" );

output.println( "" );

output.println( "Welcome to Sessions!" );

output.println( "" );

output.println( language );

output.println( " is a great language." );

output.println( "" );

output.close(); // close stream

}

public void doGet( HttpServletRequest request,

HttpServletResponse response )

throws ServletException, IOException

{

PrintWriter output;

// Get the user's session object.

// Don't create a session (false) if one does not exist.

HttpSession session = request.getSession( false );

// get names of session object's values

Enumeration keyNames;

if ( session != null )

keyNames = session.getAttributeNames();

else

keyNames = null;

response.setContentType( "text/html" );

output = response.getWriter();

output.println( "" );

output.println( "Sessions II" );

output.println( "" );

if ( keyNames != null ) {

output.println( "Recommendations" );

// get value for each name in keyNames

while (keyNames.hasMoreElements()) {

String key = (String) keyNames.nextElement();

String value = (String) session.getAttribute( key );

output.println(key + " How to Program. " + "ISBN#: " + value + "" );

}

}

else {

output.println( "No Recommendations" );

output.println( "You did not select a language" );

}

output.println( "" );

output.close(); // close stream

}

private String getISBN( String lang )

{

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

if ( lang.equals( names[ i ] ) )

return isbn[ i ];

return ""; // no matching string found

}

}

SelectLanguage2.html

Sessions

Select a programming language:

C

C++

Java

Visual Basic 6

BookRecommendation2.html

Sessions

Press "Recommend books" for a list of books.

GetCoffee

package coffee;

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

/** Simple servlet that retrieves coffee data from an Access DB.

*

*/

public class GetCoffee extends HttpServlet {

String URL = "jdbc:odbc:CoffeeDB";

Connection conn;

Statement stmt;

String query = "select COF_NAME, PRICE from COFFEES";

public void init( ServletConfig config ) throws ServletException {

super.init( config );

try {

Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );

} catch(Exception e) {

System.err.println(e.getMessage());

}

}

public void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

response.setContentType("text/html");

PrintWriter out = response.getWriter();

String title = "Retrieval Result";

String headTag = ""+title+"";

String selectResult = "";

String endHeadTag = "";

try {

conn = DriverManager.getConnection(URL, "", "" );

}

catch (SQLException e) {

System.err.println(e.getMessage());

}

selectResult = selectCoffeeFromDB();

String outString = headTag + endHeadTag +

"\n" +

"" + title + "\n" +

selectResult +

"";

out.println(outString);

System.out.println(outString);

try {

conn.close();

}

catch (SQLException e) {

System.err.println(e.getMessage());

}

}

private String selectCoffeeFromDB() {

String resultString = "";

try {

stmt = conn.createStatement();

ResultSet rs = stmt.executeQuery(query);

while (rs.next()) {

String s = rs.getString("COF_NAME");

float f = rs.getFloat("PRICE");

resultString += s + " " + f + "";

}

rs.close();

stmt.close();

}

catch ( Exception e ) {

System.err.println(

"ERROR: Problems with SQL select" );

e.printStackTrace();

}

return resultString;

}

}

GetCoffeeWithError

package coffee;

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

/** Simple servlet that retrieves coffee data from an Access DB.

*

*/

public class GetCoffeeWithError extends HttpServlet {

String URL = "jdbc:odbc:CoffeeDB123";

Connection conn;

Statement stmt;

String query = "select COF_NAME, PRICE from COFFEES";

public void init( ServletConfig config ) throws ServletException {

System.out.println("Got here ... 111");

super.init( config );

try {

Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );

} catch(Exception e) {

System.err.println(e.getMessage());

return;

}

System.out.println("Got here ... 222");

}

public void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

response.setContentType("text/html");

PrintWriter out = response.getWriter();

String title = "Retrieval Result";

String headTag = ""+title+"";

String selectResult = "";

String endHeadTag = "";

System.out.println("Got here ... 333");

try {

conn = DriverManager.getConnection(URL, "", "" );

}

catch (SQLException e) {

System.err.println(e.getMessage());

return;

}

System.out.println("Got here ... 444");

selectResult = selectCoffeeFromDB();

String outString = headTag + endHeadTag +

"\n" +

"" + title + "\n" +

selectResult +

"";

out.println(outString);

System.out.println(outString);

try {

conn.close();

}

catch (SQLException e) {

System.err.println(e.getMessage());

}

}

private String selectCoffeeFromDB() {

String resultString = "";

try {

stmt = conn.createStatement();

ResultSet rs = stmt.executeQuery(query);

while (rs.next()) {

String s = rs.getString("COF_NAME");

float f = rs.getFloat("PRICE");

resultString += s + " " + f + "";

}

rs.close();

stmt.close();

}

catch ( Exception e ) {

System.err.println(

"ERROR: Problems with SQL select" );

e.printStackTrace();

}

return resultString;

}

}

GetCoffeeExtraShot

package coffee;

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

/** Simple servlet that retrieves coffee data from an Access DB.

* Adds: Date, HTML table for formatting

*

*/

public class GetCoffeeExtraShot extends HttpServlet {

String URL = "jdbc:odbc:CoffeeDB";

Connection conn;

Statement stmt;

String query = "select COF_NAME, PRICE, ORD_DATE from COFFEES2";

String CR = "\n";

public void init( ServletConfig config ) throws ServletException {

super.init( config );

try {

Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );

} catch(Exception e) {

System.err.println(e.getMessage());

}

}

public void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

response.setContentType("text/html");

PrintWriter out = response.getWriter();

String title = "Retrieval Result";

String headTag = ""+title+"";

String selectResult = "";

String endHeadTag = "";

try {

conn = DriverManager.getConnection(URL, "", "" );

}

catch (SQLException e) {

System.err.println(e.getMessage());

}

selectResult = selectCoffeeFromDB();

String outString = headTag + endHeadTag +

"\n" +

"" + title + "\n" +

selectResult +

"";

out.println(outString);

// System.out.println(outString);

try {

conn.close();

}

catch (SQLException e) {

System.err.println(e.getMessage());

}

}

private String selectCoffeeFromDB() {

// build the table heading

String tableHead = "" + CR;

tableHead += "" + CR;

tableHead += " " + CR;

tableHead += "Coffee Name" + CR;

tableHead += "Price" + CR;

tableHead += "Date Ordered" + CR;

tableHead += "" + CR;

String htmlBody = "";

try {

stmt = conn.createStatement();

ResultSet rs = stmt.executeQuery(query);

int rowNumber = 1;

// build the table body

String tableBody = "";

while (rs.next()) {

String s = rs.getString("COF_NAME");

float f = rs.getFloat("PRICE");

Date ordDate = rs.getDate("ORD_DATE");

tableBody += toTableString(rowNumber, s, f, ordDate);

rowNumber++;

}

rs.close();

stmt.close();

// build the table bottom

String tableBottom = "";

// build html page bottom

String htmlBottom = "";

// build complete html page

htmlBody += tableHead + tableBody + tableBottom;

}

catch ( Exception e ) {

System.err.println(

"ERROR: Problems with SQL select" );

e.printStackTrace();

}

return htmlBody;

}

// returns data formatted for an HTML table row

public String toTableString(int rowNumber, String cofName, float price, Date ordDate) {

String replyString = "";

String tdBegin = "";

String tdEnd = "" + CR;

replyString += "" + CR;

replyString += tdBegin + rowNumber + tdEnd;

replyString += tdBegin + cofName + tdEnd;

replyString += tdBegin + price + tdEnd;

replyString += tdBegin + ordDate + tdEnd;

replyString += "" + CR;

return replyString;

}

}

import java.io.*;

import javax.servlet.*;

import javax.servlet.http.*;

import java.util.*;

import java.sql.*;

/** This servlet shows how one can

* 1. Write a doGet method that returns an HTML form

* 2. Write a doPost method to retrieve the values in the form and insert them

* into an Access DB

*/

public class RegisterEmailURLServlet extends HttpServlet {

String URL = "jdbc:odbc:StudentDB";

Connection conn;

Statement stmt;

public void init() throws ServletException {

super.init();

try {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // load the driver

}

catch(Exception e) {

System.err.println(e.getMessage());

}

}

// Process the form submitted. Get the form elements' values, build the insert string

// and insert into Access

public void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

response.setContentType("text/html");

PrintWriter out = response.getWriter();

String givenSSN = request.getParameter("ssn");

String givenPassword = request.getParameter("password");

String givenEmail = request.getParameter("email");

String givenURL = request.getParameter("url");

System.out.println("params received ="+givenSSN+";"+givenPassword+";"+

givenEmail+";"+givenURL);

String title = "Registration Result";

String headTag = ""+title+"";

String registrationResult;

int rowCount = 0;

try {

conn = DriverManager.getConnection(URL,"","");

stmt = conn.createStatement();

String insertString = "INSERT INTO student values ('"

+ givenSSN + "','"

+ givenPassword + "','"

+ givenEmail + "','"

+ givenURL + "')";

System.out.println("insert string =" + insertString);

rowCount = stmt.executeUpdate(insertString);

} catch (SQLException e) {

System.err.println(e.getMessage());

}

// if insert is successful, rowCount will be set to 1 (1 row inserted

// successfully). Else, insert failed.

if (rowCount != 0)

registrationResult = "Registration Successful. Below is the info registered: blah ... blah ... blah";

else

registrationResult = "Registration Not Successful! Please check with the

instructor.";

String endHeadTag = "";

String outString = headTag + endHeadTag +

"" + title + "\n" +

registrationResult +

"";

out.println(outString);

System.out.println(outString);

try {

conn.close();

}

catch(SQLException e) {

System.err.println(e.getMessage());

}

}

// Return the HTML form for the user to put into the necessary info for submission

public void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

response.setContentType("text/html");

PrintWriter out = response.getWriter();

String title = "Get Email and URL";

String headTag = ""+title+"";

String endHeadTag = "";

String temp = "Email and URL Registration Page";

temp += "";

temp += "SSN: ";

temp += "Password: ";

temp += "Email: ";

temp += "URL: ";

temp += "";

temp += "";

String outString = headTag + endHeadTag + temp;

out.println(outString);

}

}

// The insert statement in big font!

String insertString = "INSERT INTO student values ('"

+ givenSSN + "','"

+ givenPassword + "','"

+ givenEmail + "','"

+ givenURL + "')";

JSP Examples

HelloBilly.htm

Hello World from Billy!

HelloBilly.jsp

Hello World from Billy!

Expression.jsp

The time and date now is .

Hello7Times.jsp

Creating Hello World with Incremental Text Size Increase

// encodeURL allows for session tracking even if cookies are disabled (i.e., using URL rewriting)

To change the quantity, enter the new book quantity

and click on the Update button.

checkout.jsp

Chapter 7 - The Shopping Cart application

Checkout Servlet To Come

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import business.*;

import data.*;

public class CartServlet extends HttpServlet{

public void doGet(HttpServletRequest request,

HttpServletResponse response)

throws IOException, ServletException{

String productCode = request.getParameter("productCode");

String quantityAsString = request.getParameter("quantity");

HttpSession session = request.getSession();

// The synchronized keyword allows one to make sure there is only one thread that can be

// modifying the object being synchronized (i.e., session object) at any given time

synchronized(session){

Cart cart = (Cart) session.getAttribute("cart");

if (cart == null){

cart = new Cart();

session.setAttribute("cart", cart);

}

//if the user enters a negative or invalid quantity, the quantity is automatically reset to 1.

int quantity = 1;

try{

quantity = Integer.parseInt(quantityAsString);

if (quantity < 0) throw new NumberFormatException(); // one can throw an exception

}

catch(NumberFormatException nfe){

quantity = 1;

}

try{

// Assume that all the products are in a text file. In reality, they should be a DB.

Product product = ProductIO.readRecord(productCode, "\\temp\\AllProducts.txt");

LineItem lineItem = new LineItem(product, quantity);

if (quantity>0)

cart.addItem(lineItem);

else if (quantity ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download