Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Question


Day of the Year
Assume that a year has 365 days, write a class named DayOfYear that gets an integer representing a day of year and translates it to a string consisting of month followed by day of month. Such as-
Day 2 would be January 2
Day 32 would be February 1
Day 365 would be December 31

The constructor for class have to take as parameter an integer representing the day of the year, and class must have a member function print() that prints the day in the month-day format. Class ought to have an integer member variable to represent day and should have static member variables of type string to assist in translation from the integer format to the month-day format.

Test your class by inputting a variety of integers representing days and printing out their symbol in the month-day format.

Day of the Year Modification
Modify the DayOfYear class, written in an earlier Programming Challenge, to add the constructor that takes two parameters- a string representing a month and an integer in range 0 through 31 representing day of the month. A constructor has to then initialize the integer member of the class to represent the day specified by the month and day of month parameters. The constructor has to terminate the program with an appropriate error message if the number entered for a day is outside the range of days for the month given.

Add following overloaded operators-
++ prefix and postfix increment operators. These operators must modify DayOfYear object so that it represents next day. If the day is previously the end of year, the new value of object will represent the first day of the year.

-- prefix and postfix decrement operators. These operators should modify DayOfYear object so that it represents the earlier day. If the day is already the first day of the year, new value of the object will signify last day of the year.

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9132647

Have any Question?


Related Questions in Computer Engineering

1 write code in the method linearsearch in

1. Write code in the method linearSearch() in "SearchMethods"class which finds the element in an array using linear search approach and returns its index to the calling main method, otherwise it returns -1. 2. Write code ...

Question monicas reading comprehension score 22nbspmean

Question: Monica's reading comprehension score = 22  Mean fourth grade reading comprehension score = 19  Standard deviation of the fourth grade's reading comprehension = 1.8  Monica's z-score in math = 2.2  Mean fourth g ...

Is there any difference in terms of the information that

Is there any difference in terms of the information that could be provided to the decision maker by an IS that was created using HSM and an IS that was created using SSM?

Question based on what you learn from the vignette what do

Question: Based on what you learn from the vignette, what do you think are the relationships between Web analytics, text mining, and sentiment analysis? The response must be typed, single spaced, must be in times new rom ...

What does smokeping do and why is that functionality

What does Smokeping do, and why is that functionality important in a datacenter? When setting up Smokeping, how do you add systems in to be monitored? How do you go about adding an alert (both setting up a new alert and ...

Question is it ethical for a potential employer to use the

Question: Is it ethical for a potential employer to use the Internet this way? Is it legal? What if an angry ex-boyfriend or ex-girlfriend posted some things, pretending to be you? How might this affect your chances for ...

What is the purpose of exclusive gates such as the xor and

What is the purpose of exclusive gates such as the XOR and XNOR? What function do these gates perform?

Question create for your company amp conduct cyber

Question: Create for your company & conduct cyber assessment using the CSET Cybersecurity Framework (CSF) requirement-based assessment a. complete site info b. Sector & demo: i. [Select your business] ii. [Select your bu ...

Simplifya factor and find the vertex form x2 6x 8b factor

Simplify a) Factor and find the vertex form x^2 +6x + 8 b) Factor the h value of of the vertex of 2x^2 - 10x - 30 c) Find the x-intercept and y-intercept of 5x - 4y=30

One-year treasury bills currently earn 225 percent you

One-year Treasury bills currently earn 2.25 percent. You expected that one year from now, 1-year Treasury bill rates will increase to 2.75 percent and that two years from now, 1-year Treasury bill rates will increase to ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As