Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Spam Code Calculator GUI

JBuild2N
JBuild2N 


JFrame with Label ("Spam Code Calculator"), JTextField with ("Type or paste text below:"), JTextArea (blank, but can key in email text), JCheckBox1 ("Clear"), JButton1("Verify). Can enter 30 messages with up to 40 characters. Each message worth one point (1pt). Verify shows Spam Score. Attachments Tags
Clarifications

Answers

Homework 2

felo
felo 



Find attached Solution Attachments
HW2.zip (18 K) Download












Preview
to calculate the number of * spam words found in a provided text * * @author */ public class

Preview
spamCount; private final String[] spamWords = {"as seen on", "buy", "meet singles", "extra income", "million dollars", "save big money", "opportunity", "cash", "no fees", "online degree", "work at home", "additional income", "eliminate debt", "lower interest rate", "pre-approved", "consolidate your debt", "avoid backruptcy", "miracle", "satisfaction", "risk free",

Preview
public void testCalculateSpamCount_MultipleMatches() { int result = instance.calculateSpamCount("You're A wiNNer! Collect your miLLion dollars in this RISK free oFFer."); assertEquals(4, result); } @Test public void testCalculateSpamCount_MultipleMatchesSameWord() { int result = instance.calculateSpamCount("buy BUY"); assertEquals(2, result);

Preview
textPanel.setLayout(new BoxLayout(textPanel, BoxLayout.PAGE_AXIS)); textPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); textPanel.add(headerPanel); textPanel.add(Box.createRigidArea(new Dimension(0, 5))); JScrollPane textScrollPane = new JScrollPane(messageArea); textPanel.add(textScrollPane); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 1

Preview
} FormattedDate formattedDate = parseDate(date); return String.format("%s %d, %d", months[formattedDate.getMonth() - 1], formattedDate.getDay(), formattedDate.getYear()); } private boolean validDateFormat(String date) { return date.matches("[0-1][0-9]\\/[0-3][0-9]\\/\\d\\d\\d\\d"); } private FormattedDate parseDate(String date) { FormattedDate formattedDate =

Preview
5, 0, 5)); dateField = new JTextField(15); dateField.setMargin(new Insets(5, 5, 5, 5)); DateConverter dateConverter = new DateConverter(); convertBtn = new JButton("Convert"); convertBtn.addActionListener((ActionEvent e) -> { try { JOptionPane.showMessageDialog(getContentPane(), String.format("The converted date is %s.", dateConverter.convertDate(dateField.getText()))); } catch (InvalidDateException ex) {

Preview
private int month; private int day; private int year; public int getMonth() { return month; } public void setMonth(int month) {

Preview
class HW2Exercise2 { /** * @param args the command line arguments */

Preview
/** * * @author */ public class InvalidDateException extends Exception { /** * Creates a new instance of <code>InvalidDateException</code> without * detail message. */ public InvalidDateException() {

spamscore.png (111 K) Download Preview

dateformatter.png (114 K) Download Preview

Screenshots
Screenshot
Screenshot
Purchase Answer

java program

vkbhardwaj
vkbhardwaj 



the file contains the program code
and i have attached the screen shots as well.
Attachments Screenshots
Screenshot
Screenshot
Purchase Answer