Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago

Question

Know how productivity improvements impact quality and value.

Answered: 1 week ago