SlideShare a Scribd company logo
1 of 14
Download to read offline
Please follow the code and comments for description and outputs :
CODE :
using System;
class Debug2_1
{
public static void Main(string[] args)
{
int orderNum = 0, quantity = 0;
int order = 0, amount = 0;
double total;
const double PRICE_EACH = 3.99;
GetData(orderNum, quantity, out order, out amount);
total = amount * PRICE_EACH;
Console.WriteLine("Order #{0}. Quantity ordered = {1}", order, amount);
Console.WriteLine("Total is {0}", total.ToString("C"));
}
private static void GetData(int orderNum, int quantity, out int order, out int amount)
{
String s1, s2;
Console.Write("Enter order number ");
s1 = Console.ReadLine();
Console.Write("Enter quantity ");
s2 = Console.ReadLine();
order = Convert.ToInt32(s1);
amount = Convert.ToInt32(s2);
}
}
OUTPUT :
Enter order number 10
Enter quantity 2
Order #10. Quantity ordered = 2
Total is $7.98
CODE :
using System;
class Debug2_2
{
static void Main()
{
int numericScore = 82;
string letterScore = "B";
Console.Write("Score was {0}. ", numericScore);
GiveBonus(numericScore);
Console.WriteLine("Now it is {0}.", numericScore);
Console.Write("Grade was {0}.", letterScore);
GiveBonus(letterScore);
Console.WriteLine("Now it is {0}.", letterScore);
}
private static void GiveBonus(int testScore)
{
const int BONUS = 5;
testScore = BONUS;
}
private static void GiveBonus(string letterScore)
{
const string BONUS = "+";
letterScore = BONUS;
}
}
OUTPUT :
Score was 82. Now it is 82.
Grade was B.Now it is B.
CODE :
using System;
class Debug2_3
{
static void Main()
{
Console.WriteLine("Tuition is {0}", CalculateTuition(15, false));
Console.WriteLine("Tuition is {0}",CalculateTuition(15, false, 'O'));
Console.WriteLine("Tuition is {0}",CalculateTuition(15, true, 'O'));
}
private static double CalculateTuition(double credits, bool scholarship, char code = 'I')
{
double tuition;
const double RATE = 80.00;
const double OUT_DISTRICT_FEE = 300.00;
tuition = credits * RATE;
if(code != 'I') {
tuition += OUT_DISTRICT_FEE;
}
if(scholarship) {
tuition = 0;
}
return tuition;
}
}
OUTPUT :
Tuition is 1200
Tuition is 1500
Tuition is 0
CODE :
using System;
class Debug2_5
{
static void Main()
{
DisplayWebAddress();
Console.WriteLine("Shop at Shopper's World");
DisplayWebAddress();
Console.WriteLine("The best bargains from around the world");
DisplayWebAddress();
}
private static void DisplayWebAddress()
{
Console.WriteLine("------------------------------");
Console.WriteLine("Visit us on the web at:");
Console.WriteLine("www.shoppersworldbargains.com");
Console.WriteLine("******************************");
}
}
OUTPUT :
------------------------------
Visit us on the web at:
www.shoppersworldbargains.com
******************************
Shop at Shopper's World
------------------------------
Visit us on the web at:
www.shoppersworldbargains.com
******************************
The best bargains from around the world
------------------------------
Visit us on the web at:
www.shoppersworldbargains.com
******************************
CODE :
using System;
class Debug2_6
{
static void Main()
{
string addressee = "Ms. Brooke Jefferson";
int zipCode = 60007;
string cityAndState = "Elk Grove, IL";
AddressMethod(addressee, zipCode);
Console.WriteLine("-----------------------");
AddressMethod(addressee, cityAndState);
Console.WriteLine("-----------------------");
}
private static void AddressMethod(string person, int num)
{
Console.WriteLine("To : {0}", person);
Console.WriteLine("Zip: {0}", num);
}
private static void AddressMethod(string person, string city)
{
Console.WriteLine("To : {0}", person);
Console.WriteLine("{0}", city);
}
}
OUTPUT :
To : Ms. Brooke Jefferson
Zip: 60007
-----------------------
To : Ms. Brooke Jefferson
Elk Grove, IL
-----------------------
CODE :
using System;
class Debug2_7
{
static void Main()
{
int quantity;
double price;
quantity = GetQuantity();
price = CalculatePrice(quantity);
Console.WriteLine("Final price for {0} items is {1}.", quantity, price.ToString("c"));
}
private static int GetQuantity()
{
int quan;
Console.Write("Enter number of items >> ");
quan = Convert.ToInt32(Console.ReadLine());
return quan;
}
private static double CalculatePrice(int quantityOrdered)
{
double PRICE_PER_ITEM = 6.00;
double price = 0;
double discount = 0;
int x = 0;
int[] quanLimits = {0, 5, 10, 15};
double[] limits = {0, 0.10, 0.14, 0.20};
for(x = limits.Length - 1; x >= 0; --x)
if(quantityOrdered >= limits[x])
discount = limits[x];
x = 0;
price = quantityOrdered * PRICE_PER_ITEM;
price = price - price * discount;
return price;
}
}
OUTPUT :
Enter number of items >> 5
Final price for 5 items is $30.00.
CODE :
using System;
class Debug2_8
{
public static void Main(string[] args)
{
double[] firstArray = {10, 9, 2, 3, 5, 6};
double[] secondArray = {112, 456, 782};
double[] thirdArray = {9, 12, 45, 82, 84, 67, 2, 6};
Console.WriteLine("The median value of the first array is {0}", FindMedian(firstArray));
Console.WriteLine("The median value of the second array is {0}",
FindMedian(secondArray));
Console.WriteLine("The median value of the third array is {0}", FindMedian(thirdArray));
}
private static double FindMedian(double[] array)
{
double median = 0.0;
int middle = (array.Length / 2);
Array.Sort(array);
if((array.Length % 2) == 0) {
median = (array[middle - 1] + array[middle]) / 2;
} else {
median = (array[middle]);
}
return median;
}
}
OUTPUT :
The median value of the first array is 5.5
The median value of the second array is 456
The median value of the third array is 28.5
Hope this is helpful.
Solution
Please follow the code and comments for description and outputs :
CODE :
using System;
class Debug2_1
{
public static void Main(string[] args)
{
int orderNum = 0, quantity = 0;
int order = 0, amount = 0;
double total;
const double PRICE_EACH = 3.99;
GetData(orderNum, quantity, out order, out amount);
total = amount * PRICE_EACH;
Console.WriteLine("Order #{0}. Quantity ordered = {1}", order, amount);
Console.WriteLine("Total is {0}", total.ToString("C"));
}
private static void GetData(int orderNum, int quantity, out int order, out int amount)
{
String s1, s2;
Console.Write("Enter order number ");
s1 = Console.ReadLine();
Console.Write("Enter quantity ");
s2 = Console.ReadLine();
order = Convert.ToInt32(s1);
amount = Convert.ToInt32(s2);
}
}
OUTPUT :
Enter order number 10
Enter quantity 2
Order #10. Quantity ordered = 2
Total is $7.98
CODE :
using System;
class Debug2_2
{
static void Main()
{
int numericScore = 82;
string letterScore = "B";
Console.Write("Score was {0}. ", numericScore);
GiveBonus(numericScore);
Console.WriteLine("Now it is {0}.", numericScore);
Console.Write("Grade was {0}.", letterScore);
GiveBonus(letterScore);
Console.WriteLine("Now it is {0}.", letterScore);
}
private static void GiveBonus(int testScore)
{
const int BONUS = 5;
testScore = BONUS;
}
private static void GiveBonus(string letterScore)
{
const string BONUS = "+";
letterScore = BONUS;
}
}
OUTPUT :
Score was 82. Now it is 82.
Grade was B.Now it is B.
CODE :
using System;
class Debug2_3
{
static void Main()
{
Console.WriteLine("Tuition is {0}", CalculateTuition(15, false));
Console.WriteLine("Tuition is {0}",CalculateTuition(15, false, 'O'));
Console.WriteLine("Tuition is {0}",CalculateTuition(15, true, 'O'));
}
private static double CalculateTuition(double credits, bool scholarship, char code = 'I')
{
double tuition;
const double RATE = 80.00;
const double OUT_DISTRICT_FEE = 300.00;
tuition = credits * RATE;
if(code != 'I') {
tuition += OUT_DISTRICT_FEE;
}
if(scholarship) {
tuition = 0;
}
return tuition;
}
}
OUTPUT :
Tuition is 1200
Tuition is 1500
Tuition is 0
CODE :
using System;
class Debug2_5
{
static void Main()
{
DisplayWebAddress();
Console.WriteLine("Shop at Shopper's World");
DisplayWebAddress();
Console.WriteLine("The best bargains from around the world");
DisplayWebAddress();
}
private static void DisplayWebAddress()
{
Console.WriteLine("------------------------------");
Console.WriteLine("Visit us on the web at:");
Console.WriteLine("www.shoppersworldbargains.com");
Console.WriteLine("******************************");
}
}
OUTPUT :
------------------------------
Visit us on the web at:
www.shoppersworldbargains.com
******************************
Shop at Shopper's World
------------------------------
Visit us on the web at:
www.shoppersworldbargains.com
******************************
The best bargains from around the world
------------------------------
Visit us on the web at:
www.shoppersworldbargains.com
******************************
CODE :
using System;
class Debug2_6
{
static void Main()
{
string addressee = "Ms. Brooke Jefferson";
int zipCode = 60007;
string cityAndState = "Elk Grove, IL";
AddressMethod(addressee, zipCode);
Console.WriteLine("-----------------------");
AddressMethod(addressee, cityAndState);
Console.WriteLine("-----------------------");
}
private static void AddressMethod(string person, int num)
{
Console.WriteLine("To : {0}", person);
Console.WriteLine("Zip: {0}", num);
}
private static void AddressMethod(string person, string city)
{
Console.WriteLine("To : {0}", person);
Console.WriteLine("{0}", city);
}
}
OUTPUT :
To : Ms. Brooke Jefferson
Zip: 60007
-----------------------
To : Ms. Brooke Jefferson
Elk Grove, IL
-----------------------
CODE :
using System;
class Debug2_7
{
static void Main()
{
int quantity;
double price;
quantity = GetQuantity();
price = CalculatePrice(quantity);
Console.WriteLine("Final price for {0} items is {1}.", quantity, price.ToString("c"));
}
private static int GetQuantity()
{
int quan;
Console.Write("Enter number of items >> ");
quan = Convert.ToInt32(Console.ReadLine());
return quan;
}
private static double CalculatePrice(int quantityOrdered)
{
double PRICE_PER_ITEM = 6.00;
double price = 0;
double discount = 0;
int x = 0;
int[] quanLimits = {0, 5, 10, 15};
double[] limits = {0, 0.10, 0.14, 0.20};
for(x = limits.Length - 1; x >= 0; --x)
if(quantityOrdered >= limits[x])
discount = limits[x];
x = 0;
price = quantityOrdered * PRICE_PER_ITEM;
price = price - price * discount;
return price;
}
}
OUTPUT :
Enter number of items >> 5
Final price for 5 items is $30.00.
CODE :
using System;
class Debug2_8
{
public static void Main(string[] args)
{
double[] firstArray = {10, 9, 2, 3, 5, 6};
double[] secondArray = {112, 456, 782};
double[] thirdArray = {9, 12, 45, 82, 84, 67, 2, 6};
Console.WriteLine("The median value of the first array is {0}", FindMedian(firstArray));
Console.WriteLine("The median value of the second array is {0}",
FindMedian(secondArray));
Console.WriteLine("The median value of the third array is {0}", FindMedian(thirdArray));
}
private static double FindMedian(double[] array)
{
double median = 0.0;
int middle = (array.Length / 2);
Array.Sort(array);
if((array.Length % 2) == 0) {
median = (array[middle - 1] + array[middle]) / 2;
} else {
median = (array[middle]);
}
return median;
}
}
OUTPUT :
The median value of the first array is 5.5
The median value of the second array is 456
The median value of the third array is 28.5
Hope this is helpful.

