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

Answered the questions #69

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions csharp-fundamentals-primitive-types.Main/Book.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace csharp_fundamentals_primitive_types
{
internal class Book
{
public String title = "A Game of Thrones";
public int publishYear = 1996;
public float price = 11.99f;
public String isbn = "0-00-224584-1";
public String author = "George R. R. Martin";
}
}
25 changes: 25 additions & 0 deletions csharp-fundamentals-primitive-types.Main/Car.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace csharp_fundamentals_primitive_types
{
internal class Car
{
public string make {get; set;}
public string model {get; set;}
public string transmission_type {get; set;}
public int number_of_doors { get; set; }

public int number_of_litres { get; set; }

public string engine_type {get; set;}

public string color {get; set;}

public bool registered {get; set;}

}
}
25 changes: 25 additions & 0 deletions csharp-fundamentals-primitive-types.Main/Computer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace csharp_fundamentals_primitive_types
{
internal class Computer
{

public string type_of_pc { get; set; }

public string brand { get; set; }

public int disk_capacity { get; set; }

public string gpu_type { get; set; }

public string cpu_type { get; set; }

public int number_of_usb_ports { get; set; }

}
}
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 = 24;

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

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

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

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

// 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 = 7;

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

// 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.14159;

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 = "Jane Smith";

// 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;
}
}
25 changes: 25 additions & 0 deletions csharp-fundamentals-primitive-types.Main/E_commerce_order.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace csharp_fundamentals_primitive_types
{
internal class E_commerce_order
{

public int orderId { get; set; }

public string orderName { get; set; }

Check warning on line 14 in csharp-fundamentals-primitive-types.Main/E_commerce_order.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'orderName' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public int quantity { get; set; }

public decimal full_price { get; set; }

public DateTime date { get; set; }

public string status { get; set; }

Check warning on line 22 in csharp-fundamentals-primitive-types.Main/E_commerce_order.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'status' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

}
}
23 changes: 23 additions & 0 deletions csharp-fundamentals-primitive-types.Main/E_commerce_product.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace csharp_fundamentals_primitive_types
{
internal class E_commerce_product
{
public int product_id { get; set; }

public string product_name { get; set; }

Check warning on line 13 in csharp-fundamentals-primitive-types.Main/E_commerce_product.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'product_name' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public string product_description { get; set; }

Check warning on line 15 in csharp-fundamentals-primitive-types.Main/E_commerce_product.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'product_description' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public decimal product_price { get; set; }

public bool is_in_storage { get; set; }


}
}
30 changes: 30 additions & 0 deletions csharp-fundamentals-primitive-types.Main/Movie.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace csharp_fundamentals_primitive_types
{
internal class Movie
{

public string movie_name { get; set; }

Check warning on line 12 in csharp-fundamentals-primitive-types.Main/Movie.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'movie_name' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public string movie_description { get; set; }

Check warning on line 14 in csharp-fundamentals-primitive-types.Main/Movie.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'movie_description' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public int year_of_release { get; set; }

public int duration_in_seconds { get; set; }

public float price { get; set; }

public float imdb_rating { get; set; }






}
}
26 changes: 26 additions & 0 deletions csharp-fundamentals-primitive-types.Main/User.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace csharp_fundamentals_primitive_types
{
internal class User
{
public string user_name { get; set; }

Check warning on line 11 in csharp-fundamentals-primitive-types.Main/User.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'user_name' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.


public string password { get; set; }

Check warning on line 14 in csharp-fundamentals-primitive-types.Main/User.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'password' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public int phone_number { get; set; }

public string email { get; set; }

Check warning on line 18 in csharp-fundamentals-primitive-types.Main/User.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'email' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public string address { get; set; }

Check warning on line 20 in csharp-fundamentals-primitive-types.Main/User.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'address' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public bool uses_two_factor_authentication { get; set; }

public char membership_type { get; set; }
}
}
Loading