Solved-Project 01- Solution

$35.00 $24.00

1. Problem Statement Create an original version of the ​string​class named ​myString​. Each instance of ​myString​will be able to handle 25 characters and each method will need to contain a reference “status variable”. 2. Requirements 2.1 Assumptions Default ​string​class may be used for screen input Default ​string​class may be used for ​setString​method User will not…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

1. Problem Statement

Create an original version of the stringclass named myString. Each instance of myStringwill be able to handle 25 characters and each method will need to contain a reference “status variable”.

2. Requirements

2.1 Assumptions

  • Default stringclass may be used for screen input

  • Default stringclass may be used for setStringmethod

  • User will not input strings that include spaces

2.2 Specifications

  • Functions to replicate

    • size()

    • addStart()

    • addEnd()

    • partString()

    • replPartString()

    • replWholeString()

    • compareString()

    • initString()

    • setString()

    • getString()

    • printStringScreen()

    • numericString()

    • alphabeticString()

  • Program will test each function systematically

    • Some results will be shown to the user

    • Some results will be printed to a file

    • May allow for methods to be tested out of order/individually

  1. Decomposition Diagram

    • myStringClass Program

      • Input

        • User inputs string under 25 characters

        • User inputs via command line

      • Process

        • Count the number of characters in a string

        • Iterate character array to append beginning

        • Iterate through array to append to end

        • Replace part of array from given position

        • Replace entire array of characters

        • Compare given array with saved array

        • Initialize/Wipe string to null

        • Insert string into myString

        • Determine if string is integer or real number

        • Determine if string is alphabetic exclusively

      • Output

        • Iterate and return portion of string from any start point

        • Return and print current array of characters

  1. Test Strategy

    • Valid Data

    • Invalid Data

  1. Test Plan Version 1

Test Strategy

#

Description

Input

Expected Output

Actual Output

Pass/Fail

Valid Data

1

size()

Valid Data

2

addStart()

Valid Data

3

addEnd()

Valid Data

4

partString()

Valid Data

5

replPartString()

Valid Data

6

compareString()

Valid Data

7

initString()

Valid Data

8

setString()

Valid Data

9

getString()

Valid Data

10

printStringScreen()

Valid Data

11

numericString()

Valid Data

12

alphabeticString()

Invalid Data

1

addStart()

Invalid Data

2

addEnd()

Invalid Data

3

partString()

Invalid Data

4

replPartString()

Invalid Data

5

replWholeString()

Invalid Data

6

compareString()

Invalid Data

7

setString()

Invalid Data

8

getString()

Invalid Data

9

printStringScreen()

  1. Initial Algorithm

    1. Create Class myString

      1. Create Function size()

        1. Return number of characters in string

        1. Count all non-null characters and add to total

      1. Create Function addStart(myString)

        1. Add input to beginning of string

        1. Move current characters forward and insert

      1. Create Function addEnd(myString)

        1. Append string with input

        1. Insert characters to end up to 25

      1. Create Function partString(startPos, length)

        1. Return portion of string from inputted index

        1. Take in index integer and iterate from there

      1. Create Function replPartString(myString, startPos)

        1. Replace portion of string from inputted index

        1. Take in index of string and replace

      1. Create Function replWholeString(myString)

        1. Replace entire string with user input

        1. Wipe string and insert characters

      1. Create Function compareString(myString)

        1. Compare current string to user input

        1. Iterate both and check each index

      1. Create Function initString()

        1. Wipe/Initialize string to null

        1. Iterate and clear each index

      1. Create Function setString(string)

        1. Set string to current input

        1. Iterate and fill each index with corresponding index

      1. Create Function getString()

        1. Return current string

        1. Iterate and return each index into string

      1. Create Function printStringScreen()

        1. Print current string to screen

        1. Iterate and print each index

      1. Create Function numericString()

        1. Determine if string is integer or real number

        1. Iterate and check for numeric or real number characters in correct order

      1. Create Function alphabeticString()

        1. Determine if string is all alphabetic

        1. Iterate and check for alpha characters

    1. Create Function outputFile()

      1. Will print results of each function in class myStringto file

    1. MAIN FUNCTION

      1. Test each function of class myString

      1. Print results of each function to file with outputFile().

  1. Test Plan Version 2

Test Strategy

#

Description

Input

Expected Output

Actual Output

Pass/Fail

Valid Data

1

size()

string”

6

Valid Data

2

addStart()

my“

mystring”

Valid Data

3

addEnd()

s”

mystrings”

Valid Data

4

partString()

0, 5

mystr”

Valid Data

5

replPartString()

3, “Test”

myTest”

Valid Data

6

compareString()

mystring” “test”

FALSE

Valid Data

7

initString()

null

null string

Valid Data

8

setString()

mystr” string

mystr” myString

Valid Data

9

getString()

mystr” myString

mystr” string

Valid Data

10

printStringScreen()

mystr”

mystr” Print

Valid Data

11

numericString()

6.502”

TRUE

Valid Data

12

alphabeticString()

abc”

TRUE

Invalid Data

1

addStart()

abcd…z”

overflow

Invalid Data

2

addEnd()

zyxw…a”

overflow

Invalid Data

3

partString()

-1, 5”

Invalid Index

Invalid Data

4

replPartString()

my“, -1

Invalid Index

Invalid Data

5

replWholeString()

abc…z”

overflow

Invalid Data

6

compareString()

“”

null

Invalid Data

7

setString()

“”

null

Invalid Data

8

getString()

“”

null – empty

Invalid Data

9

printStringScreen()

“”

null – empty

12. Error Log

Error Type (Logic/Runtime)

Cause of Error

Solution to Error

Logic

Casting charArray to double

None at the moment.

within numericString() give

correct answer every time

except with input = 0

13. Status

Program is working.