More Related Content

Similar to Please follow the code and comments for description and outputs C.pdf

Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTsKevlin Henney
 
I am working on java programming that converts zipcode to barcode an.pdf
I am working on java programming that converts zipcode to barcode an.pdfI am working on java programming that converts zipcode to barcode an.pdf
I am working on java programming that converts zipcode to barcode an.pdfthangarajarivukadal
 
C++20 the small things - Timur Doumler
C++20 the small things - Timur DoumlerC++20 the small things - Timur Doumler
C++20 the small things - Timur Doumlercorehard_by
 
The Effective Developer - Work Smarter, not Harder
The Effective Developer - Work Smarter, not HarderThe Effective Developer - Work Smarter, not Harder
The Effective Developer - Work Smarter, not HarderSven Peters
 
The Effective Developer - Work Smarter, Not Harder
The Effective Developer - Work Smarter, Not HarderThe Effective Developer - Work Smarter, Not Harder
The Effective Developer - Work Smarter, Not HarderSven Peters
 
C++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxC++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxssuser3cbb4c
 
java experiments and programs
java experiments and programsjava experiments and programs
java experiments and programsKaruppaiyaa123
 
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdfWrite the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdfarihantmum
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical fileMitul Patel
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_papervandna123
 
Create a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdfCreate a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdfmalavshah9013
 
