Revisions
Some comments:
<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 a positive int. 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.
Here's an example:
April 22, 2002 10:00 AM
Note that the line could contain additional blanks between
locations, and at the beginning or end. However, the comma
will always appear just after the day, with no space in between.
<mblanks> <word> [ <blanks> <word> ] <mblanks>
<mblanks> <digits> <blanks> <digits> <mblanks>You may assume the minutes are seconds are non-negative
<mblanks> <string> <mblanks>
The output BNF will have a similar structure to the
previous projects
<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....
----*----*----*----*----*----*----*----*
Note: you may need to modify main() to get this to work.
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> <digit> <digit>
" " <digit> [<digit>]? ":" <digit> <digit>
<blanks> [ "AM" | "PM" ]
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.
(CORRECTION) (4/25) The date prints out 4 digits for the year, and also the time (the format is similar to the date for MP3 and journals).
(CLARIFICATION) Once a person has membership, you don't need to keep the information about payment, coupon type, "has referral", years member, and even the date of membership. Also, if a person didn't get membership, they can try again. Once they get membership, there won't be an attempt to change the membership.
If you want to store this information, there's no harm. Just that it's not used anywhere else.
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.
(CLARIFICATION) If someone is already a friend, and you add them again, you should update their emoticon (or convert to a good friend or from a good friend). This will be tested lightly (like, one secondary). Effectively, it's an update, after attempting to do an add (and having add() return false).
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 in your list of friends
(thus, if you try to remove a person who is a "friend", but is not in
your list, then this will return false, and you will print the "IS NOT
FRIENDS WITH" message). Notice that you will have to locate your
friend's real name somewhere.
If you are not friends with the person listed, then 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
This should be printed out by comparing names.
The text fields used are:
This should be printed in NAME order.
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.
(CLARIFICATION) The limits for BRONZE is 1. For SILVER, it's 2 (2 top level posts, and 2 followups).
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.
(CLARIFICATION) The limits for BRONZE is 1. For SILVER, it's 2 (2 top level posts, and 2 followups).
The text fields are:
The output is:
"Listing for " <name> " (" <alias> ")" <endl>
"====*====*====*====*====*====*====*====*" <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/2002 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/2002 12:20 PM
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".
Note: in real applications, deleting a message usually does NOT delete the followup (most messages are numbered, and the followup will refer to a previous message number). However, it will be easier to remove followups to a deleted message.
The output BNF for this is:
<out2> := "Entry on " <date> " by " <name> " (" <alias> ") "
[ "SUCCESSFULLY REMOVED" | "DOES NOT EXIST" ]
where <date> has the usual format for date (e.g., 2/7/2002).
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.
A followup is NOT considered a top level entry. A top level entry is a person who posts an MP3 or journal, and presses the postJournal or postMp3 button.
You pick the most recent N top level entries (so you ignore followups for now) 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 first two lines for the output should be
"Listing for " <name> " (" <alias> ") friends' journals" <endl>
"====*====*====*====*====*====*====*====*" <endl>
After that, the output should look like list
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 (with 5 periods)
.....FOLLOWUP
.....Name: Jain, Ani Emoticon: ;-) Alias: desi
.....Title: "Why Economic Reform is a Joke"
.....Date: 4/2/2002 10:15 AM
.....Original Date: 4/1/2002 10:30 PM
.....
.....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.