Example output test int test string str
Note: Your program will not compile until you complete the Circle (Tests 2-5) and TextCodec (Tests 7 & 8) classes
Test 1 - Acronym
Example Output
PYMTLTest 2 – Define a new class
For example:
public class Circle
}
1
COP1000(PG1)- | ![]() |
![]() |
||
---|---|---|---|---|
- |
• the x position of the Circle
• the y position of the Circle
• the radius of the Circle
You can name the fields using any name you want, though you could use the following: •
float mX; • float mY;
• float mRadius;The prefix 'm' stands for member variable.
public float GetX()
public float GetY()
return c1;
Example Input
1, 1, 4public float GetArea()
For this Test, when you have finished adding the above requested information to your Circle class, you will then make an instance object of type Circle, calling its overloaded constructor passing the variables given to you in this Test, and then you will return your class instance object from this Test.
For example:
Circle c1 = new Circle(x, y, radius);
object Test4(float x, float y, float radius)
Add the following method to your Circle class, which given another point's x and y coordinates, this method returns whether or not that point is within the bounds of the Circle or not.
Circle c1 = new Circle(x, y, radius);
return c1;
Add the following method to your Circle class, which computes the circumference of a circle:
public float GetCircumference()
COP1000(PG1)- |
|
![]() |
![]() |
|
---|---|---|---|---|
- |
For example:
Test 6
int Test6(string str1, string str2, bool ignoreCase)
If you are curious as to the output of the String.Compare() method, it returns 0 when the 2 strings it is comparing are considered equal, it returns +1 when the first string comes after the second string in an alphabetic sort (using the ASCII table), and it returns ---1 when the first string comes before the second string in an alphabetic sort. The MSDN docs have more information.
Example Input
Beemo, beemo, TrueTo create your TextCodec class, you will add the following access modifier, fields, constructor and methods.
4
COP1000(PG1)- | ![]() |
![]() |
||
---|---|---|---|---|
- |
public class TextCodec
{
Your TextCodec class must have 1 member variable (field), which is: •an sbyte, which holds a numeric offset
You can name the field any name you want.Your TextCodec class must have an overloaded constructor, which takes the offset variable, that will be assigned to the field of the class:
for (int i = 0; i < message.Length; i++)
{
For this Test, when you have finished adding the above requested information to your TextCodec class, you will then make an instance object of type TextCodec, calling its overloaded constructor passing the offset variable given to you in this Test, and then you will call the Encode() method passing the message variable given to you in this Test, and return the result of the Encode() method.
For example: TextCodec codec = new TextCodec(offset);
public string Decode(string message)
The purpose of the Encode() method is take the message passed into the method and decode it back to a readable string using the offset field stored in the class. The decoding code works nearly exactly the same as the encoding code, except you will subtract the offset from each character in the StringBuilder, instead of adding it.
Example Input
-3, ">↔︎tfkkbo↔︎fp↔︎vlr+"Example Output
"A winner is you."