Developer Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoDeveloper Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoThe Software House
 
Analysis of Microsoft Code Contracts
Analysis of Microsoft Code ContractsAnalysis of Microsoft Code Contracts
Analysis of Microsoft Code ContractsPVS-Studio
 
Lab. Programs in C
Lab. Programs in CLab. Programs in C
Lab. Programs in CSaket Pathak
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13alish sha
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfmayorothenguyenhob69
 

Similar to Please follow the code and comments for description and outputs C.pdf (19)

Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTs
 
I am working on java programming that converts zipcode to barcode an.pdf
I am working on java programming that converts zipcode to barcode an.pdfI am working on java programming that converts zipcode to barcode an.pdf
I am working on java programming that converts zipcode to barcode an.pdf
 
C++20 the small things - Timur Doumler
C++20 the small things - Timur DoumlerC++20 the small things - Timur Doumler
C++20 the small things - Timur Doumler
 
The Effective Developer - Work Smarter, not Harder
The Effective Developer - Work Smarter, not HarderThe Effective Developer - Work Smarter, not Harder
The Effective Developer - Work Smarter, not Harder
 
syed
syedsyed
syed
 
The Effective Developer - Work Smarter, Not Harder
The Effective Developer - Work Smarter, Not HarderThe Effective Developer - Work Smarter, Not Harder
The Effective Developer - Work Smarter, Not Harder
 
