Note: there may be some corrections, but this is being posted now so you know the names of the various fields. Make sure to check back in a few days, in case corrections are made.
The following are a list of TextField objects that should be declared as private members of Gui. You can make it public, but instead, a better way is to keep variables private by creating a SimpleMap which maps strings to Widget * just like the tester classes did, and then overload the operator[] to access. This time, when you access the object, it will either be a Button or TextField and you may need to dynamic cast to get the correct object.
That's a better solution than making the data members public.
<mblanks> <word> <blanks> <word> <mblanks>That is, the user enters first and last name, and there may be blanks before and after and in the middle. Hint: use your code for Movie to "split" this apart.
You may assume no two names are the same.
<mblanks> <word> <mblanks>
You may assume that no two aliases are the same.
<mblanks> <digits> <mblanks>You may assume the input is positive. You have to translate this from a string to a number (hint: see previous projects, this function may already exist).
<mblanks> <digits> <mblanks>
<mblanks> [ "true" | "false" ] <mblanks>
<mblanks> <digits> <mblanks>
<mblanks> [ "January" | "February" | "March" | "April" |
"May" | "June" | "July" | "August" | "September" | "October" |
"November" | "December" ] <mblanks> <digits> ","
<mblanks> <digit>{4,4} <blanks>
<digit> [<digit>]? ":" <digit> <digit>
<blanks> [ "AM" | "PM" ] <mblanks>
You can assume the digits are sensible for the month. You can
ignore leap year. You can assume the years start in 1990 and
afterwards, though it would be nice to handle a wider range of
years. This is perhaps the most important field you have to manage.
Note: the comma comes immediately after the day.
This includes the day, and the time. All of this appears on one line.
<mblanks> <word> [ <blanks> <word> ] <mblanks>
<mblanks> <digits> <blanks> <digits> <mblanks>You may assume the minutes are seconds are non-negative
<mblanks> <string> lt;mblanks>
<output> := <line>
[ ["Button Pressed: (" <word> ")" <endl> <out> <line>]+ |
"NO BUTTONS PRESSED" <endl> <line> ]
<endl>
<line> ::== "----*----*----*----*----*----*----*----*" <endl>
You should produce output only when buttons are pressed (no output
when entering text fields). The first line printed indicates the
button pressed. The following lines printed are indicated below.
So, the first line of each output is the name of the button pressed,
followed by whatever output is specified in the next section.
Here's an example of the output.
----*----*----*----*----*----*----*----* Button Pressed: (apply) ....more stuff.... ----*----*----*----*----*----*----*----*
The TextField objects used with this are:
The output BNF for this is:
<out> := <name> " (" <alias> ") " has "
[ "GOLD" | "SILVER" | "BRONZE" | "NO" ]
" membership " as of " (" <date> ")"
<name> := <word> ", " <word>
<date> := <digit> [<digit>]? "/"
<digit> [<digit>]? "/"
<digit> <digit>
The name is printed last name followed by comma, space, and
then the first name. The alias is the same as entered in.
The date has the format that looks like "4/2/02" The year is
printed as two digits. You may assume years begin after 1990 and
is before, say, 2010.
The TextField objects used with this are:
The output BNF for this is:
<out2> := <name> " (" <alias> ") "
[ "SUCCESSFULLY ADDS" | "IS ALREADY FRIENDS WITH" ]
<name> " (" <alias> ") "
[ "Emoticon: " <word> ]?
You may assume that the friend has already successfully been
added as a member (only members may be friends). The first name
and alias are your name and alias. The second name and alias
are your friend's name and alias. If your friend is a "good friend",
print out the emoticon too.
The text fields used are:
<out2> := <name> " (" <alias> ") "
[ "SUCCESSFULLY REMOVES" | "IS NOT FRIENDS WITH" ]
<name> " (" <alias> ") "
[ "Emoticon: " <word> ]?
You may assume that friendAlias is a legitmiate alias.
However, you may NOT assume that the friend is your friend (thus,
you may fail to remove the friend from your list). Notice that
you will have to locate your friend's real name somewhere.
If you are not friends with the person listed, the no emoticon is printed.
Hint: to handle friends, you may wish to create a Friend class that contains a Name and a GoodFriend class derived from Friend that contains the emoticon. Then, the list of friends is stored as a BST of Friend * objects.
You do not have to be very efficient about accessing friends, etc., but you may want to think about how efficient it is to find things.
The text fields used are:
<name> " (" <alias> ") "
which is last name, then first, then a space, and the alias
in parentheses.
If it's a good friend, list:
<name> " (" <alias> ") Emoticon: " <string>
where the string is the emoticon
The text fields used are:
The text fields used are:
The output is:
<out> := "Journal entry for " <name>
[ "SUCCESSFULLY POSTED" |
"NOT POSTED! Exceeds limit of " <digits> ]
No alias is posted. If successful, it is "posted" (i.e., recorded).
If it exceeds limits, it is not posted. Limits are discussed
below.
The text fields used are:
<out> := "MP3 for " <name>
[ "SUCCESSFULLY POSTED" |
"NOT POSTED! Exceeds limit of " <digits> ]
No alias is posted. If successful, it is "posted" (i.e., recorded).
If it exceeds limits, it is not posted. Limits are discussed
below.
The text fields are:
The output is:
"Listing for " <name> " (" <alias> ")" <endl>
"====*====*====*====*====*====*====*====*"
Here's an example of a journal entry. How to follow up to
a journal will be explained in a later section.
JOURNAL
Name: Doe, John Alias: jarjar
Title: "Why Economic Reform is a Joke"
Date: 4/2/02 12:20 PM
Just because it is!
It has the word JOURNAL on one line, "Title:", followed by the title
in double quotes on the next line, "Date: " followed by the date.
Then, one blank line, and all the lines of the journal entry.
For an MP3, you have:
MP3
Name: Doe, John Alias: jarjar
Title: "Eat it"
Artist: Yankovic, Al Album: "In 3-D" Duration: 170
Date: 4/2/02
You will list out the "N" most recent TOP-LEVEL entries (ignoring any followups), where "N" is specified by the <number> field. A TOP-LEVEL entry means you ignore followups when counting. Each entry should be separated from the next with one blank line. If there are fewer than "N" entries, then print the number of entries there are (both MP3 and journals). If there are zero entries, print "NO ENTRIES".
The text fields are:
You should print the journal entries of all friends in reverse chronological order, up to number entries. In effect, pretend all your friends had their top-level entries, sorted by date, in one big batch.
You pick the most recent N where N is the value in number.
Use the same rules as list if there are too few entries or none at all.
For good friends, you should print:
Name: Doe, John Emoticon: ;-) Alias: jarjar
That is, add the emoticon.
This is a TOUGH function. (At least, I think it is...).
The text fields are:
You will need to find a friend (actually, anyone with an alias, including yourself) and the date of the original posting. The followup For followups, you should indent 5 * K spaces in, for the followup depth. For example, if the depth is 1 (meaning first followup), you indent everything 5 spaces in. You may only followup with journal entries. You can followup on either a journal entry or an MP3, but only with a followup entry.
A followup to a follow up has a followup of depth 2. So, that would mean indent the entry 10 spaces in.
The following is an example of a followup of depth 1.
It is indented 5 steps in.
FOLLOWUP
Name: Jain, Ani Emoticon: ;-) Alias: desi
Title: "Why Economic Reform is a Joke"
Date: 4/2/02
Original Date:
Just because it is!
You should print the following for a followup:
<name> " (" <alias> ") follows up to "
<name> " (" <alias> ") "
[ "SUCCESSFULLY" | "FAILS" ]
AAAAAA AAAAAA BBBBBB BBBBBB CCCCCC CCCCCCassuming that B's article has a date that occurs before C's article.