Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

John Ferdie Abueg #81

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions csharp-fundamentals-primitive-types.Main/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,51 @@ public Core() { }
public static int numThree = 32;

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

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

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

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

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

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

// 7. Create a public char member named lastLetter containing the last letter of the English alphabet
public char lastLetter = ' ';
public char lastLetter = alphabet.Last();

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

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

public static string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public static string firstName = "Jane";
public static string lastName = "Smith";

// 10. Create a public member named fullName that contains the value of firstName and lastName concatenated together with a space in between
public string fullName = "";
public string fullName = $"{firstName} {lastName}";

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

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

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

// 14. Create a public integer member named remainder that contains the remainder of dividing 15 by 8
public int remainder = 0;
public int remainder = 15 % 8;
}
}
Loading