C++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxC++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptx
 
java experiments and programs
java experiments and programsjava experiments and programs
java experiments and programs
 
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdfWrite the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical file
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_paper
 
Create a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdfCreate a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdf
 
Developer Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duoDeveloper Experience i TypeScript. Najbardziej ikoniczne duo
Developer Experience i TypeScript. Najbardziej ikoniczne duo
 
Analysis of Microsoft Code Contracts
Analysis of Microsoft Code ContractsAnalysis of Microsoft Code Contracts
Analysis of Microsoft Code Contracts
 
C# labprograms
C# labprogramsC# labprograms
C# labprograms
 
Lab. Programs in C
Lab. Programs in CLab. Programs in C
Lab. Programs in C
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13
 
C#.net
C#.netC#.net
C#.net
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 

More from proloyankur01

System is a set of interacting or interdependent entities forming an.pdf
System is a set of interacting or interdependent entities forming an.pdfSystem is a set of interacting or interdependent entities forming an.pdf
System is a set of interacting or interdependent entities forming an.pdfproloyankur01
 
Solution Given thatBy definition of logarithm, we getSolution.pdf
Solution Given thatBy definition of logarithm, we getSolution.pdfSolution Given thatBy definition of logarithm, we getSolution.pdf
Solution Given thatBy definition of logarithm, we getSolution.pdfproloyankur01
 
C is the abbrevation for Carbon .pdf
                     C is the abbrevation for Carbon                  .pdf                     C is the abbrevation for Carbon                  .pdf
C is the abbrevation for Carbon .pdfproloyankur01
 
Percent error actual - experimental actual x 100.AMU, atomic.pdf
Percent error actual - experimental  actual x 100.AMU, atomic.pdfPercent error actual - experimental  actual x 100.AMU, atomic.pdf
Percent error actual - experimental actual x 100.AMU, atomic.pdfproloyankur01
 
organization acted as the IdPThe fundamental concept introduced b.pdf
organization acted as the IdPThe fundamental concept introduced b.pdforganization acted as the IdPThe fundamental concept introduced b.pdf
organization acted as the IdPThe fundamental concept introduced b.pdfproloyankur01
 
Let X = JohnSolutionLet X = John.pdf
Let X = JohnSolutionLet X = John.pdfLet X = JohnSolutionLet X = John.pdf
Let X = JohnSolutionLet X = John.pdfproloyankur01
 
In the United States, policy makers, health professionals, and patie.pdf
In the United States, policy makers, health professionals, and patie.pdfIn the United States, policy makers, health professionals, and patie.pdf
In the United States, policy makers, health professionals, and patie.pdfproloyankur01
 
holding period return = (2D1P1Po)Solutionholding period retur.pdf
holding period return = (2D1P1Po)Solutionholding period retur.pdfholding period return = (2D1P1Po)Solutionholding period retur.pdf
holding period return = (2D1P1Po)Solutionholding period retur.pdfproloyankur01
 
create file name as board.javawrite below codeimport java.aw.pdf
create file name as board.javawrite below codeimport java.aw.pdfcreate file name as board.javawrite below codeimport java.aw.pdf
create file name as board.javawrite below codeimport java.aw.pdfproloyankur01
 
Dear,The answer is 25.SolutionDear,The answer is 25..pdf
Dear,The answer is 25.SolutionDear,The answer is 25..pdfDear,The answer is 25.SolutionDear,The answer is 25..pdf
Dear,The answer is 25.SolutionDear,The answer is 25..pdfproloyankur01
 
Cybrcoin or commonly known as Bitcoin is gaining ground from the las.pdf
Cybrcoin or commonly known as Bitcoin is gaining ground from the las.pdfCybrcoin or commonly known as Bitcoin is gaining ground from the las.pdf
Cybrcoin or commonly known as Bitcoin is gaining ground from the las.pdfproloyankur01
 
Cant see the questionSolutionCant see the question.pdf
Cant see the questionSolutionCant see the question.pdfCant see the questionSolutionCant see the question.pdf
Cant see the questionSolutionCant see the question.pdfproloyankur01
 
Baud rate states that the symbol of frequency in a communication cha.pdf
Baud rate states that the symbol of frequency in a communication cha.pdfBaud rate states that the symbol of frequency in a communication cha.pdf
Baud rate states that the symbol of frequency in a communication cha.pdfproloyankur01
 
