Skip to content

Commit 0dd0992

Browse files
solved
1 parent beff1a1 commit 0dd0992

File tree

1 file changed

+15
-14
lines changed
  • csharp-fundamentals-primitive-types.Main

1 file changed

+15
-14
lines changed

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

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,52 @@ 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.Last();
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.14159;
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
51+
public string lowerAlphabet = alphabet.ToLower();
5152
// 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 = "";
53+
5354

5455
// 13. Create a public integer member named alphabetLength that contains the number of characters that exist in the alphabet member
5556
// Use the documentation linked above if you need help
56-
public int alphabetLength = 0;
57+
public int alphabetLength = alphabet.Count();
5758

5859
// 14. Create a public integer member named remainder that contains the remainder of dividing 15 by 8
59-
public int remainder = 0;
60+
public int remainder = 15%8;
6061
}
6162
}

0 commit comments

Comments
 (0)