Encerrado

Write some easy code in c/c++

I need you to develop some software for me. I would like this software to be developed for Linux using C or C++. I need you to develop some software for me. I would like this software to be developed for Linux using C or C++. Small homework projects. Jee-mail, a small email service provider, has been receiving complaints from customers claiming that their inboxes are clogged with the dozens of spam email messages they receive each day. Consequently, Jee-mail has contracted with the Fruggle Corporation to design and build a spam detection system. Of course, since Fruggle gets all of its labor by exploiting El Camino students, you'll be doing all of the [url removed, login to view] one or more email messages, your program will have to classify each one as either spam or legitimate. Jee-mail wants you to build a point-based anti-spam system. Your program is to look for certain suspicious features in the email, such as frequent use of exclamation points (!), use of words like FREE, or excessive use of uppercase letters. Each time such a suspicious feature is found, you increase a score that indicates how suspicious an email is. If an email's score exceeds 100 points, then it is classified as spam; otherwise, it is deemed legitimate. The detailed rules for scoring a message are in the Spam Rules section [url removed, login to view] TranscriptHere is a sample transcript of the program, with boldface text representing the user's [url removed, login to view] the subject line of the email: MAKE MONEY FAST XTFWAQQQ

Enter the body of the email. Press Enter on an empty line to finish.

THIS IS YOUR CHANCE TO MAKE lots of moolah!

CLICK ON [url removed, login to view] FOR MORE INFORMATION!

← the user just hit the enter key on this line

This email is classified as spam, because its spam score is 115.

Would you like to classify another email (y or n)? Quit

Please enter y or n.

Would you like to classify another email (y or n)? Y

Please enter y or n.

Would you like to classify another email (y or n)? y

Enter the subject line of the email: hi mom

Enter the body of the email. Press Enter on an empty line to finish.

Hi mom,

I hope you're doing OK. My CS class is great, but the instructor is WEIRD!

I love you!

← the user just hit the enter key on this line

This email is classified as legitimate, because its spam score is 0.

Would you like to classify another email (y or n)? n

Number of spam messages: 1

Number of legitimate messages: 1

Input and Output SpecificationThe first line that your program must print out is exactly this (with one space after the colon):Enter the subject line of the email:

Your program must then read the subject line the user types in. (It is not an error if the subject line is the empty string.) After that, your program must print out exactly this line:Enter the body of the email. Press Enter on an empty line to finish.

Your program must then read the message body lines the user types in. The message body consists of zero or more lines. After your program reads an empty line, which indicates the end of the message, it must print out exactly one of these two messages, depending on whether applying the spam rules classified the message as spam or not:This email is classified as spam, because its spam score is number.

orThis email is classified as legitimate, because its spam score is number.

In these messages, number is to be replaced by the appropriate spam score, such as 115, or 0, or [url removed, login to view] printing the classification message, your program must print exactly this (with one space after the question mark):Would you like to classify another email (y or n)?

Your program must then read the line the user types in. If the user types only a lowercase y, the program must process another email, starting with the step where it prints the prompt for the subject line of the email. If instead, the user types only a lowercase n, the program must print an empty line, then print the following two lines, then terminate:Number of spam messages: number

Number of legitimate messages: number

In these messages, the first number is the number of messages that were classified as spam, and the second is the number that were classified as [url removed, login to view] the user types anything other than a single lowercase y or n in response to the question, the program must print out exactly the line:Please enter y or n.

and repeat the prompt about classifying another email. It must repeatedly prompt the user until y or n is [url removed, login to view] RulesThe Jee-mail spam experts have come up with five rules, each of which can contribute some points to the spam score of a message. If the total spam score for the message is more than 100, the message is classified as spam; otherwise, it is considered a legitimate message. You must use only these five rules; do not improvise and make up your own. (Save that for when you start your own competing spam filter company.)First, some definitions: a word in a string is a contiguous sequence of letters delimited either by non-letter characters or by the start or the end of the string. A letter may be upper- or lowercase. As an example, the string It's like the old-fashioned 1980s! has these seven words: It s like the old fashioned s. A consonant is a letter other than one of these ten:[url removed, login to view] are the five rules. The first three relate to the subject line of the email, while the last two are concerned with the body of the [url removed, login to view] the subject line has at least one word, and more than 90% of the words in the subject line consist of only uppercase letters, then add 30 points to the spam score. For example, a subject line ofGET A DIPLOMA FREE!!

