Please tell me how to make a class CalendarDay that makes a valid date and stores...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Please tell me how to make a class CalendarDay that makes a valid date and stores the ● month, day, year in three separate instance variables inside the object. The class should contain the following methods: • A constructor that takes String data in the form "month/day/year" and initializes the instance variables. For example, new CalendarDay ("12/25/2000") should create a valid instance of the Calendar Day with month= 12, day = 25, and year = 2000. • A constructor that takes 3 separate integer parameters month, day, and year and initializes the instance variables. For example, new CalendarDay (11,20, 2016) should create a valid instance of the CalendarDay with month = 11, day = 20, and year = 2016. ● A copy constructor, which takes as argument an instance of CalendarDay and returns a new CalendarDay with identical properties. • Accessor and mutator (getter and setter) methods for month, day, and year. • Override the equals method that compares the current object with another object and return the correct results. • A toString method that returns a String description of the object. Additional requirements for the class: The months should be implemented as a group of enumerable objects, with each month having the ability verifying the validity of the day based on year and month, The mutator (setter) methods should throw an exception if the parameters are invalid or changes the object to an inconsistent state. When changes are made to the month or day or year, it should verify to make sure that it is a valid day. Create a Tester class and test all the methods. Also, create an array of random CalendarDay objects and use the Arrays.sort method to sort these objects. (This will indirectly test your .equals method!) Please tell me how to make a class CalendarDay that makes a valid date and stores the ● month, day, year in three separate instance variables inside the object. The class should contain the following methods: • A constructor that takes String data in the form "month/day/year" and initializes the instance variables. For example, new CalendarDay ("12/25/2000") should create a valid instance of the Calendar Day with month= 12, day = 25, and year = 2000. • A constructor that takes 3 separate integer parameters month, day, and year and initializes the instance variables. For example, new CalendarDay (11,20, 2016) should create a valid instance of the CalendarDay with month = 11, day = 20, and year = 2016. ● A copy constructor, which takes as argument an instance of CalendarDay and returns a new CalendarDay with identical properties. • Accessor and mutator (getter and setter) methods for month, day, and year. • Override the equals method that compares the current object with another object and return the correct results. • A toString method that returns a String description of the object. Additional requirements for the class: The months should be implemented as a group of enumerable objects, with each month having the ability verifying the validity of the day based on year and month, The mutator (setter) methods should throw an exception if the parameters are invalid or changes the object to an inconsistent state. When changes are made to the month or day or year, it should verify to make sure that it is a valid day. Create a Tester class and test all the methods. Also, create an array of random CalendarDay objects and use the Arrays.sort method to sort these objects. (This will indirectly test your .equals method!) Please tell me how to make a class CalendarDay that makes a valid date and stores the ● month, day, year in three separate instance variables inside the object. The class should contain the following methods: • A constructor that takes String data in the form "month/day/year" and initializes the instance variables. For example, new CalendarDay ("12/25/2000") should create a valid instance of the Calendar Day with month= 12, day = 25, and year = 2000. • A constructor that takes 3 separate integer parameters month, day, and year and initializes the instance variables. For example, new CalendarDay (11,20, 2016) should create a valid instance of the CalendarDay with month = 11, day = 20, and year = 2016. ● A copy constructor, which takes as argument an instance of CalendarDay and returns a new CalendarDay with identical properties. • Accessor and mutator (getter and setter) methods for month, day, and year. • Override the equals method that compares the current object with another object and return the correct results. • A toString method that returns a String description of the object. Additional requirements for the class: The months should be implemented as a group of enumerable objects, with each month having the ability verifying the validity of the day based on year and month, The mutator (setter) methods should throw an exception if the parameters are invalid or changes the object to an inconsistent state. When changes are made to the month or day or year, it should verify to make sure that it is a valid day. Create a Tester class and test all the methods. Also, create an array of random CalendarDay objects and use the Arrays.sort method to sort these objects. (This will indirectly test your .equals method!) Please tell me how to make a class CalendarDay that makes a valid date and stores the ● month, day, year in three separate instance variables inside the object. The class should contain the following methods: • A constructor that takes String data in the form "month/day/year" and initializes the instance variables. For example, new CalendarDay ("12/25/2000") should create a valid instance of the Calendar Day with month= 12, day = 25, and year = 2000. • A constructor that takes 3 separate integer parameters month, day, and year and initializes the instance variables. For example, new CalendarDay (11,20, 2016) should create a valid instance of the CalendarDay with month = 11, day = 20, and year = 2016. ● A copy constructor, which takes as argument an instance of CalendarDay and returns a new CalendarDay with identical properties. • Accessor and mutator (getter and setter) methods for month, day, and year. • Override the equals method that compares the current object with another object and return the correct results. • A toString method that returns a String description of the object. Additional requirements for the class: The months should be implemented as a group of enumerable objects, with each month having the ability verifying the validity of the day based on year and month, The mutator (setter) methods should throw an exception if the parameters are invalid or changes the object to an inconsistent state. When changes are made to the month or day or year, it should verify to make sure that it is a valid day. Create a Tester class and test all the methods. Also, create an array of random CalendarDay objects and use the Arrays.sort method to sort these objects. (This will indirectly test your .equals method!) Please tell me how to make a class CalendarDay that makes a valid date and stores the ● month, day, year in three separate instance variables inside the object. The class should contain the following methods: • A constructor that takes String data in the form "month/day/year" and initializes the instance variables. For example, new CalendarDay ("12/25/2000") should create a valid instance of the Calendar Day with month= 12, day = 25, and year = 2000. • A constructor that takes 3 separate integer parameters month, day, and year and initializes the instance variables. For example, new CalendarDay (11,20, 2016) should create a valid instance of the CalendarDay with month = 11, day = 20, and year = 2016. ● A copy constructor, which takes as argument an instance of CalendarDay and returns a new CalendarDay with identical properties. • Accessor and mutator (getter and setter) methods for month, day, and year. • Override the equals method that compares the current object with another object and return the correct results. • A toString method that returns a String description of the object. Additional requirements for the class: The months should be implemented as a group of enumerable objects, with each month having the ability verifying the validity of the day based on year and month, The mutator (setter) methods should throw an exception if the parameters are invalid or changes the object to an inconsistent state. When changes are made to the month or day or year, it should verify to make sure that it is a valid day. Create a Tester class and test all the methods. Also, create an array of random CalendarDay objects and use the Arrays.sort method to sort these objects. (This will indirectly test your .equals method!)
Expert Answer:
Answer rating: 100% (QA)
create a CalendarDay object that stores the month day and year and provides ... View the full answer
Related Book For
Financial Accounting and Reporting
ISBN: 978-0273744443
14th Edition
Authors: Barry Elliott, Jamie Elliott
Posted Date:
Students also viewed these programming questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Which do you feel is more important for a new business: the income statement or the statement of ash flow? Why?
-
Explain the significance of binomial coefficients with respect to Bernoulli trials.
-
Let g(x) = x for x 0. a. Find the average rate of change of g(x) with respect to x over the intervals [1, 2], [1, 1.5] and [1, 1 + h]. b. Make a table of values of the average rate of change of g...
-
Write a Monte Carlo code for a system of \(N\) hard spheres of diameter \(D\) on a one-dimensional ring of length \(L\) with periodic boundary conditions. Calculate the pair correlation function and...
-
The following sample information was obtained by taking four doughnuts per hour for twelve hours from Fawcett Bakerys doughnut process and weighing them: For the data shown above a. Find the x and R...
-
Suppose A utility function U(x) = {ax{ +(1-)x2}" with a > 0 and p>0 is defined over the set S = {(x) | xp+x2P2 M} where P, P2 are prices. Prove that if P1, P2 and M are positive, there exists at...
-
Identify by letter the curve you would expect in the titration of a solution containing (a) Disodium maleate, Na 2 M, with standard acid. (b) Pyruvic acid, HP, with standard base. (c) Sodium...
-
Berry Company has monthly salaries of $34,000. Assume Berry pays all the standard payroll taxes, no employees have reached the payroll tax limits, total income tax withheld iS $2,000, and the only...
-
Q.1. Suppose today a 10 percent coupon bond sells at par. Two years from now, the required return on the same bond is 8 percent. What is the coupon rate on the bond then? What is the YTM? Q.2 A...
-
Summarize an article in which a public company is facing accounting challenges. 2. Summarize an article in which a government based organization is facing accounting challenges. 3. Summarize an...
-
For each of the two cases below, determine the water pressure, pressure head, elevation head, and total head at points A, B, and C. Please solve each case using: (a) the upper reservoir level as the...
-
Today is April 15, 2011. As the Business Manager, Linda Peysar is responsible for analyzing the current state of Tollbrook Public Library, updating the environmental scan, analyzing the various...
-
In a market demand and supply equations are: The demand curve is given as: P = 50 - 3Q The supply curve is given as: P = 10 + 2Q Assuming a perfectly competitive market: 1) What is the equilibrium...
-
1. What are the benefits of using primary sources? 2. Why do you think most history textbooks are secondary sources? 3. What are the advantages and disadvantages of accessing online primary sources?...
-
1) Predict the organicproduct formed when BzCl reacts with cyclohexanol. BzCl = benzoylchloride. 2) Provide the majororganic product of the reaction below. 3) Draw the structureof the product formed...
-
The following is the draft trading and income statement of Parnell Ltd for the year ending 31 December 2003: You are given the following additional information, which is reflected in the above...
-
Gettry Doffit plc is an international company with worldwide turnover of 26 million. The activities of the company include the breaking down and disposal of noxious chemicals at a specialized plant...
-
The draft statement of financial position of Telin plc at 30 September 20X5 was as follows: Preference shares of the company were originally issued at a premium of 2p per share. The directors of the...
-
Calculate the ignition delay period (in deg ca) in a diesel engine using Eqns (16.15a) and (16.15b) using the conditions at the beginning of fuel injection that exist after compression in the engine...
-
This question is based on Fig. 16.9. An engine operating on an Otto cycle has a maximum peak pressure of \(60 \mathrm{bar}\). If the pressure and temperature at the beginning of the cycle are 1.0 bar...
-
Compare the air-standard cycle thermal efficiencies of an Otto cycle obtained by calculating the state points around the cycle with the value obtained from Eqn (3.16) for an 'engine' operating with a...
Study smarter with the SolutionInn App