assignment 1
This commit is contained in:
parent
a4187d46f7
commit
aec3f2d884
BIN
Homework_Module_1.pdf
Normal file
BIN
Homework_Module_1.pdf
Normal file
Binary file not shown.
25
Module1-Assignments/Backup/homework.sln
Normal file
25
Module1-Assignments/Backup/homework.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32414.318
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Module1-Assignments", "Module1-Assignments\Module1-Assignments.csproj", "{A2853A5F-52A2-4E88-832E-6CB565865EB6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A2853A5F-52A2-4E88-832E-6CB565865EB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A2853A5F-52A2-4E88-832E-6CB565865EB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A2853A5F-52A2-4E88-832E-6CB565865EB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A2853A5F-52A2-4E88-832E-6CB565865EB6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {74061199-28D8-4A6A-BC40-F7F0BA2DE753}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>Module1_Assignments</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
124
Module1-Assignments/Module1-Assignments/Program.cs
Normal file
124
Module1-Assignments/Module1-Assignments/Program.cs
Normal file
@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Homework1
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Task1();
|
||||
Task2();
|
||||
Task3();
|
||||
Task4();
|
||||
Task5();
|
||||
Task6();
|
||||
Task7();
|
||||
Task8();
|
||||
|
||||
|
||||
}
|
||||
public static void Task1()
|
||||
{
|
||||
//Concatenating two strings (from user input) together
|
||||
Console.WriteLine("Please state your name as a full sentence");
|
||||
string myName = Console.ReadLine();
|
||||
Console.WriteLine("state your place of residence as a full sentence");
|
||||
string myResidence = Console.ReadLine();
|
||||
Console.WriteLine("Here is what you have stated: {0} " + "{1}", myName, myResidence);
|
||||
}
|
||||
public static void Task2()
|
||||
{
|
||||
//Determining whether a number is odd or even
|
||||
Console.WriteLine("Please select an integer of your choice.");
|
||||
int myInteger = int.Parse(Console.ReadLine());
|
||||
if (myInteger % 2 == 0)
|
||||
{
|
||||
Console.WriteLine("Your selected integer is an even number.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Your selected integer is an odd number.");
|
||||
}
|
||||
}
|
||||
public static void Task3()
|
||||
{
|
||||
//Displaying numbers provided via keyboard on screen with escape sequence \t
|
||||
Console.WriteLine("Please state a number between 1 and 50");
|
||||
int firstNumber = int.Parse(Console.ReadLine());
|
||||
Console.WriteLine("Select a second number in the same range");
|
||||
int secondNumber = int.Parse(Console.ReadLine());
|
||||
Console.WriteLine("Select a third in the same range");
|
||||
int thirdNumber = int.Parse(Console.ReadLine());
|
||||
Console.WriteLine("The numbers selected are: {0} \t{1} \t{2}", firstNumber, secondNumber, thirdNumber);
|
||||
}
|
||||
public static void Task4()
|
||||
{
|
||||
Console.WriteLine("My name is Bashir Nulusson. What is the initial of my first name?");
|
||||
string firstinitial = Console.ReadLine();
|
||||
Console.WriteLine(" {0}{1}{2}", firstinitial, firstinitial, firstinitial);
|
||||
Console.WriteLine(" {0} {1}", firstinitial, firstinitial);
|
||||
Console.WriteLine(" {0}{1}{2}", firstinitial, firstinitial, firstinitial);
|
||||
Console.WriteLine(" {0} {1}", firstinitial, firstinitial);
|
||||
Console.WriteLine(" {0}{1}{2}", firstinitial, firstinitial, firstinitial);
|
||||
Console.WriteLine("What is the initial of my second name?");
|
||||
string secondinitial = Console.ReadLine();
|
||||
Console.WriteLine(" {0} {1}", secondinitial, secondinitial);
|
||||
Console.WriteLine(" {0}{1} {2}", secondinitial, secondinitial, secondinitial);
|
||||
Console.WriteLine(" {0} {1} {2}", secondinitial, secondinitial, secondinitial);
|
||||
Console.WriteLine(" {0} {1}{2}", secondinitial, secondinitial, secondinitial);
|
||||
Console.WriteLine(" {0} {1}", secondinitial, secondinitial);
|
||||
}
|
||||
public static void Task5()
|
||||
{
|
||||
//Adding, substracting, dividing, multiplying, and calculating the remainder
|
||||
Console.WriteLine("Please select an integer");
|
||||
int x = int.Parse(Console.ReadLine());
|
||||
Console.WriteLine("Select a second integer");
|
||||
int y = int.Parse(Console.ReadLine());
|
||||
Console.WriteLine("The sum of {0} and {1} is {2}", x, y, x + y);
|
||||
Console.WriteLine("The difference between {0} and {1} is {2}", x, y, x - y);
|
||||
Console.WriteLine("The product of {0} and {1} is {2}", x, y, x * y);
|
||||
Console.WriteLine("{0} divided by {1} is {2}", x, y, x / y);
|
||||
Console.WriteLine("The reminder after dividing {0} by {1} is {2}", x, y, x % y);
|
||||
}
|
||||
public static void Task6()
|
||||
{
|
||||
//Calculating the diameter, circumference and area of a circle,given the radius
|
||||
double diameterOfcircle = 0, circumferenceOfcircle = 0, areaOfcircle = 0;
|
||||
Console.WriteLine("State a radius of a circle");
|
||||
double circleRadius = double.Parse(Console.ReadLine());
|
||||
diameterOfcircle = 2 * circleRadius;
|
||||
circumferenceOfcircle = 2 * (Math.PI) * circleRadius;
|
||||
areaOfcircle = (Math.PI) * circleRadius * circleRadius;
|
||||
Console.WriteLine("Based on the stated radius, the diameter is {0}, the circumference is {1} and the area is {2}", diameterOfcircle, circumferenceOfcircle, areaOfcircle);
|
||||
}
|
||||
public static void Task7()
|
||||
{
|
||||
//Displaying digits separated from each other by a tab.
|
||||
int lastDigit = 0, thirdDigit = 0, secondDigit = 0, firstDigit = 0, remainder1 = 0, remainder2 = 0;
|
||||
Console.WriteLine("Write a four-digit integer");
|
||||
int theNumber = int.Parse(Console.ReadLine());
|
||||
lastDigit = theNumber % 10;
|
||||
remainder1 = theNumber / 10;
|
||||
thirdDigit = remainder1 % 10;
|
||||
remainder2 = remainder1 / 10;
|
||||
secondDigit = remainder2 % 10;
|
||||
firstDigit = theNumber / 1000;
|
||||
Console.WriteLine("{0} \t{1} \t{2} \t{3}", firstDigit, secondDigit, thirdDigit, lastDigit);
|
||||
}
|
||||
public static void Task8()
|
||||
{
|
||||
//The square and cube of an integer read from the keyboard
|
||||
int squareOfnumber = 0, cubeOfnumber = 0;
|
||||
Console.WriteLine("Please select an integer of choice");
|
||||
int selectedInt = int.Parse(Console.ReadLine());
|
||||
squareOfnumber = (int)Math.Pow(selectedInt, 2);
|
||||
cubeOfnumber = (int)Math.Pow(selectedInt, 3);
|
||||
Console.WriteLine("number \tsquare \tcube" + "\n{0} \t{1} \t{2}", selectedInt, squareOfnumber, cubeOfnumber);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
|
@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Module1-Assignments")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Module1-Assignments")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Module1-Assignments")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
@ -0,0 +1 @@
|
||||
25f604f2d2ecf5bca274e97a436debd97063e132
|
@ -0,0 +1,10 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net6.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = Module1_Assignments
|
||||
build_property.ProjectDir = D:\Git\Bashir C-sharp assignments\homework\Module1-Assignments\
|
@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,62 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"D:\\Git\\Bashir C-sharp assignments\\homework\\Module1-Assignments\\Module1-Assignments.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"D:\\Git\\Bashir C-sharp assignments\\homework\\Module1-Assignments\\Module1-Assignments.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "D:\\Git\\Bashir C-sharp assignments\\homework\\Module1-Assignments\\Module1-Assignments.csproj",
|
||||
"projectName": "Module1-Assignments",
|
||||
"projectPath": "D:\\Git\\Bashir C-sharp assignments\\homework\\Module1-Assignments\\Module1-Assignments.csproj",
|
||||
"packagesPath": "C:\\Users\\phils\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\Git\\Bashir C-sharp assignments\\homework\\Module1-Assignments\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\phils\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net6.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net6.0": {
|
||||
"targetAlias": "net6.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net6.0": {
|
||||
"targetAlias": "net6.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.202\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\phils\.nuget\packages\</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.1.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\phils\.nuget\packages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
@ -0,0 +1,67 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
"net6.0": {}
|
||||
},
|
||||
"libraries": {},
|
||||
"projectFileDependencyGroups": {
|
||||
"net6.0": []
|
||||
},
|
||||
"packageFolders": {
|
||||
"C:\\Users\\phils\\.nuget\\packages\\": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "D:\\Git\\Bashir C-sharp assignments\\homework\\Module1-Assignments\\Module1-Assignments.csproj",
|
||||
"projectName": "Module1-Assignments",
|
||||
"projectPath": "D:\\Git\\Bashir C-sharp assignments\\homework\\Module1-Assignments\\Module1-Assignments.csproj",
|
||||
"packagesPath": "C:\\Users\\phils\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\Git\\Bashir C-sharp assignments\\homework\\Module1-Assignments\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\phils\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net6.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net6.0": {
|
||||
"targetAlias": "net6.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net6.0": {
|
||||
"targetAlias": "net6.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.202\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "MOQEcsHgyU5tTy3Jgsaqyv8Gzk4tJHtiPtnbac3UIAMBiUyOsdnX2cyfE9w5cBmb7Sqnm83lSk9rPRtRuNKhMA==",
|
||||
"success": true,
|
||||
"projectFilePath": "D:\\Git\\Bashir C-sharp assignments\\homework\\Module1-Assignments\\Module1-Assignments.csproj",
|
||||
"expectedPackageFiles": [],
|
||||
"logs": []
|
||||
}
|
BIN
Module1-Assignments/UpgradeLog.htm
Normal file
BIN
Module1-Assignments/UpgradeLog.htm
Normal file
Binary file not shown.
25
Module1-Assignments/homework.sln
Normal file
25
Module1-Assignments/homework.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29709.97
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Module1-Assignments", "Module1-Assignments\Module1-Assignments.csproj", "{A2853A5F-52A2-4E88-832E-6CB565865EB6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A2853A5F-52A2-4E88-832E-6CB565865EB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A2853A5F-52A2-4E88-832E-6CB565865EB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A2853A5F-52A2-4E88-832E-6CB565865EB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A2853A5F-52A2-4E88-832E-6CB565865EB6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {74061199-28D8-4A6A-BC40-F7F0BA2DE753}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Loading…
x
Reference in New Issue
Block a user