Description
Problem Description
Program Design
In order to bind the scope of the assignment, you are required to build a system that:
• Assign1 contains only a main method, which instantiates one Planner and calls runMenu().
• Planner has a private int constant which is used for the maximum amount of events, an array for Event references (10 references), an int and an OurDate reference, one constructor and six methods:
runMenu() – shows the menu, interacts with the user for menu selection, loops till they exit.
addEvent().
verifies that the maximum number of events is already in the Planner
deleteEvent()
If the event is found, delete it and move all the event references up one, so as not to leave a null element in the middle of the array. Remove one element from the numEvents counter.
• Event has an OurDate reference, a String reference, three constructors and six methods: Two overloaded setDate() methods.
setDescription().
getDate().
getDescription().
toString() – returns a String representation of the Event reference.
• OurDate has three fields, day, month and year, three constructors, and eleven methods:
setDay(), setMonth(), setYear(), each must verify that the day, month or year respectively is valid.
getDay(), getMonth(), getYear(), returns day, month or year, respectively.
isEqual() – compares two dates to see if they are equal..
toString() – returns a String representation of the OurDate reference.
Testing Design
Sufficiently testing all relevant parameters in this assignment would require a large amount of unit tests. Consequently, this assignment is going to confine the tests required, to those specified in the OurDateTester UML. Only the default (i.e. no formal parameters) constructor, and the overloaded, three input constructor require testing. As indicated, there should be one test for each field of the class OurDate. Each unit test should have an appropriate message if a test fails.
Discussion Questions
• How did the use of an array to manage references to Event objects help in creating this program?
(Would things have been easier with 10 separate variables, what about with 1000 Event objects?)
• What is the difference between Aggregation, and Composition? What is the relationship between Planner and Event and Why?
• What are the benefits of separating the test classes from the program classes using packages?
• How would automated testing help when changes are made to the software in future?
• List a few other features to test in the OurDate class with JUnit.
Comments Note
• At the top of each source code file include the following comment header, adding the needed information: /* File Name:
* Course Name:
* Lab Section:
* Student Name:
• Classes and class members (class level fields, constructors, methods) should have a brief description as a comment immediately above in the code listing. Example: /*
* Represents a, electronic Planner to keep track of * Events.
*/
public class Planner{
(Javadoc comments are not required for Assignment 1)
Tasks
Build the program, do not overlook the package name used for the program classes.
Build the JUnit test classes, use a separate package as indicated in the UML.
Write one-page essay, using MS Word, that addresses the discussion questions (below) as a guide to discuss what was accomplished in the lab, cite and reference any sources used online to help you answer questions.
Submission Requirements
• The essay should be an electronic document, Microsoft Word format, include your name inside the document.
• Your lab professor will indicate any additional submission requirements to you in the lab
Grading Rubric
Criteria*
(Equal Weight) Needs Work (0) Poor (1) Intermediate (2) Excellent (3) Value Scored
Naming Classes and class members follow no Java naming conventions. Java naming conventions are not well followed. Classes and class members follow Java naming conventions
with tiny inconsistencies. All classes, class
members are named following Java naming conventions, consistently and perfectly.
Comments
(Javadoc not required
Assign 1)
Comments missing or incorrect. Many classes and / or class members missing meaningful comments Very few classes and / or members missing comments, comments are meaningful. Nearly everything is commented, comments
are meaningful, brief, well written.
Discussion Missing or only repeats the questions Provides brief answers to questions Questions are answered and examples are used from the written code to illustrate Questions are answered with examples from code, student discusses how concepts in this program will be beneficial in future programing.
citations loosely follow
APA style References and
citations closely follow
APA style
Compiles Program does not compile, too many syntax mistakes for the professor to track or debug without major re-write. Program does not compile, has several syntax mistakes Program does not compile, has a few small syntax mistakes Program compiles
Execution Program is missing much functionality. For example program starts to run but does not work correctly. Program is missing much code, and much of the required concepts. Program demonstrates most of the concepts, some parts left out. Program demonstrates understanding and application of concepts notably manipulation of a 1 dimensional array, random numbers, and composition.
Unit Tests Unit tests omitted or largely incomplete Unit tests work but code is not well organized (within each
@Test method) Unit tests work and each @Test method has well organized code Unit tests work, each @Test method has well organized code, and meaningful variable names used to improve readability.
Max(21):
Total:
Notes on citations and references
• Please do not cite or reference other students, ask for the original sources from them and cite and reference those instead
• You will not get credit for an assignment or project if large portions are copied directly from other sources, even if you cite and reference the source(s) correctly. Assignments are to be your own original work; other works can be used for help in solving problems or as small pieces of your larger program. Determinations on this are up to the discretion of the professor, if in doubt check with your professor.
Appendix – Additional Notes
JUnit Testing – Learning Resources (See Blackboard for larger list)
McProgramming. (2014). Java – JUnit testing in Eclipse. [Video] Retrieved from https://www.youtube.com/watch?v=I8XXfgF9GSc
Lars Vogel. (2015). Unit Testing with JUnit – Tutorial. Retrieved from http://www.vogella.com/tutorials/JUnit/article.html
UML Class Diagram resource:
Donald Bell. (2004). UML basics: The class diagram. Retrieved from
http://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/#N100A5
Sample Program Run (user inputs are bold and highlighted):
Make a selection:
1. Add event to planner
2. Display event for a day
3. Display events for a week
4. Delete an event
0 to quit: 1
Enter event description: rock concert
Enter month: 3
Enter day: 4
Make a selection:
1. Add event to planner
2. Display event for a day
3. Display events for a week
4. Delete an event
0 to quit: 1
Enter event description: work
Enter month: 3
Enter day: 3
Make a selection:
1. Add event to planner
2. Display event for a day
3. Display events for a week
4. Delete an event
0 to quit: 1
Enter event description: dinner at folks
Enter year: 2015
Enter month: 3
Enter day: 5
Make a selection:
1. Add event to planner
2. Display event for a day
3. Display events for a week
4. Delete an event
0 to quit: 1
Enter event description: movie night
Enter year: 2015
Enter month: 3
Enter day: 4
Make a selection:
1. Add event to planner
2. Display event for a day
3. Display events for a week
4. Delete an event
0 to quit: 2
Enter year: 2015
Enter month: 3
Enter day: 5
Your events for 2015/3/5 are:
2015/3/5 – dinner at folks
Make a selection:
1. Add event to planner
2. Display event for a day
3. Display events for a week
4. Delete an event
0 to quit: 3
Enter year: 2015
Enter month: 3
Enter day: 1
Your events for the week starting 2015/3/1 are:
Your events for 2015/3/1 are:
Your events for 2015/3/2 are:
Your events for 2015/3/3 are:
2015/3/3 – work
Your events for 2015/3/4 are:
2015/3/4 – rock concert
Your events for 2015/3/5 are:
2015/3/5 – dinner at folks
Your events for 2015/3/6 are:
Make a selection:
1. Add event to planner
2. Display event for a day
3. Display events for a week
4. Delete an event
0 to quit: 4
Enter year: 2015
Enter month: 3
Enter day: 4
Make a selection:
1. Add event to planner
2. Display event for a day
3. Display events for a week
4. Delete an event
0 to quit: 3
Enter year: 2015
Enter month: 3
Enter day: 1
Your events for the week starting 2015/3/1 are:
Your events for 2015/3/1 are:
Your events for 2015/3/2 are:
Your events for 2015/3/3 are:
2015/3/3 – work
Your events for 2015/3/4 are:
Your events for 2015/3/5 are:
2015/3/5 – dinner at folks
Your events for 2015/3/6 are:
Make a selection:
1. Add event to planner
2. Display event for a day
3. Display events for a week
4. Delete an event
0 to quit: 0
Goodbye




Reviews
There are no reviews yet.