b.) varies only in name from a one way analysis of varianceSolut.pdf
b.) varies only in name from a one way analysis of varianceSolut.pdfb.) varies only in name from a one way analysis of varianceSolut.pdf
b.) varies only in name from a one way analysis of varianceSolut.pdfproloyankur01
 
AnswerThe evolutionary history of humans since the most recent co.pdf
AnswerThe evolutionary history of humans since the most recent co.pdfAnswerThe evolutionary history of humans since the most recent co.pdf
AnswerThe evolutionary history of humans since the most recent co.pdfproloyankur01
 
Answer-Cultural relativism is a complex concept that has its inte.pdf
Answer-Cultural relativism is a complex concept that has its inte.pdfAnswer-Cultural relativism is a complex concept that has its inte.pdf
Answer-Cultural relativism is a complex concept that has its inte.pdfproloyankur01
 
Answer   The answer is (C)DoubleSolutionAnswer   The a.pdf
Answer   The answer is (C)DoubleSolutionAnswer   The a.pdfAnswer   The answer is (C)DoubleSolutionAnswer   The a.pdf
Answer   The answer is (C)DoubleSolutionAnswer   The a.pdfproloyankur01
 
Advantages1.Easy to share data over a network2.Better communica.pdf
Advantages1.Easy to share data over a network2.Better communica.pdfAdvantages1.Easy to share data over a network2.Better communica.pdf
Advantages1.Easy to share data over a network2.Better communica.pdfproloyankur01
 
An S corporation is formed by filing an Articles of Incorporation wi.pdf
An S corporation is formed by filing an Articles of Incorporation wi.pdfAn S corporation is formed by filing an Articles of Incorporation wi.pdf
An S corporation is formed by filing an Articles of Incorporation wi.pdfproloyankur01
 
A)depository institutionsB) contractual savings institutionsC)in.pdf
A)depository institutionsB) contractual savings institutionsC)in.pdfA)depository institutionsB) contractual savings institutionsC)in.pdf
A)depository institutionsB) contractual savings institutionsC)in.pdfproloyankur01
 

More from proloyankur01 (20)

System is a set of interacting or interdependent entities forming an.pdf
System is a set of interacting or interdependent entities forming an.pdfSystem is a set of interacting or interdependent entities forming an.pdf
System is a set of interacting or interdependent entities forming an.pdf
 
Solution Given thatBy definition of logarithm, we getSolution.pdf
Solution Given thatBy definition of logarithm, we getSolution.pdfSolution Given thatBy definition of logarithm, we getSolution.pdf
Solution Given thatBy definition of logarithm, we getSolution.pdf
 
C is the abbrevation for Carbon .pdf
                     C is the abbrevation for Carbon                  .pdf                     C is the abbrevation for Carbon                  .pdf
C is the abbrevation for Carbon .pdf
 
Percent error actual - experimental actual x 100.AMU, atomic.pdf
Percent error actual - experimental  actual x 100.AMU, atomic.pdfPercent error actual - experimental  actual x 100.AMU, atomic.pdf
Percent error actual - experimental actual x 100.AMU, atomic.pdf
 
organization acted as the IdPThe fundamental concept introduced b.pdf
organization acted as the IdPThe fundamental concept introduced b.pdforganization acted as the IdPThe fundamental concept introduced b.pdf
organization acted as the IdPThe fundamental concept introduced b.pdf
 
Let X = JohnSolutionLet X = John.pdf
Let X = JohnSolutionLet X = John.pdfLet X = JohnSolutionLet X = John.pdf
Let X = JohnSolutionLet X = John.pdf
 
In the United States, policy makers, health professionals, and patie.pdf
In the United States, policy makers, health professionals, and patie.pdfIn the United States, policy makers, health professionals, and patie.pdf
In the United States, policy makers, health professionals, and patie.pdf
 
holding period return = (2D1P1Po)Solutionholding period retur.pdf
holding period return = (2D1P1Po)Solutionholding period retur.pdfholding period return = (2D1P1Po)Solutionholding period retur.pdf
holding period return = (2D1P1Po)Solutionholding period retur.pdf
 
create file name as board.javawrite below codeimport java.aw.pdf
create file name as board.javawrite below codeimport java.aw.pdfcreate file name as board.javawrite below codeimport java.aw.pdf
create file name as board.javawrite below codeimport java.aw.pdf
 
Dear,The answer is 25.SolutionDear,The answer is 25..pdf
Dear,The answer is 25.SolutionDear,The answer is 25..pdfDear,The answer is 25.SolutionDear,The answer is 25..pdf
Dear,The answer is 25.SolutionDear,The answer is 25..pdf
 
