Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Business Economics Expert

Warmup Composition and File Handling

In this assignment, you'll read in dates from a .txt file, load an array of type Date objects, sort the array and write the Date values out to another text file.

Design a program that will read in dates from a file. The filename will be user-entered. The dates read from the file will be in the following format: month/day/year where month and day are 1 or 2 digits and year is 4 digits (note: the file will also contain the /'s - e.g. 3/24/2017) Proper date format is guaranteed, so no error checking is required.

Store each date in a Date object created from a Date class that you create (no java API classes like Calendar may be used.) Your Date class should contain a Day object, a Month object, and a Year object. This means you will also need to create Day, Month, and Year classes.

The Day class should have the following behaviors:

  • set the day (day number)
  • get the day number
  • return information on the day via toString (your toString should override the one inherited from Object)
  • compare days for equality (by overriding the equals method inherited from Object)
  • construct a day

The Month and Year classes should have similar methods to the Day class. You are welcome to provide other behaviors for each class, but make sure they make sense in the context of that class.

The Date class should the following behaviors:

  • set the date
  • get the date
  • display information on the Date via toString (override the toString inherited from Object): In the following format: Month as a word, the day and the year. Example: September 27 2013
  • If the toString includes the day of the week, the month of the year, the year, and the day number of the year (e.g. Thursday, September 27, 2017, day 270 of the year)
  • compare dates for equality (by overriding the equals method inherited from Object)
  • sort dates by year, then month, then day (overrides the compareTo method from the Comparable interface)
  • An EVC (the parameters to the constructor should be three integers)
  • A DVC (defaults to 1 1 1970 as its date)

Provide error checking to ensure any data assigned to any objects of the three classes falls in a reasonable range.

Create a tester file called DateTester that contains the main method as well as other methods to test the program as specified above. Provide other methods to perform specific tasks (display the menu, get input from user, etc.). The program flow should be implemented as follows:

  • obtaining the input filename from the user
  • read the file (use your FileUtil class to open the file)
  • count the dates
  • create an array of Date references that matches the count
  • fill the array with the Date objects
  • sort the array (use your SortSearchUtil class for sorting - type Comparable)
  • display a menu that allows the following choices:

Print the array of dates

  • To the screen
  • To a file if the user wants. You will need to prompt the user for the file name.

2. Allow the user to search for a date - Date will be user entered

3. Allow the user to add a date - will need to make a new array and copy over the dates and then re-sort

4. Allow the user to delete a date (by value) - will need to make a new array and copy over the dates

5. Quit

This menu should be displayed repetitively until the user chooses to quit

To turn in:

Be sure to contains all source files (.java files) necessary to compile and run your program (including SortSearchUtil.java and FileUtil.java.)

Business Economics, Economics

  • Category:- Business Economics
  • Reference No.:- M92266074
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Business Economics

The attractiveness of a country as a market or investment

The attractiveness of a country as a market or investment site depends on balancing the likely long-term benefits of doing business there, against the likely costs and risks. What do you consider are the determinants of ...

On the ballot illinois voters had the option to select yes

On the ballot, Illinois voters had the option to select "yes" or "No" when asked if the state's minimum wage should be increased from $8.25 to $10 an hour by January 1, 2015. Before the actual voting date, a survey with ...

Discuss three specific advantages and disadvantages

Discuss three specific advantages and disadvantages regarding the division of labor?

Consider a machine with exponential reliability model

Consider a machine with exponential reliability model. Assume that the breakdown rate is 1 and the repair rate is 2. Calculate the probability that the machine is up for more than 10 units of time. Calculate the probabil ...

Question 1 the toronto blue jays raises ticket prices from

Question 1: The Toronto Blue Jays raises ticket prices from $100 to $120 per seat and experience a decline in ticket sales from 12000 to 10000 per game. i) What is the elasticity of demand for tickets? ii) Assuming the m ...

Assume that the number of customers who arrive at a water

Assume that the number of customers who arrive at a water ice stand follows the Poisson distribution with an average rate of 6.4 per 30 minutes. What is the probability that more than one customer will arrive during the ...

A suppose that for a given year national saving in a

a. Suppose that, for a given year, national saving in a country (an open economy) equals 100, private consumption equals 50, and government consumption equals 20. What is the level of output in this country in this year? ...

Consider the following production function that is already

Consider the following production function that is already written in per worker terms: y = Akαh 1-α where h represents human capital per worker. Suppose we are given the following information: capital per worker in an e ...

From a random sample of 41 teens it is found that on

From a random sample of 41 teens, it is found that on average they spend 31.8 hours each week online with a standard deviation of 3.65 hours. What is the 90% confidence interval for the amount of time they spend online e ...

The elasticity of demand for daves famous is pizza is 26

The elasticity of demand for Dave's Famous is Pizza is 2.6. Dave is considering raising pizza prices by 20%. Is this a good idea? What will happen to his sales? His total revenue? Explain.

  • 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