Dating game program, Programming Languages

Assignment Help:

You are to write a program that determines the day of the week for New Year's Day in the year 3000. To do this, you must create your own date class (MyDate) and use the following interface and main program:

/**

Interface for Date objects to be used by the Year3000 driver program.

*/

public interface DateInterface

{

/** @return the day of the month (1-31) */

publicintgetDay();

/** @return the day of the week (0-6) */

publicintgetDow();

/** @return the month of the year (1-12) */

publicintgetMonth();

/** @return the year (four digits) */

publicintgetYear();

/** sets the date

@param m the month of the year (1-12)

@param d the day of the mongth (1-31)

@param y the year (four digits)

@paramdow the day of the week (0-6) */

public void set(int m, int d, int y, intdow);

/** moves the date forward by exactly one day */

public void tomorrow();

/** @return the date as a String in the format "Monday March 18, 2002" */

public String toString();

/** Moves the date backward by exactly one day. */

public void yesterday();

/** sets the date to today;

make this empty {} unless you do the extra credit. */

public void today();

}

import java.io.*;

/**

Driver class for The Dating Game programming assignment.

*/

public class Year3000

{

public static void main(String [] args) throws IOException

{

DateInterface d = new MyDate();

d.set(1,29,2006,0); // sets the date to Sunday, January 29th, 2006

while(d.getYear()<3000)

{

d.tomorrow();

}

// at this point, d represents January 1, 3000

System.out.println(d);

}

}

When the program is compiled and run, it should use your MyDate class to correctly predict the day of the week for January 1st, 3000. Note that we are using the integers 0-6 for the days of the week, with 0 representing Sunday, 1 for Monday, etc.

Additional Requirements

- Implement a yesterday() function which moves the date one day backwards. Modify your main program to print the date, including the day of the week, for January 1st, 1800. 

- Using UML, create a high level design (a.k.a. architecture) of your program before implementation. Include your design (architecture) as an appendix to your Word document submission. You are required to include a simple use case diagram, class diagram and sequence diagram for at least one method.

Using the built-in Date class from Java, have your constructor automatically initialize the date to today. Also, add a today() function to your class to set the date to today. Modify the main program to print today's date using your class.

Hand In

In a single MS Word document with the following three clearly defined sections:

1. Listing (print-out) of your program source code (with comments and headers)

2. Screen captures of sample run outputs (at least 3 runs/scenarios)

3. High level design using UML notation

The filename must be in the following format:

Assignment3_Lastname-Firstname.doc or docx

Please enter the following in the subject line of your email submission:

Assignment3_Lastname-Firstname

Notes

- Don't forget to include comments (javadoccompatible), and remember to indent properly.

- Include pre- and post-conditions for your functions/methods. (That is, the comments should state what the function does, and what it needs to do it.)

- For simplicity, you can pretend all months have 30 days and that there are no leap years for early versions of your program. Add the actual month lengths and leap year information later.

- Aleap year is a year when February has 29 days. A year is a leap year if the year is divisible by 4, but not by 100, or if it is divisible by 100, it must also be divisible by 400. So 1900 was not a leap year, but 2000 was.

- Your tomorrow() and yesterday() functions should fit on one page or less. If they are bigger than that, use some helper functions to break them down.

- Utilize the submission template provided in the course module.


Related Discussions:- Dating game program

Created xml document using the css stylesheet, After studying the concept, ...

After studying the concept, terminology, and implementation of CSS stylesheets, create a stylesheet to accompany your solutions to Question 1. A rich collection of styles should be

Create calculate total project code uml models, Consider a system that has ...

Consider a system that has the following UML models: Use Case for CalculateTotalProjectCost Trigger: End of each month Normal Flow of Events For each project in the pro

Lalr parser - xml table output, LALR Parser: Rule Table - Contains de...

LALR Parser: Rule Table - Contains definitions of production rules within the grammar. Attributes: Count - Number of production rules in the table Child items:

Computes the least squares fit of the data, Your solution to the problem sh...

Your solution to the problem should be housed within a while loop, which allows the grader to test your solution repeatedly without having to re-execute the script, as shown in cla

Python , Write a script that will list and count all of the images in a giv...

Write a script that will list and count all of the images in a given HTML web page. Each image starts with

Define a prolog predicate flatten, Define a Prolog predicate flatten(List, ...

Define a Prolog predicate flatten(List, FlattenedList) that asserts List is any nested list of atoms and FlattenedList is the same list with the nesting removed. The atom [] should

What is linear programming problem, QUESTION 1 (a) (i) What is linear p...

QUESTION 1 (a) (i) What is linear programming problem? (ii) Define and explain the following terms: (1) objective function, (2) decision variable, (3) constraints, (4) feasi

Write a program to draw a sketch of a cow, write a program to draw a cow. N...

write a program to draw a cow. Now, draw a cow standing amongst the grass, with (say) 500 blades of grass. Each blade of grass should be a separate random green line. Do all your d

Flowchart and Pseudocode using Control Breaks, Shemrock Inc. is a brake pad...

Shemrock Inc. is a brake pad manufacturing company. This company uses raw materials, such as carbon powder, iron, ash, and resin. It wants to develop an inventory management system

Project on automatic payments to employees, A large logistics company requi...

A large logistics company requires a software system to support the business processes associated with managing shift patterns of employees and making the associated payments. The

Write Your Message!

Captcha
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