meets this [url removed, login to view] the last word of the subject line contains more than 3 consecutive consonants, then add 40 points to the spam score. Spammers often place random words at the end of a subject line to confuse some anti-spam software; this rules detects many of those random words. For example, this subject line earns the 40 point addition to the score:This stock is going up, up, up! mqafrpxo!

If the subject line contains 3 or more contiguous exclamation points, then add 20 points to the spam score. This subject line qualifies for the 20 points, for example:Make money fast!!! No experience necessary!!!!!

If the body of the message has at least one word, and more than 50% of the words making up the body of the email consist entirely of uppercase letters, then add 40 points to the score. For example, this email:Subject: Greetings from your good friend

Body:

THIS IS YOUR CHANCE TO MAKE lots of moolah!

GO TO [url removed, login to view] FOR MORE INFORMATION!

earns the 40 points because there are 17 words in the body of the email, 11 of which (64.7%) are entirely uppercase. Each time one of the following special words is found in the body of the email, add 5 points to the spam score for that message. The letters in these words may be in either case (e.g., SeX is the same as sex):buy

cheap

click

diploma

enlarge

free

lonely

money

now

offer

only

pills

sex

For example, this message would score 35 points, 5 for each of the words indicated in boldface:Subject: Looking for cheap tickets?

Body:

You can find cheap! tickets ONLY on our website. Save money with this

great OfFeR!! Don't be a cheapskate. Click now for this offer!

Notice that the "cheap" in the subject line is ignored by this rule, as is the word "cheapskate" in the second line of the [url removed, login to view] You Must WriteWe know that this will be the most complex program that many of you will have written in your programming careers to date, so we will make it easier for you by decomposing the problem for [url removed, login to view] get full credit for this project, you must implement all of the following functions, using the exact function names, parameters types, and return types shown in this specification. The functions must not use any global variables whose values may change. (Global constants are all right.) In addition to testing your program as a whole, we will also test each of the following functions separately. That way, if your program doesn't work overall but you correctly implemented some of the functions, you'll still get some [url removed, login to view] functions you must implement are getFirstWord

getLastWord

extractWord

isUppercase

makeUppercase

hasMultipleExclamations

isGibberishWord

Your solution should use these functions where appropriate (although you might not use every one of them). One reason is to help you get partial credit in the case where most of your program is correct, but a few of the function implementations are [url removed, login to view] help you implement these functions, you might choose to write additional functions as well. While we won't test those additional functions separately, using them may help you structure your program more readably. If you find it helpful, you might have some of these seven required functions call other functions in that [url removed, login to view] you turn in your solution, none of these seven required functions, nor any functions that they call, may read any input from cin or write any output to cout. (Of course, during development, you may have them write whatever you like to help you debug.) If you want to print things out for debugging purposes, write to cerr instead of cout. cerr is the standard error destination; items written to it by default go to the screen. When we test your program, we will cause everything written to cerr to be discarded instead — we will never see that output, so you may leave those debugging output statements in your program if you [url removed, login to view] getFirstWord(string text)This function returns the first word in the string variable text. If text has no words, this function returns the empty string (i.e. ""). Here is an incomplete test driver for this function: void test()

{

// This writes "Hello"

cerr << getFirstWord("!!Hello, Fred") << endl;

// This writes "greetings 9"

string msg = "greetings, mom, how are you?";

string result = getFirstWord(msg);

cerr << result << " " << [url removed, login to view]() << endl;

// This writes "0"

string s = getFirstWord(" $@#%!!");

cerr << [url removed, login to view]() << endl;

}

