Warmup composition and file handling

Assignment Help Business Economics
Reference no: EM131457334

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.)

Reference no: EM131457334

Questions Cloud

Infographic using an infographic maker : Summarize what you have learned this week about web fonts into an infographic using an infographic maker such as Piktochart
Would you lean towards believing that jim would be : Would you lean towards believing that Jim would be more aligned with Humanistic perspectives or would Freud's theories be more his beliefs ?
What is tax bracket : Under current law, employer-paid health insurance premiums are deductible by the employer and not taxable to the employee. Suppose instead only the first $1,000
Explain their views of human nature and their worldviews : Provide a summary of each article, highlighting the processes that contemporary psychologists use to develop the theories of Freud and Rogers.
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
How much is mss tax deduction and when is it deductible : Suppose you are employed by MS Corporation. In year 1, you received nonqualified employee stock options (NQOs) to acquire 10,000 shares of MS's stock.
What is your opinion of the behavioral treatment approach : What is your opinion of the behavioral treatment approach? What aspects of the treatment most strongly contribute to your opinion?
Create a flowgorithm program from pseudocode : Create a Flowgorithm program from pseudocode Declare a String array containing names Ask the user to input a name
Which type of option plan do wahoo employees prefer : Wahoo, Inc., is a high-tech Internet company. It is trying to decide whether to issue NQOs or ISOs to its employees. Each employee will get 10 options.

Reviews

Write a Review

Business Economics Questions & Answers

  What is the likely impact on the exchange rate

In January of this year US equity markets were rattled by signs of a slowdown in growth of the Chinese economy and other emerging markets, collapsing prices of oil and stagnation in most of the Euro zone countries...What is the likely impact on the E..

  Determine the projected after-tax rate of return

A corporation expects to receive $32,000 each year for 15 years from the sale of a product. There will be an initial investment of $150,000. Manufacturing and sales expenses will be $8067 per year. Assume straight-line depreciation, a 15-year useful ..

  Combined by firms to produce goods and resources

What resources are combined by firms to produce goods and resources?

  Illustrate what would happens if there demand decreases

Illustrate what would happens to P* if there is a decrease in demand followed by an increase in supply followed by another decrease in demand.

  Qconsider a market with a demand function q 20 - p

q.consider a market with a demand function q 20 - p currently there are ten firms operating. each firm has the

  Q1 assume australias unemployment rate began to rise and

q1. assume australias unemployment rate began to rise and the government passed an investment tax credit to help

  Government expenditure need to be increased or decreased

Suppose there is a $200 billion recessionary gap. If there are no taxes or imports to restore the economy back to potential GDP how much should government expenditure be changed if the marginal propensity to consume is 0.75? Does government expenditu..

  Derive the labor demand functions

Derive the labor demand functions that are associated with the two production functions given below. The level of output is denoted by q. The two inputs are labor (h) and capital (k). You should derive the function that relates the level of labor uti..

  Aero specialties produces unmanned aerial vehicles

R/C Aero Specialties produces unmanned aerial vehicles (UAVs), or drones, for commercial and recreational uses. The company has updated its design to compete with Fuji Enterprises, but its production costs for this new model require a retail price th..

  Determine the sensitivity of net exports to interest rate

What factors determine the sensitivity of net exports to the interest rate? Consider the cases where net exports are very sensitive to the interest rate and where they are very insensitive. Compare the effect that an increase in the money supply has ..

  What is the implied price per share of this funding round

Starware Software was founded last year to develop software for gaming applications. Initially, the founder invested $800,000 and received 8 million shares of stock. Starware now needs to raise a second round of capital, and it has identified an inte..

  Market vs. command system- economic and political

Market vs. Command System- Economic and Political, which one is better and why? Answer should be at least five paragraphs long with examples, as well as 2 sources. APA style.

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