COMP 274 Week 6 Lab Calendar Program
$7.00
Description
The Calendar Program
The purpose of this lab is to give you a chance to use some of the data stream tools we have been discussing in a simple application. The assignment is to write a calendar application which allows the user to select a date, and either retrieve a previously stored calendar entry, or save a calendar entry.
Your program should present a GUI interface which allows the user to specify the month, day, and year of the calendar entry. The GUI should also have a text area for displaying and editing a particular entry. It will also need two buttons, one for saving an entry, and the other for retrieving an entry.
Required program elements:
Your user interface must allow the user to enter the month, day, and year. You can do this using text fields for input, or you can use ComboBoxes if you feel adventurous.
The only GUI components which create events that your program needs to handle are the save and retrieve buttons.
Don’t go overboard making your GUI beautiful! We are just looking for basic functionality here!
You must have a separate class which manages the calendar data. You will have a minimum of three classes in your application, a user interface class, the calendar manager class, and a calendar test class. The user interface class creates an instance of the calendar manager in its constructor and stores it in a member variable.
The calendar manager must provide methods which support saving a specific calendar entry and retrieving a specific calendar entry. The interfaces must be defined to only pass a single day’s calendar entry across the interface.
The calendar manager must store calendar data into files according to month+year. That is, the calendar entries for December 2011 must all be stored in the same file.
The calendar manager must use ObjectInput/OutputStreams to read/write data from/to files. The calendar manager will use an array to store String objects. The position of a String in this array corresponds to the calendar entry for a specific day.
The save method of the calendar manager will need to determine if a file exists for the requested month and year. If so, the object from that file must be read into the calendar manager. Otherwise, the calendar manager must create an empty String array. The new entry must be saved to the appropriate day’s location in the array. The modified array must be saved to the appropriate file.
The retrieve method of the calendar manager will need to determine if a file exists for the requested month and year. If not, return an error string indicating that there is no such entry. If the file exists, read the String array from the file and locate the requested day’s entry. If this entry is null, return an error string indicating that there is no such entry, otherwise return the entry.
Take screen shots of the output of your program. Paste the screen shots and your source code for your programs into a Word document. Submit your Word document.
SCREENSHOTS
SOLUTION
PAYMENT
ENTIRE COURSE
The solution includes a zip file.
Attachments [Move over files to preview content of those files]
COMP274_Lab_6.zip (226.77 KB)
COMP274_LAB6_Document.docx
COMP274_Lab6_Screenshot.png
java source code
Calendar.java
CalendarTest.java
CalendarUI.java
Netbeans project
COMP274Lab6
build
classes
.netbeans_automatic_build
.netbeans_update_resources
Calendar.class
CalendarTest.class
CalendarUI.class
week6
build.xml
manifest.mf
nbproject
build-impl.xml
genfiles.properties
private
private.properties
project.properties
project.xml
src
Calendar.java
CalendarTest.java
CalendarUI.java
test
Preview Calendar.java
xxxxxx xxxxxxxx() {
xxxxxxxxx = xxx xxxx(“xxxxxx”);
xx (!xxxxxxxxx.xxxxxx()) {
xxxxxxxxx.xxxxx();
} }
private String getFileName(String month, String year) { return month + “-” + year + “.txt”; }
private void getFile(String month, String year) { String filename = getFileName(month, year); File file = new File(directory, filename); if (!file.exists()) { entries = new String[0];
xxxx = 0;
} xxxx {
xxxx
xxxx = xxx xxxxxxxxx
();
xxxxxxxxxxxxxx xx = xxxx;
xxx {
xxxxxx xxxx;
Preview CalendarTest.java
xxxxxx xxxxx.xxxxx.xxxxxx;
xxxxxx xxxxx xxxxxxxxxxxx {
public static void main(String[] args) { CalendarUI gui = new CalendarUI(); gui.setBounds(100, 100, 270, 320); gui.setVisible(true); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
}
Preview CalendarUI.java
xxxxxx xxxxx.xxxxx.xxxxxx;
xxxxxx xxxxx.xxxxx.xxxxxxxxxxx;
xxxxxx xxxxx.xxxxx.xxxxxxxxx;
xxxxxx xxxxx.xxxxx.xxxxxxxxxx;
public class CalendarUI extends JFrame {
Calendar calendar; JComboBox year, month, day; JScrollPane scrollPane; JTextArea text; JButton saveButton, retriveButton;
public CalendarUI() { super(“Calendar”); calendar = new Calendar(); year = new JComboBox(new String[]{“2000”, “2001”, “2002”, “2003”, “2004”, “2005”, “2006”, “2007”, “2008”, “2009”, “2010”, “2011”, “2012”, “2013”, “2014”, “2015”, “2016”});
xxxxx = xxx xxxxxxxxx(xxx xxxxxx[]{“xxxxxxx”, “xxxxxxxx”, “xxxxx”, “xxxxx”, “xxx”, “xxxx”, “xxxx”, “xxxxxx”, “xxxxxxxxx”, “xxxxxxx”, “xxxxxxxx”, “xxxxxxxx”});
xxx = xxx xxxxxxxxx(xxx xxxxxx[]{“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “11”, “12”, “13”, “14”, “15”, “16”, “17”, “18”, “19”, “20”, “21”, “22”, “23”, “24”, “25”, “26”, “27”, “28”, “29”, “30”, “31”});
xxxxxx xxxxxxxxxx;
xxxxxxxxxx = xxx xxxxxx();
xxxxxxxxxx.xxx(xxxx);
Preview Calendar.java
xxxxxx xxxxxxxx() {
xxxxxxxxx = xxx xxxx(“xxxxxx”);
xx (!xxxxxxxxx.xxxxxx()) {
xxxxxxxxx.xxxxx();
} }
private String getFileName(String month, String year) { return month + “-” + year + “.txt”; }
private void getFile(String month, String year) { String filename = getFileName(month, year); File file = new File(directory, filename); if (!file.exists()) { entries = new String[0];
xxxx = 0;
} xxxx {
xxxx
xxxx = xxx xxxxxxxxx
();
xxxxxxxxxxxxxx xx = xxxx;
xxx {
xxxxxx xxxx;
Preview CalendarTest.java
xxxxxx xxxxx.xxxxx.xxxxxx;
xxxxxx xxxxx xxxxxxxxxxxx {
public static void main(String[] args) { CalendarUI gui = new CalendarUI(); gui.setBounds(100, 100, 270, 320); gui.setVisible(true); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
}
Preview CalendarUI.java
xxxxxx xxxxx.xxxxx.xxxxxx;
xxxxxx xxxxx.xxxxx.xxxxxxxxxxx;
xxxxxx xxxxx.xxxxx.xxxxxxxxx;
xxxxxx xxxxx.xxxxx.xxxxxxxxxx;
public class CalendarUI extends JFrame {
Calendar calendar; JComboBox year, month, day; JScrollPane scrollPane; JTextArea text; JButton saveButton, retriveButton;
public CalendarUI() { super(“Calendar”); calendar = new Calendar(); year = new JComboBox(new String[]{“2000”, “2001”, “2002”, “2003”, “2004”, “2005”, “2006”, “2007”, “2008”, “2009”, “2010”, “2011”, “2012”, “2013”, “2014”, “2015”, “2016”});
xxxxx = xxx xxxxxxxxx(xxx xxxxxx[]{“xxxxxxx”, “xxxxxxxx”, “xxxxx”, “xxxxx”, “xxx”, “xxxx”, “xxxx”, “xxxxxx”, “xxxxxxxxx”, “xxxxxxx”, “xxxxxxxx”, “xxxxxxxx”});
xxx = xxx xxxxxxxxx(xxx xxxxxx[]{“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “11”, “12”, “13”, “14”, “15”, “16”, “17”, “18”, “19”, “20”, “21”, “22”, “23”, “24”, “25”, “26”, “27”, “28”, “29”, “30”, “31”});
xxxxxx xxxxxxxxxx;
xxxxxxxxxx = xxx xxxxxx();
xxxxxxxxxx.xxx(xxxx);
Price: $19
Buy Now
Checkout
Added to cart
Buy More Save More
Buy at least TWO items & save up to 30% OFF your ENTIRE order!
Rack up instant rebates in your shopping cart. Simply add items to your cart, and see the savings add up.
Discounts will automatically be applied on eligible orders.
COMP 274 Week 6 Lab Calendar Program – $19.00
COMP 274 Week 7 Lab Java Doc – $19.00
Add to Cart
Checkout
Added to cart
FLASH SALE
$75
$108
Save $30
COMP274 Entire Course
Get Entire Course
You May Also Like:
COMP 274 Entire Course
COMP 274 Week 1 Lab
COMP 274 Week 2 Lab Inheritance and Polymorphism
COMP 274 Week 3 Lab Java Application GUI
COMP 274 Week 4 Lab Java Program to Convert Temperature
COMP 274 Week 5 Lab Timer and Mouse Events and Java Graphics
COMP 274 Week 7 Lab Java Doc
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.