Hint: The string substr function may be of use in the implementation of this [url removed, login to view] getLastWord(string text)This function returns the last word in the string variable text. If text has no words, this function returns the empty string (i.e. ""). As an example, getLastWord("MAKE MONEY FAST!!") returns "FAST".Hint: The string substr function may be of use in the implementation of this [url removed, login to view] extractWord(string& text)This function returns the first word in the string that text is a reference to. If that string has no words, this function returns the empty [url removed, login to view] function also modifies the string that text refers to. If that string has no words, then this function sets text to the empty string. Otherwise, it removes from text the first word of textand all non-letters preceding that first word. Here is an incomplete test driver: void test()

{

string s = "***AMAZING!*** Do it, now!!";

string w = extractWord(s);

// This writes "AMAZING" and "!*** Do it, now!!"

cerr << w << endl << s << endl;

w = extractWord(s);

// This writes "Do" and " it, now!!" (space before "it")

cerr << w << endl << s << endl;

w = extractWord(s);

// This writes "it" and ", now!!"

cerr << w << endl << s << endl;

w = extractWord(s);

// This writes "now" and "!!"

cerr << w << endl << s << endl;

w = extractWord(s);

// This writes "" and "" (both empty strings)

cerr << w << endl << s << endl;

}

Hint: The string substr function may be of use in the implementation of this [url removed, login to view] isUppercase(string text)This function returns true if and only if every letter in the string text is uppercase. (For a string with no letters, this means the function returns true.) Non-letter characters in the string text, if any, have no effect on the result of this [url removed, login to view] makeUppercase(string text)This function returns a new string identical to the value of the string text, except that each lowercase letter of text appears as its uppercase equivalent in the result string. For example,makeUppercase("Earn *big* MONEY at home!!") returns "EARN *BIG* MONEY AT HOME!!".bool hasMultipleExclamations(string text)This function returns true if and only if the string text contains three consecutive exclamation marks. For example, it returns true for the strings "Wow!!!" and "Congrats!!!! Good luck", and false for the strings "W!I!N!" and "!! !".bool isGibberishWord(string text)This function returns true if and only if the string text contains more than three consecutive consonants. For example, it returns true for the strings "AGPQrxab" and "xxxxozzzz", and false for the strings "mortgage" and "discount prescriptions".Programming GuidelinesThe correctness of your program must not depend on undefined program behavior. Your program must never access out of range positions in a [url removed, login to view] must use your best programming style, including commenting where appropriate. Be sure that your program builds successfully, and try to ensure that your functions do something reasonable for at least a few test cases. That way, you can get some partial credit for a solution that does not meet the entire specification. To test your program effectively, you should unit testeach of your functions individually, and system test your entire program to ensure that all of the functions work together as [url removed, login to view] way to organize your program so that you can easily switch between testing individual functions and running the whole program normally is to do something like this: const bool unitTesting = true;

int main()

{

if (unitTesting)

{

doUnitsTests();

return 0;

}

… // code for the normal behavior goes here

}

The doUnitTests function does all your unit tests. To test the whole program normally, just change the value of the unitTesting variable from true to false (and make sure it's falsewhen you turn in the program).There are a number of ways you might write doUnitTests. One way is to interactively accept test strings: void doUnitTests()

{

string s;

for (;;)

{

cerr << "Enter text: ";

getline(cin, s);

if (s == "quit")

break;

cerr << "isUppercase returns ";

if (isUppercase(s))

cerr << "true" << endl;

else

cerr << "false" << endl;

cerr << "getFirstWord returns ";

cerr << getFirstWord(s) << endl;

}

}

While this is flexible, you run the risk of not being able to reproduce all your test cases if you make a change to your code and want to test that you didn't break anything that used to [url removed, login to view] way is to hard-code various tests and report which ones the program passes: void doUnitTests()

{

if (getFirstWord("hello there") == "hello")

cerr << "Passed test 1: getFirstWord(\"hello there\") == \"hello\")" << endl;

if (!isUppercase("WoW"))

cerr << "Passed test 2: !isUppercase(\"WoW\")" << endl;

}

This can get rather tedious. Fortunately, the library has a facility to make this easier: assert. If you include the header <cassert> you can call assert in the following manner: assert(some boolean expression);

During execution, if the expression is true, nothing happens and execution continues normally; if it is false, a diagnostic message is written telling you the text and location of the failed assertion, and the program is terminated. As an example, here's a very incomplete set of tests: #include <cassert>

void doUnitTests()

{

assert(getFirstWord("hello there") == "hello");

assert( isUppercase("WOW!!") );

assert( !isUppercase("WoW!!") );

string s = "***hello there";

assert( extractWord(s) == "hello" && s == " there" );

assert( extractWord(s) == "there" && s == "" );

assert( extractWord(s) == "" && s == "" );

cerr << "All tests succeeded" << endl;

}

The reason for writing one line of output at the end is to ensure that you can distinguish the situation of all tests succeeding from the case where one function you're testing silently crashes the [url removed, login to view] a program that manipulates a string entered by the user.

The program should start by asking the user to enter a word, a sentence, or a string of numbers. Store whatever the user enters into a C++ string.

The program should then display the following menu:

USE THIS MENU TO MANIPULATE YOUR STRING

----------------------------------------

1) Inverse String

