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.:- M9717899

Have any Question?


Related Questions in Computer Engineering

Has a recent drop in airplane passengers resulted in better

Has a recent drop in airplane passengers resulted in better on time performance? Before the recent downturn, one airline bragged that 92% of its flights were on time. A random sample of 165 flights completed this year re ...

System analysis and design1 describe a scenario in which

System Analysis and Design: 1) Describe a scenario in which the distribution of users determine the output technology. 2) What is the difference between gradual conversion and modular conversion? 3) At University, the co ...

Answer the following question how do you represent a node

Answer the following Question : How do you represent a node in a deployment diagram? What kinds of information can appear on a node? The response must be typed, single spaced, must be in times new roman font (size 12) an ...

Given the ultra-high abundance of their elements in air it

Given the ultra-high abundance of their elements in air, it is not surprising that these six compounds are common pollutants: NO, NO2, N2O, N2O3, N2O4, N2O5. Calculate the largest ratio of effusion rates that exists betw ...

Sales bar chartwrite a program that asks the user to enter

Sales Bar Chart Write a program that asks the user to enter today's sales for 5 stores. The program should then display a bar graph comparing each store's sales. Create each bar in the bar graph by displaying a row of as ...

If a wooden car has 30 independent components that all must

If a wooden car has 30 independent components that all must function for the wooden car to operate successfully during a race, and the probability of successful operation for any single component is 0.999, what is the pr ...

What are the best practices to follow for microsoft windows

What are the best practices to follow for Microsoft Windows network security. Which two would you start with and why?

Suppose i am designing a personnel database for a

Suppose I am designing a personnel database for a university. The university has three types of personnel: students, staff, and faculty. Here are the characteristics of the three groups: -All three groups have a name and ...

7 years ago crane corporation issued 20-year bonds that had

7 years ago Crane Corporation issued 20-year bonds that had a $1,000 face value, paid interest annually, and had a coupon rate of 7 percent. If the market rate of interest is 5.5 percent today, what is the current market ...

Taylor found that 8 of the recipients of loans form a

Taylor found that 8% of the recipients of loans form a particular mortgage lender default within 3 years. If he takes a random sample of 736 customers who received loans 3 years ago, what is the average number of custome ...

  • 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