How to write a class named dayofyear that gets an integer

Assignment Help Computer Engineering
Reference no: EM132226

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.

 

Reference no: EM132226

Questions Cloud

What will be formula of digital certificate of the server : Point out what will be the formula of digital certificate of the server N. we denote the public and private keys of server N as K+ ,N KN, and public or private keys of CA are denoted as K+ CA KCA.
Evaluate the value of one share of gis stock : Evaluate the value of one share of GIS stock using Dividends Valuation Approach.
What is home wireless network and security : What is home wireless network and security Methodology- Review topics covered in lecture hours, from textbook, reference books plus online research, to behaviour a comprehensive study about wireless network security implementation at home.
Evaluate incorporation plan : Except the stock sale is an integral part of the incorporation plan
How to write a class named dayofyear that gets an integer : How to write a class named DayOfYear that gets an integer Day 2 would be January 2 Day 32 would be February 1 Day 365 would be December 31
How many cars in every team called chevy and ford : How many cars in every team called Chevy and Ford There are eight cars in every team called Chevy and Ford. One car from each team races its opponent on drag strip.
How to illustrate a memory map for a system : Illustrate a memory map for a system with a memory capability of 512MB. Each memory location in system is 8 bits.
How many tasks real-time application contain : How many tasks real-time application contain In this particular real-time application, there are many tasks; each runs exact same code except with different data each time.
Compute journal entries of retail store : Compute journal entries to record the above transactions for a retail store.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Software engineering and microprocessor systems

Software is required for a simple house burglar alarm system.

  Hardware support to memory management

Study any two multicore processor architecture and discuss the following features briefly

  Bourne shell and design suitable functions

Bourne shell and design suitable functions

  Develop a checkout lane simulation

Develop a checkout lane simulation that can be used to determine the optimal number of lanes that Cougar Mart should have open.

  Write an essay on wifi performance

Write an essay on WiFi performance

  Implementation of type data structures

How can string and word variable type data structures be implemented?

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  How to illustrate a memory map for a system

Illustrate a memory map for a system with a memory capability of 512MB. Each memory location in system is 8 bits.

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  How many cars in every team called chevy and ford

How many cars in every team called Chevy and Ford There are eight cars in every team called Chevy and Ford. One car from each team races its opponent on drag strip.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a use case diagram

Prepare a Use Case Diagram based on the given problem description.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd