Due date: Wednesday, April 14, 2010, 11:55pm.
Task 1 (100 points)
Complete the code already written in files task1.cpp and address.h, so that behaves as follows:
- It asks the user to specify an address a1.
- It prints out the address a1.
- It creates a variable a2 that is a shallow copy of a1.
- It creates a variable a3 that is a deep copy of a1.
- It calls function foo1(&a1). Function foo1 makes the street number of a1 equal to 20.
- It calls function foo2(a2). Function foo2 makes the first letter of the street name of its argument equal to 'X'.
- It calls function foo3(a3). Function foo3 makes the state of its argument equal to "Massachusetts".
For example, suppose that the user types in as address:
5 Random_Street Anytown Anystate
Then, the program should print out the following:
a1, at step 0:
5 Random_Street, Anytown, Anystate
a1, at step 1:
20 Random_Street, Anytown, Anystate
a2, at step 2:
20 Xandom_Street, Anytown, Anystate
a3, at step 3:
20 Random_Street, Anytown, Massachusetts
Note that the main function is already defined in file task1.cpp. You are not allowed to modify that, except:
- where indicated with questionmarks.
- if you cannot get input_address to work, you can uncomment the commented lines that just hardcode some values into the variable names of a1.
How to submit
Submisions are only accepted via WebCT. The submission should include your C or C++ source and header files, and answers.doc. Do not submit entire project directories, or anything else except for the .h, .c and .cpp files and the answers.doc file.
Your answers.doc file should be a single Microsoft Word file that includes:
- Your name and UTA ID number at the top.
- A copy of your code for each task where you had to write code.
Make sure that your answers.doc file is easy to parse, and that it is easy for us to figure out which part corresponds to which task. Feel free to use headings such as "start of copy of task1.c".
We try to automate the grading process as much as possible. Not complying precisely with instructions causes a significant waste of time during grading, and thus points will be taken off for failure to comply, and/or you may receive a request to resubmit.
Submission checklist
- Was the assignment submitted via WebCT?
- Did answers.doc contain your name and UTA ID?
- Did the submission include files your C or C++ source and header files, answers.docs, and nothing else?