PROG 8011 - Lab 5 - W24

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

PROG 8011 – Lab 5 07-03-24

Assignment Title: Exploring C# String Methods


Objective: The objective of this assignment is to deepen your understanding of C# string
methods and their practical applications. By completing this assignment, you will gain hands-on
experience in using various string manipulation techniques in C#.
Instructions:
1. Background Research: Start by researching and familiarizing yourself with the different
string methods available in C#. Pay attention to their syntax, parameters, and return
types. Make note of some common use cases for each method.
Sources:

 https://www.javatpoint.com/c-sharp-strings
2. Code Implementation: Write a C# program that demonstrates the use of at least five
different string methods. You can choose from methods such as Substring(), ToUpper()
etc. Create a new method for each example of using a string method.
3. Comments and Documentation: Provide comments throughout your code to explain
the purpose of each method call and any significant steps in your program. Additionally,
write a brief documentation explaining the functionality of each string method you have
used in your program.
4. Testing: Test your program with various input strings to ensure that it behaves as
expected in different scenarios. Document your test cases and their outcomes.
5. Submission: Submit your lab5.cs file as lab5.zip
Additional Notes:
 You are encouraged to experiment with additional string methods beyond the minimum
requirement.
 Collaborative work is not allowed.
 Plagiarism will not be tolerated. Ensure that all code and documentation are your own
work.
 This assignment is designed to be completed within a few hours.
 The deadline to submit is on d2l.
Category Scale Description

Code 1-60 5: Exemplary implementation of five or more different string methods with outstanding code
Implementation structure, clarity and is unique

4: Good implementation of five or more different string methods with commendable code
structure and clarity.

3: Adequate implementation of at least five different string methods with some issues in code
structure or clarity.

2: Partial implementation of the required string methods with significant issues in code structure
or clarity.

1: Failure to implement the required string methods with poor code structure and clarity.
Comments and 1-20 5: Comprehensive comments explaining each method call and significant steps, along with clear,
Documentation concise documentation and is unique.

4: Sufficient comments explaining most method calls and significant steps, with clear
documentation.

3: Some comments present but lacking clarity or completeness, with somewhat clear
documentation.

2: Few unclear comments or lack of comments, along with documentation lacking clarity.

1: Lack of comments and documentation, making understanding difficult.


Creativity and 1-10 5: Exceptional creativity and innovation in applying string methods, with unique and inventive
Innovation approaches.

4: Demonstrates creativity and innovation in applying string methods, with some unique
approaches or solutions.

3: Somewhat creative application of string methods but lacking significant innovation.

2: Conventional use of string methods without creativity or innovation.

1: Lack of creativity and innovation, with unimaginative use of string methods.


Code 1-10 5: Exceptionally well-formatted, easy-to-read code following consistent naming conventions.
Readability and
Style 4: Well-formatted, easy-to-read code with mostly consistent naming conventions.

3: Adequately formatted and readable code, though some inconsistencies in naming


conventions may be present.

2: Poorly formatted and difficult-to-read code with inconsistent naming conventions.

1: Very poorly formatted and extremely difficult-to-read code, with no adherence to naming
conventions.

Here I have a sample of my program.


using System;
/// <summary>
/// This class demonstrates string manipulation methods.
/// </summary>
/// <author>Author: Sir Sir</author>
class Program
{
/// <summary>
/// Main method. Entry point of the program, it calls two method.
/// </summary>
/// <param name="args">Command-line arguments.</param>
static void Main(string[] args)
{
// Call methods to manipulate the string
ConvertToUpperCase();
GetSubstring();
}

/// <summary>
/// Converts the input string to uppercase and outputs the result.
/// </summary>
static void ConvertToUpperCase()
{
// Input string
string inputString = "hello, world!";

// Convert the string to uppercase


string result = inputString.ToUpper();

// Output the result


Console.WriteLine("String Converted to Uppercase: " + result);
}

/// <summary>
/// Gets a substring from the input string and outputs the result.
/// </summary>
static void GetSubstring()
{
// Input string
string inputString = "hello, world!";

// Get a substring from the input string


string result = inputString.Substring(7, 5);

// Output the result


Console.WriteLine("Substring: " + result);
}
}