代码实现
\documentclass[11pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage{listings}
\usepackage{color}
\definecolor{keywordcolor}{rgb}{0.8,0.1,0.5}
\definecolor{webgreen}{rgb}{0,.5,0}
\title{Progress Report 8}
\author{author}
\date{July 28th, 2008}
\begin{document}
\maketitle
\lstset{language=[AspectJ]Java,
basicstyle=\footnotesize,
keywordstyle=\color{keywordcolor}\bfseries, %\underbar,
identifierstyle=,
commentstyle=\color{blue} \textit,
stringstyle=\ttfamily,
showstringspaces=false,
captionpos=b
}
\section*{Prototype}
Advertiser class.
\begin{lstlisting}
public void addAdvertisement(String company, String ad_Category,
String ad_Type, String ad_Price)
{
int price = Integer.parseInt(ad_Price);
ad = new Advertisement(company, ad_Category, ad_Type, price);
adList.add(index, ad);
index++;
anDM = getDefaultDirectoryManager();
ActorTuple tuple = new ActorTuple(getActorName(), "advertiser",
company, ad_Category, ad_Type, price, index-1);
send(anDM, "register", tuple);
}
\end{lstlisting}
\end{document}
选自:
发表评论 取消回复