Professional Documents
Culture Documents
CLASS ID # 102256
STUDENT ID # 10575
CODING:
Console.Write("Enter Amount = ");
int amount = Convert.ToInt32(Console.ReadLine());
double crntBlnc = 100000;
const int dailyLimit = 25000;
if (amount > crntBlnc)
{
Console.WriteLine("Current Blance Is Low ");
}
else if (amount > dailyLimit)
{
Console.WriteLine("Amount You Entered is Exceded From Daily Limit" );
}
else if (crntBlnc < 5000)
{
double charge = amount * 0.02;
crntBlnc -= amount + charge;
Console.WriteLine("Current Blance1 = " + crntBlnc);
}
else if (crntBlnc >= 5000)
{
crntBlnc -= amount;
Console.WriteLine("Current Blance2 = " + crntBlnc);
}
Console.ReadLine();
CMD SCREENSHOT:
CODING:
Console.Write("Enter a Whole Number = ");
int num = Convert.ToInt32(Console.ReadLine());
Console.Write("01 Digit");
}
else if (num >= 10 && num < 100)
{
Console.Write("02 Digits");
}
Console.Write("04 Digits");
}
else if (num >= 10000 && num < 100000)
{
Console.Write("05 Digits");
}
else if (num >= 100000 && num < 1000000)
{
Console.Write("06 Digits");
}
else
{
Console.Write("Unable To Count Digits");
}
Console.WriteLine("," + num);
Console.ReadLine();
CMD SCREENSHOT:
PROBLEM NO#03: The current year and the year in which the employee
joined the organization are entered through the keyboard. If the number of
years for which the employee has served the organization is greater than 3
then a bonus of Rs. 2500/- is given to the employee. If the years of service
are not greater than 3, then the program should do nothing.
CODING:
Console.Write("Enter Current Year = ");
int curntYear = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter Joined Year = ");
int joinYear = Convert.ToInt32(Console.ReadLine());
int result = curntYear - joinYear;
Console.WriteLine("Total Years of Employment = " + result);
int Bonus;
if(result>=3){
Bonus = 2500;
Console.WriteLine("Employee Total Bonus On Salary = " + Bonus);
}
else{
Console.WriteLine("Employee Total Bonus On Salary = " + 0 );
}
Console.ReadLine();
CMD SCREENSHOT:
developer is married.
28 years of age.
In all other cases, the software developer is not insured. If marital Status,
gender and age of the software developer are user-defined, write a program
to determine whether the software developer is to be insured or not.
CODING:
Console.WriteLine(" Note: PLEASE ENTER FIRST WORD IN CAPITAL ");
Console.Write("Enter Marital Status = ");
string s = Console.ReadLine();
if (s == "Married")
{
Console.WriteLine("Ensured");
}
else
{
Console.Write("Enter Gender = ");
string g = Console.ReadLine();
Console.Write("Enter Age = ");
int a = Convert.ToInt32(Console.ReadLine());
if (s == "Unmarried" && g == "Male" && a >= 28)
{
Console.WriteLine("Ensured");
}
else if (s == "Unmarried" && g == "Female" && a >= 22)
{
Console.WriteLine("Ensured");
}
else
{
Console.WriteLine("Not Ensured");
}
}
Console.ReadLine();
CMD SCREENSHOT:
PROBLEM NO#05: Any year is input through the keyboard. Write a program
to determine whether the year is a leap year or not
CODING:
Console.Write("Enter Year = ");
int year = Convert.ToInt32(Console.ReadLine());
if ((year % 4) == 0)
{
CMD SCREENSHOT:
PROBLEM NO#06: Write a program to check whether a triangle is valid or
not, when the three angles of the triangle are entered through the
keyboard. A triangle is valid if the sum of all the three angles is equal to 180
degrees.
CODING:
Console.Write("Enter 1st Side Angle Of Triangle = ");
int a1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter 2nd Side Angle Of Triangle = ");
int a2 = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter 3rd Side Angle Of Triangle = ");
int a3 = Convert.ToInt32(Console.ReadLine());
int sum = a1 + a2+ a3;
Console.Write("Sum Of All Three Sides OF Triangle = " + sum + " And ");
if (sum == 180)
{
Console.WriteLine("Triangle Is Valid");
}
else
{
Console.WriteLine("Triangle Is Not InValid");
}
Console.ReadLine();
CMD SCREENSHOT:
PROBLEM NO#07: A library charges a fine for every book returned late. For
first 5 days the fine is 50 Rs, for 6-10 days fine is 100 rupee and above 10
days fine is 150 rupees. If you return the book after 30 days your
membership will be cancelled. Write a program to accept the number of
days the member is late to return the book and display the fine or the
appropriate message.
CODING:
Console.Write("Enter The Number Of Days The Book Is Late = ");
int day = Convert.ToInt32(Console.ReadLine());
if (day == 0)
{
Console.WriteLine("No Fine");
}
else if (day <= 5)
{
Console.WriteLine("Fine = Rs 50");
}
else if (day <= 10)
{
Console.WriteLine("Fine = Rs 100");
}
else if (day <= 30)
{
Console.WriteLine("Fine = Rs 150");
}
else if (day > 30)
{
Console.WriteLine("Membership Cancelled");
}
Console.ReadLine();
CMD SCREENSHOT:
CODING:
Console.Write("Enter Employee Salary = ");
int salary = Convert.ToInt32(Console.ReadLine());
if (salary < 15000)
{
double rentalAllowance = Convert.ToDouble(salary * 0.1);
String RentalAllowance = "Rental Allowance = " + rentalAllowance;
double dinningAllowance = Convert.ToDouble(salary * 0.09);
String DinningAllowance = "Dinning Allowance = " + dinningAllowance;
String grossSalary = "Gross Salary = " + (salary + rentalAllowance +
dinningAllowance);
Console.WriteLine(RentalAllowance);
Console.WriteLine(DinningAllowance);
Console.WriteLine(grossSalary);
}
else if (salary >= 15000 && salary < 20000)
{
Console.Write("RentalAllowance = ");
const int rentalAllowance = 500;
double dinningAllowance = Convert.ToDouble(salary * 0.98);
String DinningAllowance = "Dinning Allowance = " + dinningAllowance;
String grossSalary = "Gross Salary = " + (salary + rentalAllowance +
dinningAllowance);
Console.WriteLine(rentalAllowance);
Console.WriteLine(DinningAllowance);
Console.WriteLine(grossSalary);
}
else
{
Console.WriteLine("Incorrect Salary");
}
Console.ReadLine();
CMD SCREENSHOT:
PROBLEM NO#09: Write a program that asks user to enter a number, your
program, then tells that number entered is one of these: positive even,
positive odd, negative even, negative odd or it’s a zero.
CODING:
Console.Write(" Enter Number = ");
int num = Convert.ToInt32(Console.ReadLine());
int num1 = num % 2;
if (num1 == 0 && num > 0)
{
Console.WriteLine("The Number is Positive Even. ");
}
else if (num1 != 0 && num > 0)
{
Console.WriteLine("The Number is Positive Odd. ");
}
else if (num1 == 0 && num < 0)
{
Console.WriteLine("The Number is Negative Even. ");
}
else if (num1 != 0 && num < 0)
{
Console.WriteLine("The Number is Negative Odd. ");
}
else
{
Console.WriteLine("The Number is Zero. ");
}
Console.ReadLine();
CMD SCREENSHOT:
PROBLEM NO#10: If the ages of Alpha, Bravo and Charlie are taken as input
from user, write a program that tell who is the youngest of them.
CODING:
Console.Write("Enter Age Of Alpha = ");
int a = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter Age Of Bravo = ");
int b = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter Age Of Charlie = ");
int c = Convert.ToInt32(Console.ReadLine());
Console.ReadLine();
CMD SCREENSHOT:
PROBLEM NO#11: Daniel lives in Italy and travels to Mexico, India and New
Zealand. The times differences are:
Mexico -7 0
India +4 +30
ulates the time in the country input using the data from the table
CODING:
Console.Write("Enter Name Of Country = ");
String country =Console.ReadLine();
Console.Write("Enter Time Of Italy = ");
Console.Write("Hours : ");
int H= Convert.ToInt32(Console.ReadLine());
Console.Write("Minutes :");
int M = Convert.ToInt32(Console.ReadLine());
if (country == "Mexico")
{
H -= 7;
}
else if (country == "India")
{
H += 4;
M += 30;
}
else if (country == "New Zealand")
{
H += 11;
if (H > 24)
{
H -= 24;
}
else if (M > 60)
{
M -= 60;
H++;
}
else
{
Console.Write("Countrry Is not Vlaid");
}
CMD SCREENSHOT:
PROBLEM NO#12: Write a program that taken Gender, Years of services &
Qualification as input from user and show the salary as per the following
table.
Gender Years of Services Qualification Salary
CODING:
Console.Write("Enter Gender = ");
string g = Console.ReadLine();
Console.Write("Enter Years Of Services = ");
int s = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter Qualification = ");
string q = Console.ReadLine();
if (g == "Male")
{
if (s >= 5)
{
if (q == "MS" || q == "MBA")
{
int salary = 90000;
Console.WriteLine("Employee Salary = " + salary);
}
else if (q == "BS" || q == "MCS")
{
int salary = 60000;
Console.WriteLine("Employee Salary = " + salary);
}
else if (s < 5)
{
if (q == "BS" || q == "MCS")
{
int salary = 50000;
Console.WriteLine("Employee Salary = " + salary);
}
else if (q == "BBA")
{
int salary = 25000;
Console.WriteLine("Employee Salary = " + salary);
}
}
}
}
else if (g == "Female")
{
if (s >= 5)
{
if (q == "MBBS")
{
int salary = 75000;
Console.WriteLine("Employee Salary = " + salary);
}
else if (q == "BDS")
{
int salary = 60000;
Console.WriteLine("Employee Salary = " + salary);
}
else if (s < 5)
{
if (q == "MBBS")
{
int salary = 40000;
Console.WriteLine("Employee Salary = " + salary);
}
else if (q == "BDS")
{
int salary = 25000;
Console.WriteLine("Employee Salary = " + salary);
}
}
}
}
else
{
Console.WriteLine("Invalid Data");
}
Console.ReadLine();
CMD SCREENSHOT:
PROBLEM NO#13: Suppose you are information officer in Admission
Department at PAF-KIET. Numbers of people come to you with several
questions regarding admission. Officers in Admission department came up
with a certain criteria as follows:
CODING:
Console.WriteLine(" Note: PLEASE ENTER FIRST WORD IN CAPITAL ");
Console.Write("Enter Precentage = ");
string prc = Console.ReadLine();
Console.Write("Enter Background = ");
string bck = Console.ReadLine();
CODING:
Console.Write("Hardness = ");
int h = Convert.ToInt32(Console.ReadLine());
Console.Write("Carbon Content = ");
int c = Convert.ToInt32(Console.ReadLine());
Console.Write("Tensile Strength = ");
int t = Convert.ToInt32(Console.ReadLine());
CMD SCREENSHOT:
>= 87 A Excellent
78 - 86 B+ Good
72 – 77 B Good
66 – 71 C+ Not Good
60 – 65 C Not Good
<= 59 F Very Bad
CODING:
Console.Write("Enter Student name = ");
string student = Console.ReadLine();
Console.Write("Marks In PF = " );
int pf = Convert.ToInt32(Console.ReadLine());
Console.Clear();
Console.ReadLine();
CMD SCREENSHOT: