4. private double planPrice;
private double rateForExtraMinutes;
private int peakMinutesIncluded;
private int offpeakMinutesIncluded;
public void Customer(String, String, double, double, int, int);
public String getName();
public void setName(String);
public String getnumber();
public void setNumber(String);
public double getPlanPrice();
public void setPlanPrice(double);
public double getRateForExtraMinutes();
public void setRateForExtraMinutes(double);
public int getPeakMinutesIncluded();
public void setPeakMinutesIncluded(int);
public int getOffpeakMinutesIncluded();
public void setOffpeakMinutesIncluded(int);
}
Assignment #2/bin/assignment2/Invoice.classpackage
assignment2;
publicsynchronizedclass Invoice {
private Customer customer;
private Call[] calls;
private int noCalls;
private double amountDue;
private int offPeakMinutesUsed;
private int peakMinutesUsed;
public void Invoice(Customer);
public void addCall(Call);
public int getNoCalls();
public Call getCall(int);
private int calcPeakMinutesUsed();
private int calcOffPeakMinutesUsed();
public void printInvoice();
13. For this report:
• The number of columns is 60.
• The content of the post/reply must be word wrapped.
• A reply must have a left margin which is a 4 space indent from
its parent post.
• If needed, truncate the length of the subject line to the
remaining width of a page.
Likewise for the "by" line.
• Note the "by" line lists only the member's first initial and last
name.
Write a test program to thoroughly test your class. You do not
need to use the example above
(if you do the dates will at least be different). However, make
sure your example has:
• At least 3 posts to the forum
• One post to the forum has no replies
• One post to the forum has at least 2 level of replies (a reply to
a reply)
• One post to the forum has at least 2 replies on the same level
• For replies use a subject line the subject line to which it is a
reply pre-pended with "Re: ".
• Demonstrate that your word wrapping is working for at least
to levels.
• Print both a summary report and a detailed report
• One forum is sufficient
To assist in this assignment, a class called RDate is available on
the T: cosc21 O. This class will
generate simulation data where is instantiation of an RDate is 2
minutes to one hour later than
14. the previous instantiation.
Additional specification:
• Use RDate for the date of the post and replies. Do not pass it
in as an argument in the
constructor. Instead create an new RDate instance inside the
constructor.
• In the forum defined an addPost method which takes as an
argument a member, a subject
line, and a content string (which could be very long). Have the
method create an instance
of a post and add it to the array. Return the instance of the post.
(this will allow the test
program to add replies to the replies)
• In the post class provide an addReply method which takes as
an argument a member and
a content string. Have the method create an instance of a post
and add it to the array.
Use the current posts subject line to generate the subject line
for the new post. Return the
instance of the post. (this will allow the test program to add
replies to the replies)
• Inyour forum, have a private method that will print the first 5
lines of a report (these are
the same between the two reports except for the second line).
Call the method from the
other two report methods to print the report header.
• No print should appear after the 50th column.
• Abide by good programming practices (e.g., naming
conventions, javadoc, indentation,
15. use of braces, etc.).
A sample detail report would be:
Assignment Discussion Forum
Detail Report
Owned by: David T Smith No Discussion: 3
Discussions
o or blank
by ~. Blue on Thurs, Feb 16 at 08:30pm
---------------------------
When printing the time logs does it matter if we have a 0 or
do you want a blank space in the overtime column?
Re: 0 or blank
by D. Smith on Thurs, Feb 16 at 07:21pm
I will accept either printing 0 or printing a space when
zero. Interesting question. How would I print space
instead of O?
Re: Re: 0 or blank
by B. Blue Thurs, Feb 16 at 09:21pm
To print a simple space or blank, just do a simple
if statement to print one form or another.
Re: Re: 0 or blank
16. by J. Green Thurs, Feb 16 at 09:22pm
Write a function to return 4 spaces when 0 or a
String representation of the number using %4d
Problems with formatting.
by C. Hope on Mon, Feb 12 at 01:52pm
I can't get normal hours to print. My code inside my print
method: System. out .printf ("Normal Hours worked: %50d vn ?
,
timeLog.getNormalHours() ) ;
Re: Problems with formatting.
by D. Smith on Mon, Feb 13 at 07:52am
Not sure what your problem is. The %50d looks odd.
Should it be more like %5d? That is only 5 digits wide
not 50.
Reminder - javadoc and formatting
by D. Smith on Tues, Feb 7 at 04:59pm
Reminder, Make sure you have javadoc before the class
declaration and before every public method. Make sure you
Use good formatting.
eose 210 -Object Oriented and GUI Programming
Assignment 3 Problem Statement
Bulletin boards/forums, such as the forums on moodle, provide
a means for individuals to ask
questions in the form of a post. Others may then post replies to
17. the initial post, and/or to other
replies. All communication in a forum is typically performed
on-line and recorded. For this
assignment it is desired to provide reports of all communication
that has been recorded in a
forum. Since the report is to be printed on paper that has a fix
width, the text of a post needs to
be printed in a word wrapped format. Furthermore, replies need
to be printed with 4 space
indentation to the parent post.
Develop classes to represent forums, posts, and members. A
forum is to have a short one line
title to the forum, and the member owning the forum. Have the
constructor for a member
consists of ONE argument which is the member's full name (i.e.,
first name followed by
middle initial and then last name). A post contains a subject
line, content (which can be a very
long string of text), the member creating the post, and the
date/time of the post.
In your forum class provide two print methods, one to print a
summary of posts and the other to
print the entire contents. A sample for the report produced by
the summary of posts is as
follows:
Assignment Discussion Forum
Summary Report
Owned by: David T Smith No Discussions: 3
Discussions By #Rs On
o or blank BTJ
18. Problems with formatting. CJH
Reminder - javadoc and format DTS
3
1
o
2/16 /15 08: 30pm
2/12/15 01: 52pm
2/07/15 04:59pm
For this report:
• The number of columns is 50.
• The title for the forum is to be printed in the center of the
page.
• If needed, truncate the length of the subject line of a post to
30 characters.
• The first By is the initials of the member making the post.
• #Rs is the total number of replies in response to this post
(includes nested replies)
• The On is the date and time of the initial post.
• This report does not show the replies themselves.
/
eose 210 -Object Oriented and GUI Programming
Assignment 3
-...,-- -. -
I
"'-------__,." ~
The objectives of this exercise are to:
19. 1) Gain further experience in the use of Eclipse IDE.
2) Gain further experience with control structures.
3) Gain an understanding of Strings within Java.
4) Develop and test a small Java program applying the concepts
of objectives 2 and 3.
5) Practice good programming conventions.
AFTER YOU HAVE COMPLETED: put all the files into a zip
file named [your
name]Assignment3.zip. Include all .class and .java files. Upload
the zip file to Moodle. Print
all source files and output produced by your test program. Tum-
in all materials by the due date.