Assignment Purpose: The purpose of this lab assignment is to demonstrate knowledge of functions and strings This assignment is going to have you breaking up strings into substrings. The main logic...


Assignment Purpose:
The purpose of this lab assignment is to demonstrate knowledge of functions and
strings
This assignment is going to have you breaking up strings into substrings. The main logic will have us input a
person's first middle and last name separated by only a single space. You will be responsible for designing the
logic and writing the functions necessary for breaking up the name. Below you will find the function names and
the description of what they are to do.
1. Function findFirstOccurance - this function needs to accept 2 strings by parameter, the first is a
character to search for and the second a string to search for the character in. The function is to return
an integer value that represents the location of the first occurance of the character in the message. If it
does not find the character it should return a -1
2. Function findLastOccurance - this function sets up the same way as findFirstOccurance but will search
for the last occurance of the character in the message. It will reutrn the index of the character or a -1 if
the character does not exist.
3. You will need to make 3 other functions that all perform similar action. Functions getFirstName,
getLastName, and getMiddleName. Each funciton will accept a string as a parameter that will
represent the full name of a person. getFirstName will return a string of the first name, getLastName
will return the last name, and getMiddle will return the middle name
4. Main module will have us input a person's full name and verify that it contains a minimum of 2 spaces.
It will then display the person's first middle and last name appropriately. You will find the pseudocode
for the main method below.
For Submission
1. Pseduocode for findFirstOccurance that includes a looping activity
2. Flowchart for findLastOccurance that includes a looping activity
3. A python program that has all the supporting funcitons listed above and executes the mainline logic
pseudocoded below.
You will also find some sample output below for you to reference.
Module main():
Declarations
Str fullName
Str firstName
Str middleName
Str lastName
#input
Input fullname
#processing
While findFirstOccurance( “ “, fullName) == findLastOccurance(“ “, fullName):
Display error message
Input fullName
set firstName
set middleName
set lastName
#output
print firstName
print middleName
print lastName
return


Ouput with valid input<br>Enter your first middle and last name: Brandon John Brzuszkiewicz<br>First:<br>Brandon<br>Middle:<br>John<br>Brzuszkiewicz<br>Last:<br>Output with invalid input<br>Enter your first middle and last name: Brandon Brzuszkiewicz<br>Enter your first middle and last name: Brandon<br>Enter your first middle and last name: Brandon John Brzuszkiewcz<br>First:<br>Brandon<br>Middle:<br>John<br>Brzuszkiewcz<br>Last:<br>

Extracted text: Ouput with valid input Enter your first middle and last name: Brandon John Brzuszkiewicz First: Brandon Middle: John Brzuszkiewicz Last: Output with invalid input Enter your first middle and last name: Brandon Brzuszkiewicz Enter your first middle and last name: Brandon Enter your first middle and last name: Brandon John Brzuszkiewcz First: Brandon Middle: John Brzuszkiewcz Last:
Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here