Cybrcoin or commonly known as Bitcoin is gaining ground from the las.pdf
Cybrcoin or commonly known as Bitcoin is gaining ground from the las.pdfCybrcoin or commonly known as Bitcoin is gaining ground from the las.pdf
Cybrcoin or commonly known as Bitcoin is gaining ground from the las.pdf
 
Cant see the questionSolutionCant see the question.pdf
Cant see the questionSolutionCant see the question.pdfCant see the questionSolutionCant see the question.pdf
Cant see the questionSolutionCant see the question.pdf
 
Baud rate states that the symbol of frequency in a communication cha.pdf
Baud rate states that the symbol of frequency in a communication cha.pdfBaud rate states that the symbol of frequency in a communication cha.pdf
Baud rate states that the symbol of frequency in a communication cha.pdf
 
b.) varies only in name from a one way analysis of varianceSolut.pdf
b.) varies only in name from a one way analysis of varianceSolut.pdfb.) varies only in name from a one way analysis of varianceSolut.pdf
b.) varies only in name from a one way analysis of varianceSolut.pdf
 
AnswerThe evolutionary history of humans since the most recent co.pdf
AnswerThe evolutionary history of humans since the most recent co.pdfAnswerThe evolutionary history of humans since the most recent co.pdf
AnswerThe evolutionary history of humans since the most recent co.pdf
 
Answer-Cultural relativism is a complex concept that has its inte.pdf
Answer-Cultural relativism is a complex concept that has its inte.pdfAnswer-Cultural relativism is a complex concept that has its inte.pdf
Answer-Cultural relativism is a complex concept that has its inte.pdf
 
Answer   The answer is (C)DoubleSolutionAnswer   The a.pdf
Answer   The answer is (C)DoubleSolutionAnswer   The a.pdfAnswer   The answer is (C)DoubleSolutionAnswer   The a.pdf
Answer   The answer is (C)DoubleSolutionAnswer   The a.pdf
 
Advantages1.Easy to share data over a network2.Better communica.pdf
Advantages1.Easy to share data over a network2.Better communica.pdfAdvantages1.Easy to share data over a network2.Better communica.pdf
Advantages1.Easy to share data over a network2.Better communica.pdf
 
An S corporation is formed by filing an Articles of Incorporation wi.pdf
An S corporation is formed by filing an Articles of Incorporation wi.pdfAn S corporation is formed by filing an Articles of Incorporation wi.pdf
An S corporation is formed by filing an Articles of Incorporation wi.pdf
 
A)depository institutionsB) contractual savings institutionsC)in.pdf
A)depository institutionsB) contractual savings institutionsC)in.pdfA)depository institutionsB) contractual savings institutionsC)in.pdf
A)depository institutionsB) contractual savings institutionsC)in.pdf
 

Recently uploaded

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 

Recently uploaded (20)

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 

