Skip to main content

. Day of the Year Assuming that a year has 365 days, write a class named DayOfYear that takes an integer representing a day of the year and translates it to a string consisting of the month followed by day of the month. For example,

2. Day of the Year

Assuming that a year has 365 days, write a class named DayOfYear that takes an integer

representing a day of the year and translates it to a string consisting of the month followed

by day of the month. For example,

Day 2 would be January 2

Day 32 would be February 1

Day 365 would be December 31.

The constructor for the class should take as parameter an integer representing the day of

the year, and the class should have a member function print() that prints the day in the

month-day format. The class should have an integer member variable to represent the day

and should have static member variables of type string to assist in the translation from

the integer format to the month–day format.

Test your class by inputting various integers representing days and printing out their

representation in the month–day format.

3. Day of the Year Modification

Modify the DayOfYear class, written in an earlier Programming Challenge, to add a

constructor that takes two parameters: a string representing a month and an integer in the

range 0 through 31 representing the day of the month. The constructor should then initialize

the integer member of the class to represent the day specified by the month and day of month

parameters. The constructor should 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 the following overloaded operators:

++ prefix and postfix increment operators. These operators should modify the DayOfYear

object so that it represents the next day. If the day is already the end of the year, the

new value of the object will represent the first day of the year.

—  prefix and postfix decrement operators. These operators should modify the DayOfYear

object so that it represents the previous day. If the day is already the first day of the

year, the new value of the object will represent the last day of the year

Comments

Popular posts from this blog

Starting with this provided code, add the following functionality

1.Starting with this provided code, add the following functionality: Replace hardcoded strings “Zero”, “One”, “Two”, “Three” in the ArrayList based on user typed input (use Scanner or JOptionPane classes). The user will be prompted for the String to be stored in the ArrayList and then hit enter. The user will be able to continue to add items to the ArrayList until they just hit enter without typing anything. Once the user does this (hits enter without typing anything), the program will display all of the elements of the ArrayList, both the index and String values, in a table. It will do this via a single loop making use of an iterator method. 2. Starting with this provided code, add the following functionality: Use a Try/Catch block so that the exception is caught and the program exits a bit more gracefully. Save this file as TryCatch.java. (Be sure to rename the Public Class accordingly.) Starting with the provided code again (without the Try/Catch block), fix the code so that

Josie Eskander

  Question 1: Task 1: Report Assume you are Josie Eskander. You are writing in response to techno trading P/L’s advertisement of a new laptop at 20% below normal price. You want information on brand name, availability of service and repairs, delivery times and methods of payment. Write the letter using the seven basic parts of the letter. In the opening paragraph present a clear and courteous request. Secondly write a response from techno trading giving details and proposing the sale. Provide draft of both emails in the space below. Question 2: Task 2: Report In pairs, nominate a good and a bad letter writer. Discuss the key differences. Write a good/bad letter from techno training to Alex Antonov accepting/declining his proposal to invest in the business Question 3: Task 3: Report Write a letter from techno trading p/l to a new client ‘new realities p/l’ urging them to buy techno new virtual reality software. Make a strong argument for the product. Question 4: Task 4: Report Write a l

THE AMERICAN REVOLUTION AND THE EARLY REPUBLIC

Assignment Overview The American Revolution and Independence As we saw in the Module Overview, there were numerous factors that ultimately led to revolution and independence. In this second Case assignment, you’ll be researching and writing about some of those factors. Case Assignment Write a 3 to 4-page essay identifying at least FOUR factors which led to colonial independence. In your paper, explain which events triggered discord between the colonies and the Mother Country. Be sure to do some research on your own and use other resources to analyze the thought-processes which sparked independent thinking. The best way to approach and organize the paper would be to create a title for each event and then discuss your findings. For example; for the first one you could write, “Event 1, The Seven Years War”. This would be followed by your narrative on how this war led to independence. The rest of the paper would follow this pattern. Assignment Expectations Use concepts from the background