Find Jobs
Hire Freelancers

Class Date1

$30-5000 USD

Tamamlandı
İlan edilme: 22 yıldan fazla önce

$30-5000 USD

Teslimde ödenir
This programming assignment is an application of public inheritance in C++. Create a workspace folder called 'ThisDay.' Include a C++ source code file called 'ThisDay.cpp.' Define the class Date to create calendar date objects. The class must be the following. class Date { int day, month, year; // to store the three components of a date public: Date( ) // initializes data members using the computer clock's date Date(int, int, int); // initializes data members to the parameter values void print( ostream &); // inserts mm/dd/yyyy on the ostream object protected: int getDate():// returns day int getmonth( ); // returns month int getyear( ); // returns year }; Add definitions for the member functions in the above class definition. Declare a derived class of the class Date called LongDate using public inheritance. The derived class must have only two constructors and a void member function 'printLong.' Also the derived class must not have its own data members. The first constructor function of the derived class has no parameter. It must invoke the base class constructor with no parameter. The second constructor function must have three parameters. It must invoke the base class constructor with three parameters. The member function 'printlong' must insert on the ostream object passed by reference the current objects's date in the long format. For example, the long format of 11/01/2001 is November 1, 2001. Your int main() function should be the following. int main() { int day, month, year; LongDate d; cout <<"Today's date: "; [login to view URL](cout); cout << endl; cout << 'Today's date in long form: "; [login to view URL](cout); cout << endl; cout << "Enter your favourite date (mm dd yyyy): "; cin >> month >> day >> year; LongDate dd(day,month, year); cout << "Your favorite date: "; [login to view URL](cout); cout << endl; cout << "Your favourite date in long form: "; [login to view URL](cout); cout << endl; return 0; } I could not fit it all on the description so i put the rest on the deliverables section ## Deliverables How to get the date from the computer's clock? Be the body of the default constructor in class Date. The following statements will do it. It must Different sample runs display the following: 1) Today's date: 11/04/2001 (print member function must pad with 'O' for a single digit like 4) Today's date in long form: November 4, 2001 Enter your favorite date ( mm dd yyyy): 1 2 2001 Your favorite date: 01/02/2001 Your favorite date in long form: January 2, 2001 2) Today's date: 11/04/2001 Today's date in long form: November 4, 2001 Enter your favorite date ( mm dd yyyy): 3 1 2000 Your favorite date is 03/01/2000 Your favorite date is March 1, 2000 Run your program with input 1 2 2001 and repeat it again with input 3 1 2000. Turn in a hard copy of '[login to view URL]' on the due date. Please include your name, user name, and path name to the project folder on the hard copy. struct tm *ptr; // pointer of type struct tm // which holds calendar time components time_t t = time( 0 ); // determine the current calendar time // which is assigned to timeptr ptr = localtime( &t ); // convert the current calendar time //pointed to by timeptr into //broken down time and assign it to ptr day = ptr->tm,_mday; // broken down day of month month = 1 + ptr->tm_mon; // broken down month since January year = ptr->tm_year+ 1900; // broken down year since 1900 You must include the following include directive. #include#include#includeFragment of code to display a single digit padded with zero(es). using std::setw; using std::setfill; int x = 2; cout << setfill('O') << setw(2) << x; // displays 02 x = 5; cout <<setfill ('O')<< setw(3) << x; // displays 005 cout << x; // displays 3. Need to use the manipulator whenever padding is required Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased. ## Deadline information DUE 11/19/01
Proje No: 2831601

Proje hakkında

11 teklif
Uzaktan proje
Son aktiviteden bu yana geçen zaman 23 yıl önce

Biraz para mı kazanmak istiyorsunuz?

Freelancer'da teklif vermenin faydaları

Bütçenizi ve zaman çerçevenizi belirleyin
Çalışmanız için ödeme alın
Teklifinizin ana hatlarını belirleyin
Kaydolmak ve işlere teklif vermek ücretsizdir
Seçilen:
Kullanıcı Avatarı
See private message.
$17 USD 14 gün içinde
5,0 (80 değerlendirme)
5,2
5,2
11 freelancer bu proje için ortalama $19 USD teklif veriyor
Kullanıcı Avatarı
See private message.
$34 USD 14 gün içinde
4,6 (60 değerlendirme)
4,5
4,5
Kullanıcı Avatarı
See private message.
$10,20 USD 14 gün içinde
5,0 (35 değerlendirme)
4,3
4,3
Kullanıcı Avatarı
See private message.
$25,50 USD 14 gün içinde
4,5 (33 değerlendirme)
4,2
4,2
Kullanıcı Avatarı
See private message.
$14,45 USD 14 gün içinde
5,0 (38 değerlendirme)
4,1
4,1
Kullanıcı Avatarı
See private message.
$17 USD 14 gün içinde
5,0 (17 değerlendirme)
3,2
3,2
Kullanıcı Avatarı
See private message.
$29,75 USD 14 gün içinde
4,7 (32 değerlendirme)
3,3
3,3
Kullanıcı Avatarı
See private message.
$10,20 USD 14 gün içinde
4,8 (21 değerlendirme)
3,2
3,2
Kullanıcı Avatarı
See private message.
$12,75 USD 14 gün içinde
5,0 (15 değerlendirme)
2,7
2,7
Kullanıcı Avatarı
See private message.
$8,50 USD 14 gün içinde
4,2 (12 değerlendirme)
2,1
2,1
Kullanıcı Avatarı
See private message.
$25,50 USD 14 gün içinde
5,0 (3 değerlendirme)
0,8
0,8

Müşteri hakkında

   UNITED STATES bayrağı
United States
5,0
4
Eki 23, 2001 tarihinden bu yana üye

Müşteri Doğrulaması

Teşekkürler! Ücretsiz kredinizi talep etmeniz için size bir bağlantı gönderdik.
E-postanız gönderilirken bir şeyler yanlış gitti. Lütfen tekrar deneyin.
Kayıtlı Kullanıcı İlan Edlien Toplam İş
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Ön izleme yükleniyor
Coğrafik konum için izin verildi.
Giriş oturumunuzun süresi doldu ve çıkış yaptınız. Lütfen tekrar giriş yapın.