public class TextStatement extends StatementTemplate
Domain:
Inherited from StatementTemplate
Invariant
Inherited from StatementTemplate
| Constructor and Description |
|---|
TextStatement(java.lang.String customerName,
java.util.List<Rental> rentals)
The constructor for the TextStatement class.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
toString()
Creates a string representation of a TextStatement.
|
public TextStatement(java.lang.String customerName,
java.util.List<Rental> rentals)
customerName - the name of the customer that will appear on the first line of the statement.rentals - the list of rentals from which which we will get titles, charges, compute the total charge and compute the frequent renter points.public java.lang.String toString()
toString in class StatementTemplate
SYNTAX:
Statement ::= Header Body Footer
Header ::= "Rental Record for " Name + "\n"
Name ::= String
Body ::= ("\t" RentalTitle "\t" AmountDue "\n")*
RentalTitle ::= String
AmountDue ::= Amount
Footer ::= "Amount owed is " SumOfAllAmounts "\n"
"You earned " + NumberOfFrequentRenterPoints + "\n"
SumOfAllAmounts ::= Amount
Amount ::= \d+\.\d\d
NumberOfFrequentRenterPoints ::= \d+