Spam (or junk e-mail) costs U.S. organizations billions of dollars a year in spam-prevention software, equipment, network resources, bandwidth, and lost productivity. In this exercise, you will be doing your part to help identify the likelihood that a given message is spam by assigning a spam score to a message entered by the user.

1. Create a graphical interface that looks similar to the one shown in Figure 1 below.

Figure 1. Graphical User Interface for Exercise 1: see image.

2. Table 1 below provides a list of 30 words or phrases that commonly occur in spam messages (this list is far from exhaustive). Write an application in which the user enters an email message into a JTextArea. When the user clicks the verify button, your application must scan the message for each of the 30 keywords or phrases. For each occurrence of one of these within the message, add a point to the message's "spam score."

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 bankruptcy Miracle
Satisfaction Risk free Free hosting You have been selected Weekend getaway You're a winner!
Offer Unlimited No obligation Trial Guarantee No purchase necessary

Table 1. Commonly occurring spam words and phrases

3. After calculating the spam score of the message, the application will display the spam score to the user via a message box, similar to that shown in Figure 2.

Figure 2. Message box displaying the spam score: see image.

4. When the user clicks the Clear button, erase the contents of the JTextArea box (i.e., set the text property to an empty string).

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.