0
Okey, I didn't notice the inside change. Thank you very much for your explanation.
0
This is the code I'm using:
using System;
namespace DemoORAndAND
{
class Program
{
static void Main(string[] args)
{
const int ZONE1 = 1, ZONE2 = 2;
const int LOWQUANTITY = 10;
int quantity;
int diliveryZone;
Console.WriteLine("Delivery is free for zone {0} or {1}", ZONE1, ZONE2);
Console.WriteLine("...when the number of boxes is less than {0}", LOWQUANTITY);
quantity = method("\nQuantity ");
diliveryZone = method("Zone ");
if ((diliveryZone == ZONE1 || diliveryZone == ZONE2) && quantity <= LOWQUANTITY)
Console.WriteLine("Free");
else
Console.WriteLine("Not free");
Console.ReadKey();
}
public static int method(string s)
{
int num;
Console.Write(s);
num = Convert.ToInt32(Console.ReadLine());
return num;
}
}
}
0
It worked OK when I tried it but you have to input the quantity before the zone:
Quantity 9
Zone 1
Free
0
It's because these two lines are the wrong way around:
quantity = method("\nZone "); diliveryZone = method("Quantity ");
They should be:
quantity = method("\nQuantity ");
diliveryZone = method("Zone ");