Erythrocyte Protoporphyrin
Erythrocyte Protoporphyrin ( hemoglobin precursor) begin to accumulate as hemoglobin as
hematocrit declineduring the 3rd stage of iron deficiency occurs when their is lack of iron limits
hemoglobin production.
World wide,how many people are estimated to have iron deficiency anemia
Ans; 2.0 to 2.5billion ( over 30% 0f world population according to WHO)
Solution
Erythrocyte Protoporphyrin
Erythrocyte Protoporphyrin ( hemoglobin precursor) begin to accumulate as hemoglobin as
hematocrit declineduring the 3rd stage of iron deficiency occurs when their is lack of iron limits
hemoglobin production.
World wide,how many people are estimated to have iron deficiency anemia
Ans; 2.0 to 2.5billion ( over 30% 0f world population according to WHO).
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.