Skip to content

Commit 935a9aa

Browse files
committed
finished exercise
1 parent beff1a1 commit 935a9aa

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

.github/workflows/standard-criteria-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup .NET
1515
uses: actions/setup-dotnet@v1
1616
with:
17-
dotnet-version: '8.0.x'
17+
dotnet-version: '9.0.x'
1818
# 3) Restore the dependencies and tools of a project or solution.
1919
- name: Install dependencies
2020
run: dotnet restore

csharp-fundamentals-primitive-types.Main/Core.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,51 @@ public Core() { }
1111
public static int numThree = 32;
1212

1313
// 1. Change the value of the member below to be the result of adding numOne and numTwo together
14-
public int numOnePlusTwo = 0;
14+
public int numOnePlusTwo = numOne + numTwo;
1515

1616
// 2. Change the value of the member below to be the result of multiplying numThree by numTwo
17-
public int numThreeTimesNumTwo = 0;
17+
public int numThreeTimesNumTwo = numThree * numTwo;
1818

1919
// 3. Change the value of the member below to be the result of dividing numThree by numOne
20-
public int numThreeDividedByNumOne = 0;
20+
public int numThreeDividedByNumOne = numThree/numOne;
2121

2222
// 4. Change the value of the member below to be the result of subtracting numOne from numThree
23-
public int numThreeMinusNumOne = 0;
23+
public int numThreeMinusNumOne = numThree - numOne;
2424

2525
// 5. Change the value of the member below to be the sum of numOne, numTwo and numThree
26-
public int sum = 0;
26+
public int sum = numOne + numTwo + numThree;
2727

2828
// 6. Change the value of the member below to be the sum of numOne, numTwo and numThree divided by numOne
29-
public int numBytes = 0;
29+
public int numBytes = (numOne + numTwo + numThree )/ numOne;
3030

3131
// 7. Create a public char member named lastLetter containing the last letter of the English alphabet
32-
public char lastLetter = ' ';
32+
public char lastLetter = alphabet[^1];
3333

3434
// 8. Create a public float member named pi that contains the value of pi to two decimal places
35-
public float pi = 0f;
35+
public float pi = 3.14f;
3636

3737
// 9. Create a public double member named piD that contains the value of pi to 5 decimal places
38-
public double piD = 0;
38+
public double piD = 3.14159d;
3939

4040
public static string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
4141
public static string firstName = "Jane";
4242
public static string lastName = "Smith";
4343

4444
// 10. Create a public member named fullName that contains the value of firstName and lastName concatenated together with a space in between
45-
public string fullName = "";
45+
public string fullName = firstName + " " + lastName;
4646

4747
// 11. Fix the line below so that tenthLetter contains the tenth letter in the alphabet member above.
48-
public char tenthLetter = alphabet.ToCharArray().ElementAtOrDefault(0);
48+
public char tenthLetter = alphabet.ToCharArray().ElementAtOrDefault(9);
4949

5050
// 12. Create a public string member named lowerAlphabet that contains the value of the alphabet member in all lower case characters
5151
// If you need help, look through the available String methods to find a relevant one here: https://www.w3schools.com/cs/cs_strings.php
52-
public string lowerAlphabet = "";
52+
public string lowerAlphabet = alphabet.ToLower();
5353

5454
// 13. Create a public integer member named alphabetLength that contains the number of characters that exist in the alphabet member
5555
// Use the documentation linked above if you need help
56-
public int alphabetLength = 0;
56+
public int alphabetLength = alphabet.Length;
5757

5858
// 14. Create a public integer member named remainder that contains the remainder of dividing 15 by 8
59-
public int remainder = 0;
59+
public int remainder = 15 % 8;
6060
}
6161
}

0 commit comments

Comments
 (0)