subject

1. In this chapter, the class dateType was designed to implement the date in a program, but the member function setDate and the constructor do not check whether the date is valid before storing the date in the member variables. Rewrite the definitions of the function setDate and the constructor so that the values for the month, day, and year are checked before storing the date into the member variables. 2. Add a member function, isLeapYear, to check whether a year is a leap year. Moreover, write a test program to test your class.
3. The class dateType was designed and implemented to keep track of a date, but it has very limited operations. Redefine the class dateType so that it can perform the following operations on a date, in addition to the operations already defined:
a. Set the month.
b. Set the day.
c. Set the year.
d. Return the month.
e. Return the day.
f. Return the year.
g. Test whether the year is a leap year.
h. Return the number of days in the month. For example, if the date is 3-12-2017, the number of days to be returned is 31 because there are 31 days in March.
i. Return the number of days passed in the year. For example, if the date is 3-18-2017, the number of days passed in the year is 77. Note that the number of days returned also includes the current day.
j. Return the number of days remaining in the year. For example, if the date is 3-18-2017, the number of days remaining in the year is 288.
k. Calculate the new date by adding a fixed number of days to the date. For example, if the date is 3-18-2017 and the days to be added are 25, the new date is 4-12-2017.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:00
Petrică, tânăr licean în clasa a ix-a, a primit în dar de la părinţii săi un cont bancar pentru micile sale cheltuieli curente. el este pasionat de internet banking şi îşi verifică cu grijă toate tranzacţiile efectuate. pentru creşterea securităţii tranzacţiilor online, banca îi furnizează lui petrică un număr pe care el va trebui să îl modifice, obţinând un număr tan – număr de autentificare a tranzacţiei (transaction authentication number). regula de obţinere a numărului tan este următoarea: se formează cel mai mic număr par din toate cifrele numărului furnizat de bancă. cerinţă cunoscând numărul n furnizat de bancă, să se determine numărul tan obţinut de petrică. date de intrare fişierul tan.in conţine pe prima linie numărul natural n cu semnificaţia din enunţ. date de ieşire fişierul de ieşire tan.out va conţine o singură linie pe care va fi scris numărul tan cerut. restricţii • 0 < n < 18*1018 • n are cel puţin o cifră pară • numărul tan obţinut nu poate conţine zerouri nesemnificative
Answers: 2
question
Computers and Technology, 23.06.2019 09:00
The first screen you see when you open word2016 what is called?
Answers: 1
question
Computers and Technology, 24.06.2019 11:20
William travels a lot on business purpose. he needs to regularly communicate with his business partner. he also needs to send out weekly reports to his boss while he is traveling. which web-based application best suits william’s needs? (social media, webmail, wiki) is the best web-based application for william. he can access this application via the internet using a (digital cable, fax machine, web browser).
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
Pseudocode pld #6, pg. 117 start// declarations// number numbertoguess// number myguess; numbertoguess = 92// while myguess ! = numbertoguess// output " guess an integer number between 1 and 100"// input myguess// if (myguess == numbertoguess)// output "you guessed the correct number"// else// output "the number you guessed was incorrect. try again! "// end if// end while// output " for playing the guessing game. have a great day! "// stop
Answers: 3
You know the right answer?
1. In this chapter, the class dateType was designed to implement the date in a program, but the memb...
Questions