static void Main(string[] args) { //Create a three object instances of Estimate and output data using toString Method from Estimate class //initializing variables //DECLARATIONS string DogName, DogOwner, code; int DogWeight, DayStayed; double cost = 0; double DAILY_RATE = 75.00, A_RATE = 169.00, C_RATE = 112.00; if((code == "A") || (code == "C")){ cost = calcRate(DayStayed, code); }else if(code == "N"){ cost = calcRate(DayStayed); }else{ Console.WriteLine("Something went wrong try again"); } //Create an array Estimate [] boarding = new Estimate[4]; for(int x = 0; x < boarding.Length; x++){ //Create object instance boarding[x] = new Estimate(); Console.WriteLine("Please enter your name:"); DogOwner = Console.ReadLine(); Console.WriteLine($"Please enter dog name for {DogOwner}:"); DogName = Console.ReadLine(); Console.WriteLine($"Please enter {DogName}'s weight:"); DogWeight = Convert.ToInt32(Console.ReadLine()); Console.WriteLine($"Please enter number of days the dog will stay:"); DayStayed = Convert.ToInt32(Console.ReadLine()); Console.WriteLine($"Please enter code addition services code:"); code = Console.ReadLine(); //Set values for object instance boarding[x].DogOwner = DogOwner; boarding[x].DogName = DogName; boarding[x].DogWeight = DogWeight; boarding[x].DayStayed = DayStayed; boarding[x].code = code; //Ouput object data Console.WriteLine(boarding[x].ToString()); } //Create a class called Estimate }
static void Main(string[] args) { //DECLARATIONS string dogOwner, dogName, serviceCode; double dogWeight,DAILY_RATE = 75.00, A_RATE = 169.00, C_RATE = 112.00; int numDays; double total=0; //creating an array of three estimate objects Estimate [] estimate = new Estimate[3]; for(int x=0; x < estimate.Length; x++){ //Create a three object instances of Estimate and output data using toString Method from Estimate class estimate[x] = new Estimate(); Console.WriteLine("Please enter the Dog owner's name: "); dogOwner = Console.ReadLine(); // estimate[x].DogOwner = dogOwner; Console.WriteLine("Please enter the dog's name: "); dogName = Console.ReadLine(); //setting the value for the object instance estimate[x].DogName =dogName; Console.WriteLine("Please enter service code. Enter [N] or no services [A] Bathing and grooming include or [C] for only bathing: "); serviceCode = Console.ReadLine(); estimate[x].ServiceCode =serviceCode; Console.WriteLine($"Please enter {dogOwner} weight of dog: "); dogWeight= Convert.ToInt32(Console.ReadLine()); // estimate[x].WeigtOfDog = dogWeight; Console.WriteLine("please enter the number of days the dog will stay at this location: "); numDays= Convert.ToInt32(Console.ReadLine()); // estimate[x].setNumOfDays(numDays); } for(var x=0; x < estimate.Length; x++){ Console.WriteLine(estimate[x].ToString()); } }//end of main method bracket
static void Main(string[] args) { string dogOwner; double dogWeight; string dogName; int days; string serviceCode; Estimate oneEstimate = new Estimate(); Estimate [] listOfEstimates = new Estimate[3]; for (var i = 0; i < listOfEstimates.Length; i++) { Console.WriteLine("Enter the dog owner's name"); dogOwner = Console.ReadLine(); Console.WriteLine("Enter the dog's name"); dogName = Console.ReadLine(); Console.WriteLine("Enter the dog's weight:"); dogWeight = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter the number of days:"); days = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("\nA = Bathing & Grooming"); Console.WriteLine("c = Bathing"); Console.WriteLine("\nSelect an option from the list of services above"); serviceCode = Console.ReadLine(); listOfEstimates[i] = new Estimate(days, serviceCode, dogOwner, dogName, dogWeight); Console.WriteLine(listOfEstimates[i]); } }