Please follow the code and comments for description and outputs C.pdf

  • 1. Please follow the code and comments for description and outputs : CODE : using System; class Debug2_1 { public static void Main(string[] args) { int orderNum = 0, quantity = 0; int order = 0, amount = 0; double total; const double PRICE_EACH = 3.99; GetData(orderNum, quantity, out order, out amount); total = amount * PRICE_EACH; Console.WriteLine("Order #{0}. Quantity ordered = {1}", order, amount); Console.WriteLine("Total is {0}", total.ToString("C")); } private static void GetData(int orderNum, int quantity, out int order, out int amount) { String s1, s2; Console.Write("Enter order number "); s1 = Console.ReadLine(); Console.Write("Enter quantity "); s2 = Console.ReadLine(); order = Convert.ToInt32(s1); amount = Convert.ToInt32(s2); } } OUTPUT : Enter order number 10 Enter quantity 2 Order #10. Quantity ordered = 2 Total is $7.98 CODE : using System;
  • 2. class Debug2_2 { static void Main() { int numericScore = 82; string letterScore = "B"; Console.Write("Score was {0}. ", numericScore); GiveBonus(numericScore); Console.WriteLine("Now it is {0}.", numericScore); Console.Write("Grade was {0}.", letterScore); GiveBonus(letterScore); Console.WriteLine("Now it is {0}.", letterScore); } private static void GiveBonus(int testScore) { const int BONUS = 5; testScore = BONUS; } private static void GiveBonus(string letterScore) { const string BONUS = "+"; letterScore = BONUS; } } OUTPUT : Score was 82. Now it is 82. Grade was B.Now it is B. CODE : using System; class Debug2_3 { static void Main() { Console.WriteLine("Tuition is {0}", CalculateTuition(15, false));
  • 3. Console.WriteLine("Tuition is {0}",CalculateTuition(15, false, 'O')); Console.WriteLine("Tuition is {0}",CalculateTuition(15, true, 'O')); } private static double CalculateTuition(double credits, bool scholarship, char code = 'I') { double tuition; const double RATE = 80.00; const double OUT_DISTRICT_FEE = 300.00; tuition = credits * RATE; if(code != 'I') { tuition += OUT_DISTRICT_FEE; } if(scholarship) { tuition = 0; } return tuition; } } OUTPUT : Tuition is 1200 Tuition is 1500 Tuition is 0 CODE : using System; class Debug2_5 { static void Main() { DisplayWebAddress(); Console.WriteLine("Shop at Shopper's World"); DisplayWebAddress(); Console.WriteLine("The best bargains from around the world"); DisplayWebAddress(); } private static void DisplayWebAddress()
  • 4. { Console.WriteLine("------------------------------"); Console.WriteLine("Visit us on the web at:"); Console.WriteLine("www.shoppersworldbargains.com"); Console.WriteLine("******************************"); } } OUTPUT : ------------------------------ Visit us on the web at: www.shoppersworldbargains.com ****************************** Shop at Shopper's World ------------------------------ Visit us on the web at: www.shoppersworldbargains.com ****************************** The best bargains from around the world ------------------------------ Visit us on the web at: www.shoppersworldbargains.com ****************************** CODE : using System; class Debug2_6 { static void Main() { string addressee = "Ms. Brooke Jefferson"; int zipCode = 60007; string cityAndState = "Elk Grove, IL"; AddressMethod(addressee, zipCode); Console.WriteLine("-----------------------"); AddressMethod(addressee, cityAndState); Console.WriteLine("-----------------------"); }
  • 5. private static void AddressMethod(string person, int num) { Console.WriteLine("To : {0}", person); Console.WriteLine("Zip: {0}", num); } private static void AddressMethod(string person, string city) { Console.WriteLine("To : {0}", person); Console.WriteLine("{0}", city); } } OUTPUT : To : Ms. Brooke Jefferson Zip: 60007 ----------------------- To : Ms. Brooke Jefferson Elk Grove, IL ----------------------- CODE : using System; class Debug2_7 { static void Main() { int quantity; double price; quantity = GetQuantity(); price = CalculatePrice(quantity); Console.WriteLine("Final price for {0} items is {1}.", quantity, price.ToString("c")); } private static int GetQuantity() { int quan; Console.Write("Enter number of items >> "); quan = Convert.ToInt32(Console.ReadLine());
  • 6. return quan; } private static double CalculatePrice(int quantityOrdered) { double PRICE_PER_ITEM = 6.00; double price = 0; double discount = 0; int x = 0; int[] quanLimits = {0, 5, 10, 15}; double[] limits = {0, 0.10, 0.14, 0.20}; for(x = limits.Length - 1; x >= 0; --x) if(quantityOrdered >= limits[x]) discount = limits[x]; x = 0; price = quantityOrdered * PRICE_PER_ITEM; price = price - price * discount; return price; } } OUTPUT : Enter number of items >> 5 Final price for 5 items is $30.00. CODE : using System; class Debug2_8 { public static void Main(string[] args) { double[] firstArray = {10, 9, 2, 3, 5, 6}; double[] secondArray = {112, 456, 782}; double[] thirdArray = {9, 12, 45, 82, 84, 67, 2, 6}; Console.WriteLine("The median value of the first array is {0}", FindMedian(firstArray)); Console.WriteLine("The median value of the second array is {0}", FindMedian(secondArray));
  • 7. Console.WriteLine("The median value of the third array is {0}", FindMedian(thirdArray)); } private static double FindMedian(double[] array) { double median = 0.0; int middle = (array.Length / 2); Array.Sort(array); if((array.Length % 2) == 0) { median = (array[middle - 1] + array[middle]) / 2; } else { median = (array[middle]); } return median; } } OUTPUT : The median value of the first array is 5.5 The median value of the second array is 456 The median value of the third array is 28.5 Hope this is helpful. Solution Please follow the code and comments for description and outputs : CODE : using System; class Debug2_1 { public static void Main(string[] args) { int orderNum = 0, quantity = 0; int order = 0, amount = 0; double total; const double PRICE_EACH = 3.99; GetData(orderNum, quantity, out order, out amount);
  • 8. total = amount * PRICE_EACH; Console.WriteLine("Order #{0}. Quantity ordered = {1}", order, amount); Console.WriteLine("Total is {0}", total.ToString("C")); } private static void GetData(int orderNum, int quantity, out int order, out int amount) { String s1, s2; Console.Write("Enter order number "); s1 = Console.ReadLine(); Console.Write("Enter quantity "); s2 = Console.ReadLine(); order = Convert.ToInt32(s1); amount = Convert.ToInt32(s2); } } OUTPUT : Enter order number 10 Enter quantity 2 Order #10. Quantity ordered = 2 Total is $7.98 CODE : using System; class Debug2_2 { static void Main() { int numericScore = 82; string letterScore = "B"; Console.Write("Score was {0}. ", numericScore); GiveBonus(numericScore); Console.WriteLine("Now it is {0}.", numericScore); Console.Write("Grade was {0}.", letterScore); GiveBonus(letterScore); Console.WriteLine("Now it is {0}.", letterScore); } private static void GiveBonus(int testScore)
  • 9. { const int BONUS = 5; testScore = BONUS; } private static void GiveBonus(string letterScore) { const string BONUS = "+"; letterScore = BONUS; } } OUTPUT : Score was 82. Now it is 82. Grade was B.Now it is B. CODE : using System; class Debug2_3 { static void Main() { Console.WriteLine("Tuition is {0}", CalculateTuition(15, false)); Console.WriteLine("Tuition is {0}",CalculateTuition(15, false, 'O')); Console.WriteLine("Tuition is {0}",CalculateTuition(15, true, 'O')); } private static double CalculateTuition(double credits, bool scholarship, char code = 'I') { double tuition; const double RATE = 80.00; const double OUT_DISTRICT_FEE = 300.00; tuition = credits * RATE; if(code != 'I') { tuition += OUT_DISTRICT_FEE; } if(scholarship) { tuition = 0;
  • 10. } return tuition; } } OUTPUT : Tuition is 1200 Tuition is 1500 Tuition is 0 CODE : using System; class Debug2_5 { static void Main() { DisplayWebAddress(); Console.WriteLine("Shop at Shopper's World"); DisplayWebAddress(); Console.WriteLine("The best bargains from around the world"); DisplayWebAddress(); } private static void DisplayWebAddress() { Console.WriteLine("------------------------------"); Console.WriteLine("Visit us on the web at:"); Console.WriteLine("www.shoppersworldbargains.com"); Console.WriteLine("******************************"); } } OUTPUT : ------------------------------ Visit us on the web at: www.shoppersworldbargains.com ****************************** Shop at Shopper's World ------------------------------
  • 11. Visit us on the web at: www.shoppersworldbargains.com ****************************** The best bargains from around the world ------------------------------ Visit us on the web at: www.shoppersworldbargains.com ****************************** CODE : using System; class Debug2_6 { static void Main() { string addressee = "Ms. Brooke Jefferson"; int zipCode = 60007; string cityAndState = "Elk Grove, IL"; AddressMethod(addressee, zipCode); Console.WriteLine("-----------------------"); AddressMethod(addressee, cityAndState); Console.WriteLine("-----------------------"); } private static void AddressMethod(string person, int num) { Console.WriteLine("To : {0}", person); Console.WriteLine("Zip: {0}", num); } private static void AddressMethod(string person, string city) { Console.WriteLine("To : {0}", person); Console.WriteLine("{0}", city); } } OUTPUT : To : Ms. Brooke Jefferson Zip: 60007
  • 12. ----------------------- To : Ms. Brooke Jefferson Elk Grove, IL ----------------------- CODE : using System; class Debug2_7 { static void Main() { int quantity; double price; quantity = GetQuantity(); price = CalculatePrice(quantity); Console.WriteLine("Final price for {0} items is {1}.", quantity, price.ToString("c")); } private static int GetQuantity() { int quan; Console.Write("Enter number of items >> "); quan = Convert.ToInt32(Console.ReadLine()); return quan; } private static double CalculatePrice(int quantityOrdered) { double PRICE_PER_ITEM = 6.00; double price = 0; double discount = 0; int x = 0; int[] quanLimits = {0, 5, 10, 15}; double[] limits = {0, 0.10, 0.14, 0.20}; for(x = limits.Length - 1; x >= 0; --x) if(quantityOrdered >= limits[x]) discount = limits[x]; x = 0;
  • 13. price = quantityOrdered * PRICE_PER_ITEM; price = price - price * discount; return price; } } OUTPUT : Enter number of items >> 5 Final price for 5 items is $30.00. CODE : using System; class Debug2_8 { public static void Main(string[] args) { double[] firstArray = {10, 9, 2, 3, 5, 6}; double[] secondArray = {112, 456, 782}; double[] thirdArray = {9, 12, 45, 82, 84, 67, 2, 6}; Console.WriteLine("The median value of the first array is {0}", FindMedian(firstArray)); Console.WriteLine("The median value of the second array is {0}", FindMedian(secondArray)); Console.WriteLine("The median value of the third array is {0}", FindMedian(thirdArray)); } private static double FindMedian(double[] array) { double median = 0.0; int middle = (array.Length / 2); Array.Sort(array); if((array.Length % 2) == 0) { median = (array[middle - 1] + array[middle]) / 2; } else { median = (array[middle]); } return median; }
  • 14. } OUTPUT : The median value of the first array is 5.5 The median value of the second array is 456 The median value of the third array is 28.5 Hope this is helpful.