2) Reverse String

3) To Uppercase

4) Jumble String 4-1 Sample Run

5) Count Number Words

6) Count Consonants

7) Enter a Different String

8) Print the String

Q) Quit¨ If the user selects 1: Inverse the upper and lower case letters of the string. If the string contains numeric characters or special characters do not change them. NOTE: This option should actually change the string to its inverse. Note this option does not display the changed string. If a user wanted to inverse the string and then display the string’s inverse they would select option 1 and then they would select option 8. Example: If the string is: My name is John and I am 20 years old. The inverse would be: mY NAME IS jOHN AND i AM 20 YEARS OLD. ¨ If the user selects 2: – Reverse the order of the characters in the string. NOTE: This option should actually change the string to its reverse. Note this option does not display the changed string. If a user wanted to reverse the string and then display the string’s reverse they would select option 2 and then they would select option 8. Example: If the string is: 2015 The reverse would be: 5102 ¨ If the user selects 3: Convert all of the characters in the string to uppercase. If the String contains numeric characters or special characters do not change them. NOTE: This option should actually change the string to all uppercase letters. Note this option does not display the changed string. If a user wanted to change the string to uppercase and then display the new string (in all uppercase) they would select option 3 and then they would select option 8. ¨ If the user selects 4:– Call a function named jumbleString. The jumbleString function takes a string as input and displays a jumbled version of that string. The jumbleString function should be called using current version of the string an argument (input) to the function. Example: If the string passed to the jumbleString function is: hello A jumbled version of the word would be: elhlo Note 1: there are many different jumbled versions of each word that the jumbleString function could display. So elhlo is not the only correct output for the above example. Note 2: Notice that this option does not actually change the string like the first two menu selections do, the jumbleString function just displays a jumbled version of the string rather than actually changing the string ¨ If the user selects 5: Call a function named countWords that counts the number of words in the current string and displays a message stating how many words are in the string Examples: The string “2015” has one word The string “Hello World” has two words The string “ I am Woman ” has 3 words ¨ If the user selects 6: Call a function named countConsonants that counts the number of consonants in the current string and displays a message indicating how many consonants the string contains. Consonants are letters that aren’t vowels. Example: If the string is: Hello The number of consonants is: 3 So display: “The number of consonants in the string is 3.” ¨ If the user selects 7: Let the user enter another string for processing. (This should just change the string stored in the original string variable you created at the beginning of the program) ¨ If the user selects 8: Print the Stringo So if the original string was “Hello” and the user processed the string with option 3 followed by option 2, followed by option 8, the string would print out as “OLLEH” (This is hello first converted to uppercase and then reversed). ¨ If the user selects ‘Q’ or ‘q’: Quit the program ¨ Allow the user to continue processing strings (using the menu) until they select ‘Q’ or ‘q’ to quit ¨ If the user makes an invalid menu selection, print an error message to the screen Your program must include the following three functions (you can include more if you want):1. countWords: A function that takes a string as an argument and counts the number of words in it (this function should return an int which is the number of words in the string)2. countConsonants: A function that takes a string as an argument and counts the number of consonants in it (this function should return an intwhich is the number of consonants in the string)3. jumbleString: A function that take a string as an argument and displays a jumbled version of the original string.

