Homework Assignment 6

Homework Assignment 6

<p> ENGR 221 Homework Assignment 6 Fall Semester 2007 Due Tuesday, October 23, 2007</p><p>Write a program, hwk6.cpp, in which you define a C++ class called Date with private integer members month, day, and year. Define 2 constructors for the class, one which does not require input arguments and initializes the date to 1/1/2000; the other which accepts input integer arguments m, d, and y. Also define the following public member functions of the class:</p><p>1. void Date::input_date(void) This function accepts input for month, day, and year.</p><p>2. void Date::print_date(void) This function converts the integer month to a character string and prints complete date, e. g., November 15, 1927. Implement with cout rather than printf command. </p><p>3. int Date::getMonth(void) This function returns the month.</p><p>4. int Date::getDay(void) This function returns the day.</p><p>5. int Date::getYear(void) This function returns the year.</p><p>Within main() instantiate objects date1 and date2. For date1 use the constructor that does not accept input arguments; for date2 use the one that does and initialize it to 10/23/2007. Using the cout object, print out each date using the integer month, day, and year values separated by slashes. Then for the object date1, invoke the input_date function to allow the user to change the date. Then invoke the print_date function to print its new date. The output should have the form: date1: 1/1/2000 date2: 10/23/2007 date1: Enter month, day, and year (e.g. 3 1 1999) separated by spaces: 12 6 1927 date1: December 6, 1927</p><p>Save your program as hwk6.cpp in your homework directory. Include your name and hwk6.cpp in comment lines at the top. Print out a copy of the program with sample output appended. Turn this in for grading. Remember to use g++ to compile your program. Email a completed copy of your program to both the instructor and the grader prior to the start of class on the due date. In the subject line of this email, type ENGR 221 hwk6.cpp. Send it as an attachment from your IPFW webmail account, which can be accessed through https://my.ipfw.edu/. If you are working from home or a campus lab other than the engineering labs, you can access the file by logging into http://students.etcs.ipfw.edu and transferring it from your homework directory to the local computer. Once the file is on the local computer, you can attach it to an email. In class, turn in a hardcopy of the program with your results appended at the bottom. Make sure the version you email does not have these appended results because it will not compile.</p><p>Grading:</p><p>Class date properly implemented 4 pts. Results accurate and according to instructions 2 pts. Proper use of cout 2 pts. Style, comments, and proper subject line in email 2 pts. 10 pts.</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us