Solved Homework: Question: Hi I need to write a program that accepts an email message in a multi-line area that displays in …

Hi I need to write a program that accepts an email message in a multi-line area that displays in plain text. It’s going to be a program that scans them for 30 spam keywords and keeps a score for each keyword hit, once it reaches a certain score it gets flagged as spam and prompts the user with a pop up window that says “Spam” or “Clear”. The program also needs to be an executable, NOT opened and run from the programming application everytime.

I’ll be asking several questions over the next 5 weeks regarding this and first I’d like to know if someone could show me some examples or show me the simplest form of this? the language is up to me according to the project but I don’t know if I want to do java, c#, or c++. If someone could show me how this is done that’d be great. I’m not sure which language is easiest for it.

Expert Answer

answers

This is easily been done by windows application called windows form using

c#

You can use richtextbox to get the user email message.

Evaluate button to chec for the spam messages

If spam exists then you can call for pop up using MessageBox in forms control.

Output will be like

Form1 button1_Click(object sender, EventArgse Enter your email message here Hai pranesh this is free for you spam OK Evaluate

code will be like

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace spamMessageForms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

string[] spamWords = { “offer”,”free”,”offer” };
int[] keyWordHit = new int[3];
string text;

private void button1_Click(object sender, EventArgs e)
{

string[] arr = (richTextBox1.Text).Split(‘ ‘);

for(int i=0;i<3;i++)
{
for(int j=0;j<arr.Length;j++)
{
if(spamWords[i]==arr[j])
{
keyWordHit[i]++;
MessageBox.Show(“spam”);

}
}
}

for(int i=0;i<spamWords.Length;i++)
{
text += spamWords[i] + ” ” + keyWordHit[i]+”n”;
}
MessageBox.Show(“Key word hit”+”n” + text);

}
}
}

Designer code:

namespace spamMessageForms
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name=”disposing”>true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support – do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(46, 60);
this.label1.Name = “label1”;
this.label1.Size = new System.Drawing.Size(151, 13);
this.label1.TabIndex = 0;
this.label1.Text = “Enter your email message here”;
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(49, 108);
this.richTextBox1.Name = “richTextBox1”;
this.richTextBox1.Size = new System.Drawing.Size(256, 136);
this.richTextBox1.TabIndex = 1;
this.richTextBox1.Text = “”;
//
// button1
//
this.button1.Location = new System.Drawing.Point(81, 291);
this.button1.Name = “button1”;
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 2;
this.button1.Text = “Evaluate”;
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(513, 393);
this.Controls.Add(this.button1);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.label1);
this.Name = “Form1”;
this.Text = “Form1”;
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Label label1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button1;
}
}

Please rate it if the above solution helps you in any way or if you have any concerns comment it, I will help you through again.

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?