Question: CPS 180 Programming Assignment #5 Assigned: 05/31/17 Due: 06/07/17 Points: 40 Purpose: Use math functions, string manipulation and input/output to create an alternative to Twitter

CPS 180 Programming Assignment #5

Assigned: 05/31/17 Due: 06/07/17 Points: 40

Purpose: Use math functions, string manipulation and input/output to create an alternative to Twitter called Chipper.

Requirements:

Ask the user for 3 messages to send using the following characteristics:

Generate a random number to ask the user for a # of chars for the message. The random number should be between 1 and 50. Use Math.random to generate 3 numbers: rand1, rand2, rand3

Have the user type the strings into 3 separate variables

Find the length of the string and report if the string is too long, then truncate it and reassign it to the string

String variables: Keep track of all three messages in msg1, msg2, msg3 strings. Also combine (concatenate) all 3 messages into 1 string called msgAll

int variables: Keep track of the lengths of all three messages (after truncating) in msg1Length, msg2Length, msg3Length

Counters:

Count and report the total # of characters in msgAll.

Count and report the number of vowels in msgAll (this will require a loop).

Count and report the number of spaces in msgAll (this will require a loop).

Display msgAll backwards (this will require a loop).

Display msgAll Vertically (one char per line).

Sample Output (user input in bold): Note: The output is incomplete, just use as a reference.

Message #1: Enter a message with 18 chars or less:

This is a message to you!

Oops! Your message has more than 18 characters! It has been truncated to:

This is a message

Message #2: Enter a message with 40 chars or less:

. Message .

Message #3: Enter a message with 28 chars or less:

. Message .

Here is message 1: Message

Here is message 2: Message

Here is message 3: Message

Here are your three messages combined:

This is a message Message Message

Here are your messages in all uppercase:

THIS IS A MESSAGE MESSAGE MESSAGE

Here are your messages in all lowercase:

this is a message message message

The count of characters in all of your messages: 99

The number of vowels in all of your messages: 10

The number of spaces in all of your messages: 8

Here is your message backwards: xxxxxya aaks ss kdkl3

Here is your message vertical:

T

H

I

S

I

S

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!