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

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Write a program that mimics a flop-turn-river of poker game

Write down a program that mimics a flop-turn-river of a poker game. I must have three buttons titled Deal, Shuffle and Start Over.

  Data representation and logic

Representing Text and Numbers, Binary Arithmetic, Interpreting Logical Statements, Logic Puzzle, Binary and Algorithms.

  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.

  Mathematics in computing

Write the selection sort algorithm

  Explain the reason for the project development

Two members of your project development team are differing about relative significance of training and documentation.

  Implementation of type data structures

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

  Library management system

Prepare a module which can exhibit the Library Management System

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

  Designing a solution to the problem

Designing a solution to the problem and implementing the design using principles of correct syntax

  Security vulnerability

What is the security vulnerability of this solution

  A non-linear circuit problem

Computer program which will calculate the voltage across a resistor in the circuit

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