123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <!-- NewPage -->
- <html lang="en">
- <head>
- <!-- Generated by javadoc (1.8.0_144) on Thu May 24 22:37:43 EDT 2018 -->
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>TicketMachine</title>
- <meta name="date" content="2018-05-24">
- <link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
- <script type="text/javascript" src="script.js"></script>
- </head>
- <body>
- <script type="text/javascript"><!--
- try {
- if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="TicketMachine";
- }
- }
- catch(err) {
- }
- //-->
- var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10};
- var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
- var altColor = "altColor";
- var rowColor = "rowColor";
- var tableTab = "tableTab";
- var activeTableTab = "activeTableTab";
- </script>
- <noscript>
- <div>JavaScript is disabled on your browser.</div>
- </noscript>
- <!-- ======== START OF CLASS DATA ======== -->
- <div class="header">
- <h2 title="Class TicketMachine" class="title">Class TicketMachine</h2>
- </div>
- <div class="contentContainer">
- <ul class="inheritance">
- <li>java.lang.Object</li>
- <li>
- <ul class="inheritance">
- <li>TicketMachine</li>
- </ul>
- </li>
- </ul>
- <div class="description">
- <ul class="blockList">
- <li class="blockList">
- <hr>
- <br>
- <pre>public class <span class="typeNameLabel">TicketMachine</span>
- extends java.lang.Object</pre>
- <div class="block">TicketMachine models a naive ticket machine that issues
- flat-fare tickets.
- The price of a ticket is specified via the constructor.
- It is a naive machine in the sense that it trusts its users
- to insert enough money before trying to print a ticket.
- It also assumes that users enter sensible amounts.</div>
- <dl>
- <dt><span class="simpleTagLabel">Version:</span></dt>
- <dd>2008.03.30</dd>
- <dt><span class="simpleTagLabel">Author:</span></dt>
- <dd>David J. Barnes and Michael Kolling</dd>
- </dl>
- </li>
- </ul>
- </div>
- <div class="summary">
- <ul class="blockList">
- <li class="blockList">
- <!-- ======== CONSTRUCTOR SUMMARY ======== -->
- <ul class="blockList">
- <li class="blockList"><a name="constructor.summary">
- <!-- -->
- </a>
- <h3>Constructor Summary</h3>
- <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
- <caption><span>Constructors</span><span class="tabEnd"> </span></caption>
- <tr>
- <th class="colOne" scope="col">Constructor and Description</th>
- </tr>
- <tr class="altColor">
- <td class="colOne"><code><span class="memberNameLink"><a href="TicketMachine.html#TicketMachine--">TicketMachine</a></span>()</code> </td>
- </tr>
- </table>
- </li>
- </ul>
- <!-- ========== METHOD SUMMARY =========== -->
- <ul class="blockList">
- <li class="blockList"><a name="method.summary">
- <!-- -->
- </a>
- <h3>Method Summary</h3>
- <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
- <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
- <tr>
- <th class="colFirst" scope="col">Modifier and Type</th>
- <th class="colLast" scope="col">Method and Description</th>
- </tr>
- <tr id="i0" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="TicketMachine.html#emptry--">emptry</a></span>()</code>
- <div class="block">Create a machine that issues tickets of the given price.</div>
- </td>
- </tr>
- <tr id="i1" class="rowColor">
- <td class="colFirst"><code>int</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="TicketMachine.html#getBalance--">getBalance</a></span>()</code>
- <div class="block">Return the amount of money already inserted for the
- next ticket.</div>
- </td>
- </tr>
- <tr id="i2" class="altColor">
- <td class="colFirst"><code>int</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="TicketMachine.html#getPrice--">getPrice</a></span>()</code>
- <div class="block">Return the price of a ticket.</div>
- </td>
- </tr>
- <tr id="i3" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="TicketMachine.html#insertMoney-int-">insertMoney</a></span>(int amount)</code>
- <div class="block">Receive an amount of money in cents from a customer.</div>
- </td>
- </tr>
- <tr id="i4" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="TicketMachine.html#printTicket--">printTicket</a></span>()</code>
- <div class="block">Print a ticket.</div>
- </td>
- </tr>
- <tr id="i5" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="TicketMachine.html#prompt--">prompt</a></span>()</code> </td>
- </tr>
- <tr id="i6" class="altColor">
- <td class="colFirst"><code>void</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="TicketMachine.html#showPrice--">showPrice</a></span>()</code> </td>
- </tr>
- <tr id="i7" class="rowColor">
- <td class="colFirst"><code>void</code></td>
- <td class="colLast"><code><span class="memberNameLink"><a href="TicketMachine.html#TicketMachine2--">TicketMachine2</a></span>()</code> </td>
- </tr>
- </table>
- <ul class="blockList">
- <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
- <!-- -->
- </a>
- <h3>Methods inherited from class java.lang.Object</h3>
- <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- <div class="details">
- <ul class="blockList">
- <li class="blockList">
- <!-- ========= CONSTRUCTOR DETAIL ======== -->
- <ul class="blockList">
- <li class="blockList"><a name="constructor.detail">
- <!-- -->
- </a>
- <h3>Constructor Detail</h3>
- <a name="TicketMachine--">
- <!-- -->
- </a>
- <ul class="blockListLast">
- <li class="blockList">
- <h4>TicketMachine</h4>
- <pre>public TicketMachine()</pre>
- </li>
- </ul>
- </li>
- </ul>
- <!-- ============ METHOD DETAIL ========== -->
- <ul class="blockList">
- <li class="blockList"><a name="method.detail">
- <!-- -->
- </a>
- <h3>Method Detail</h3>
- <a name="emptry--">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>emptry</h4>
- <pre>public void emptry()</pre>
- <div class="block">Create a machine that issues tickets of the given price.
- Note that the price must be greater than zero, and there
- are no checks to ensure this.</div>
- </li>
- </ul>
- <a name="getBalance--">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getBalance</h4>
- <pre>public int getBalance()</pre>
- <div class="block">Return the amount of money already inserted for the
- next ticket.</div>
- </li>
- </ul>
- <a name="getPrice--">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>getPrice</h4>
- <pre>public int getPrice()</pre>
- <div class="block">Return the price of a ticket.</div>
- </li>
- </ul>
- <a name="insertMoney-int-">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>insertMoney</h4>
- <pre>public void insertMoney(int amount)</pre>
- <div class="block">Receive an amount of money in cents from a customer.</div>
- </li>
- </ul>
- <a name="printTicket--">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>printTicket</h4>
- <pre>public void printTicket()</pre>
- <div class="block">Print a ticket.
- Update the total collected and
- reduce the balance to zero.</div>
- </li>
- </ul>
- <a name="prompt--">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>prompt</h4>
- <pre>public void prompt()</pre>
- </li>
- </ul>
- <a name="showPrice--">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>showPrice</h4>
- <pre>public void showPrice()</pre>
- </li>
- </ul>
- <a name="TicketMachine2--">
- <!-- -->
- </a>
- <ul class="blockListLast">
- <li class="blockList">
- <h4>TicketMachine2</h4>
- <pre>public void TicketMachine2()</pre>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- <!-- ========= END OF CLASS DATA ========= -->
- </body>
- </html>
|