This week's project is to write some additional Name operations in each of the four languages. More precisely, for each of our four languages, write:
To illustrate, C++ mutator functions for class Name might be defined as follows:
void Name::setFirst(const string & aFirst) {
myFirst = aFirst;
}
void Name::setMiddle(const string & aMiddle) {
myMiddle = aMiddle;
}
void Name::setLast(const string & aLast) {
myLast = aLast;
}
Likewise, a C++ lfmi() function might be written as follows:
string Name::lfmi() const {
return myLast + ", " + myFirst + " " + myMiddle[0] + ".";
}
Finally, a C++ function to fill a Name with keyboard
input might be written as follows:
void Name::read(istream & in = cin) {
in >> myFirst >> myMiddle >> myLast;
}
Your project is to implement the equivalent subprograms
(and extend the program with additional tests that test them)
in Java, Ada, Clojure, and Ruby.
In each of your "tester" programs, you are to extend the tester with additional tests that check the correctness of the corresponding operation.
Note that in Clojure, your input function must return the input name as a record to its caller, which can then bind that name to an identifier. Be careful to name your readName() function as indicated. Likewise, the mutators should receive and return a valid Name. The lmfi() should receive a Name but return a string.
Turn in. Use cat to create a single file that contains all of your source code, compilation, and results:
cat projScript.java projScript.ada projScript.clojure projScript.ruby > proj08-resultsThen submit your project by copying that single file into your personal folder in /home/cs/214/current/:
cp proj08-results /home/cs/214/current/yourUserName
replacing yourUserName with your login name.
The grader will access and grade your project results from there,
using the criteria from
this grade sheet.
Calvin > CS > 214 > Projects > 08