Habilidades: Programação C, Programação C++ , Linux, Arquitetura de software

Ver mais: simple c programs with output, c++ programming examples, c programs pdf, simple c programs for practice, c programs with solutions, c programming examples with output pdf free download, c programs list, c programs examples, dnn write asp code, easy code mafia online text game, write custom code godaddy reseller, write javascript code anywhere window shows key pressed, easy code simple game, write html code post article blog, write php code tiny mce

Acerca do Empregador:
( 1 comentário ) hawthorne, United States

ID do Projeto: #14892338

21 freelancers estão ofertando em média $40 para este trabalho

$233 USD em 1 dia
(78 Comentários)
7.3
hbxfnzwpf

Relevant Skills and Experience I am very proficient in c and c . I have 16 years c developing experience now, and have worked for more than 6 years. My work is online game developing, and mainly focus on client side Mais

$100 USD in 2 dias
(123 Comentários)
6.9
$25 USD em 1 dia
(77 Comentários)
6.9
xzan88

Hi, I have 10 years of C++ experience. I have read the entire description. I am sure that I can finish this in one day. Please contact me. Relevant Skills and Experience 10 years of C++ experience Proposed Milestones Mais

$30 USD em 1 dia
(80 Comentários)
5.8
TetyanaS

I am author of these books: - Object-oriented programming in C++:[url removed, login to view] - 150 C++ Programming Assignments. Variants of Tasks & Examples of Code: [url removed, login to view] Relevant Skills and Exper Mais

$40 USD em 1 dia
(13 Comentários)
4.3
ahmedwaqas147

hi, i am c, c++ programer. i can code it for linux machines.

$30 USD em 1 dia
(3 Comentários)
4.3
$15 USD em 1 dia
(14 Comentários)
4.0
shobhacodeguru

Have more than 10+ years of C application programming experience in some of the World's Top MOst Software Companies. Stay tuned, I'm still working on this proposal.

$10 USD em 1 dia
(7 Comentários)
3.3
isparrowsolution

Hello hiring manager I read your details and I understand is that you wish to develop software in Linux using C++. Relevant Skills and Experience We are expert in C Programming, C++ Programming, Linux, Machine Learni Mais

$25 USD em 1 dia
(3 Comentários)
2.4
$55 USD em 1 dia
(1 Comentário)
1.7
asimhussain26

Hello I am good with C++. Preview my profile.

$30 USD em 1 dia
(2 Comentários)
1.5
omkarjpathak

Experienced in C and Linux Relevant Skills and Experience 8 years of industry experience Proposed Milestones $20 USD - Deliverable

$20 USD em 1 dia
(0 Comentários)
0.0
davidthegreat007

Hi Employer, I am a professional programmer with a good grasp of c++ . Your project can be quite easily done within a day . I will have the job done as soon as I can . Relevant Skills and Experience I am well versed w Mais

$10 USD em 1 dia
(1 Comentário)
0.1
anissharma95

The Bid is negotiable. I working in late hours and i guarantee i will complete the project in time. Relevant Skills and Experience c++/c Proposed Milestones $20 USD - complete algorithm and code.

$20 USD em 1 dia
(0 Comentários)
0.0
$45 USD em 1 dia
(0 Comentários)
0.0
$50 USD em 1 dia
(1 Comentário)
0.0
AjcAqib

i can do it Relevant Skills and Experience c++ Proposed Milestones $25 USD - from...25 no thanks

$25 USD em 1 dia
(0 Comentários)
0.0
sashamelnivi

5 Relevant Skills and Experience Student

$10 USD em 1 dia
(0 Comentários)
0.0
Ayoubixx

A proposal has not yet been provided

$30 USD em 1 dia
(0 Comentários)
0.0
gudgudbadbad

Okay, your will be efficiently designed, i have the needed experience. Relevant Skills and Experience c++, c, java etc Proposed Milestones $10 USD - after completion of program Additional Services Offered $3 USD - I Mais

$10 USD em 1 dia
(0 Comentários)
0.0