ASSIGNMENT
ASSIGNMENT
Visual Programming
Submitted to:
Rida Bajwa
Submitted by
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace wordScrable
{
internal class Program
{
Task.Run(() =>
{
Task.Delay(5000).Wait();
a = 1;
});
}
public static async Task word()
{
int test = 0;
st:
string[] arr = { "apple", "banana", "cherry", "date", "elderberry",
"fig", "grape", "honeydew", "kiwi", "lemon" };
Random ra = new Random();
if (check == arr[n])
{
Console.WriteLine("Correct");
test += 10;
if (a == 1)
{
Console.WriteLine("You Enter late -5");
test -= 5;
}
else
{
Console.WriteLine("Wrong");
if (a == 1)
{
Console.WriteLine("You Enter late -5");
test -= 5;
word();
Console.ReadKey();
}
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace primeNumber
{
internal class Program
{
return true;
}
static void Main(string[] args)
{
Console.WriteLine("Enter Starting :");
int a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Ending :");
int b = Convert.ToInt32(Console.ReadLine());
ArrayList arr = new ArrayList();
Console.WriteLine($"Prime numbers from {a} to {b}:");
for (int i = a; i <= b; i++)
{
if (IsPrime(i))
{
arr.Add(i);
Console.Write(i + " ");
}
}
Console.WriteLine("\nif you want to filter even prime or odd prime Enter y");
string ch = Console.ReadLine();
if (ch == "y")
{
Console.WriteLine("Even or odd(e or o)");
string c = Console.ReadLine();
if (c == "e")
{
foreach(int i in arr)
{
if (i % 2 != 0)
{
}
Console.WriteLine("Do you want save in file(Enter y)");
string fi = Console.ReadLine();
if (fi == "y")
{
string filePath = "PrimeNumbers.txt";
using (StreamWriter writer = new StreamWriter(filePath))
{
writer.WriteLine("Prime numbers :");
foreach (int i in arr)
{
writer.Write(i + " ");
}
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace password
{
internal class Program
{
static void Main(string[] args)
{
At:
Console.WriteLine("Enter Password:");
string pass = Console.ReadLine();
char[] str = pass.ToArray();
bool alp = false;
bool sp = false;
bool num = false;
if (str.Length > 15)
{
Console.WriteLine("Password is too long");
}
else
{
if (str.Length >= 8)
{
foreach (var item in str)
{
if ((int)item >= 65)
{
alp = true;
break;
}
else
{
alp = false;
}
}
foreach (var item in str)
{
if ((int)item <= 64 && ((int)item < 48 || (int)item > 57))
{
sp = true;
break;
}
else
{
sp = false;
}
}
foreach (var item in str)
{
if ((int)item >= 48 && (int)item <= 57)
{
num = true;
break;
}
else
{
num = false;
}
}
}
else
{
Console.WriteLine("Password too short try again");
goto At;
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace randomGuess
{
internal class Program
{
static void Main(string[] args)
{
Console.Write("Enter Difficulty:");
string d = Console.ReadLine();
Random random = new Random();
int guess=0;
int num = random.Next(1, 101);
if (d == "hard")
{
guess = 5;
}
else if (d == "easy")
{
guess = 15;
}
else if (d == "medium")
{
guess = 10;
}
Console.WriteLine($"Your total guess are {guess}");
while(guess > 0)
{
Console.WriteLine($"Total guess remaining = {guess}");
Console.Write("Enter Your Guess :");
int g = Convert.ToInt32(Console.ReadLine());
if (g == num)
{
Console.WriteLine("Correct");
Console.WriteLine($"Your Score = {guess}");
break;
}
else if(g>num)
{
Console.WriteLine("Think lower");
}
else if(g<num)
{
Console.WriteLine("Think Higher");
}
guess--;
}
if (guess == 0)
{
Console.WriteLine("GameOver!");
}
}
}
}
using System;
using System.Collections;
using System.Collections.Generic;
namespace UniversityResourceManagement
{
// Course class to store course details
public class Course
{
public string CourseCode { get; set; }
public string CourseTitle { get; set; }
public int Credits { get; set; }
}
class Program
{
// ArrayList for storing courses
private static ArrayList Courses = new ArrayList();
// Faculty schedule
InitializeFacultySchedules();
DisplayFacultySchedules();
// Report summaries
DisplaySummary();
}
if (BorrowedBooks[student].Count < 3)
{
var bookTitle = LibraryBooks[bookID];
BorrowedBooks[student].Push(bookTitle);
LibraryBooks.Remove(bookID);
Console.WriteLine($"{student} borrowed '{bookTitle}'");
}
else
{
Console.WriteLine($"{student} cannot borrow more than 3 books.");
}
}
else
{
Console.WriteLine($"BookID {bookID} is not available in the library.");
}
}
// Faculty schedules
DisplayFacultySchedules();
}
}
}