Write a program that determines the day of the week

Assignment Help JAVA Programming
Reference no: EM131176131

Programming Assignment #3

Page 1 of 2

The Dating Game Program

Description

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

}

}

MCIS 503 Programming Assignment #3 Page 2 of 2

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. (Hint: back up to December 31st, 1799, and then call tomorrow() once.)

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

Extra Credit (up to 5 points)

• [5 points] 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.

Reference no: EM131176131

Questions Cloud

Yourself in regards to the behavior-attitude-motivation : Self-assessment detailing how you see yourself in regards to the behavior, attitude, motivation, stress, and decision making.  Assess your current stress level and address ways that you managed it? What techniques/strategies do you use in the decisio..
Behavior-attitude-motivation-stress and decision making : Self evaluation Exercise detailing how you see yourself in regards to the behavior, attitude, motivation, stress, and decision making. What motivates you most in the current job? What techniques have previous/current bosses used to motivate you and h..
How good are your communication skills : Consider the results that you received on all of the self-assessments you have taken so far this term and the culture of your organization. Where are the areas of conflict? How do you work through these conflicts, and what aspects of the culture keep..
Write a program of the dating game : The Dating Game Table of Contents for each section of this submission (i.e. Source Code listing, screen captures and UML design) here….Also, may include Javadoc source here.
Write a program that determines the day of the week : 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.
Write a program to compute statistics on a list of exam : You are to write a program to compute statistics on a list of exam scores, the Exam Statistics Program (ESP). The input is the name of a text file that contains the number of scores followed by the list of scores.
Write the exam statistics program : Programming Assignment #2 The Exam Statistics Program Include a Table of Contents here... * Assignment #2: The Exam Statistics Program
Design programs that communicate with web servers : Design programs that communicate with Web servers and server-side applications through the Hypertext Transfer Protocol (HTTP). Design Java programs that use the Structured Query Language to query and update relational databases. Describe the Java Ser..
Provide a detailed hypothetical mission : Provide a detailed hypothetical mission and value statement for the hospital. Provide a rationale for the development of your particular mission and value statement.

Reviews

Write a Review

JAVA Programming Questions & Answers

  What are the equilibrium price and quantity of corn

The table above contains information about the corn market. Use the table to answer the following questions. a.       What are the equilibrium price and quantity of corn? b.       Suppose the prevailing price is $9 per bushel. Is there a shortage o..

  Locate the errors in the following code

Locate the errors in the following code

  Create three jlabel and set their icons using the images

Write a Java programs which displays a frame that contains three labels. Each label displays a card, as shown in the figure below. Create three JLabel and set their icons using the images. Display three images from 54 image cards randomly

  Write a program to convert kilograms into pounds

Write a program that prompts the user to enter the mass of a person in kilograms and outputs the equivalent weight in pounds. Output both the mass and the weight rounded to two decimal places.

  Determining the taylor series

Suppose that you are told that the Taylor series of f(x)=x3ex^3 about x = 0 is x3+x6+(x9/2!)+(x12/3!)+(x15/4!)+...

  Describe the method overriding and overloading you would use

Discussion Question: Discuss an example of an inheritance hierarchy of Java superclasses and subclasses, and describe the method overriding and overloading you would use to maximize code reuse

  Technical community blog

Write a blog article for a coding/technical community blog

  How large a value can be stored in an integer variable

Most programming languages have a built-in integer data type. Normally this representation has a fixed size, thus placing a limit on how large a value can be stored in an integer variable

  Part a -code comprehensionusing the uncommented sample code

part a -code comprehensionusing the uncommented sample code has been provided in moodleanswer the following questions1.

  Create a program that automatically generates words

Create a program that automatically generates words from letters Solution

  Create a carloanclient class that read the file one payment

Create a CarLoanClient class that Read the file one payment at a time, Printout the payment number, payment amount and outstanding balance.

  Compare character just read in with character just popped

Compare the character just read in with the character just popped off the top of the stack. If the character is a left parenthesis, left curly bracket, or left square bracket then push that character onto the stack and read in the next character fr..

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