Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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.

Java, Programming

  • Category:- Java
  • Reference No.:- M91930544
  • Price:- $50

Guranteed 36 Hours Delivery, In Price:- $50

Have any Question?


Related Questions in Java

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

  • 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