Answer Posted / testndl002
PresentationLayer --> Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TravelInsuranceQuote.DataLayer;
using TravelInsuranceQuote.BusinessLayer;
using System.IO;
namespace TravelInsuranceQuote.PresentationLayer
{
public class Program
{
public static void Main(string[] args)
{
var customer = new Customer();
string[] lines = File.ReadAllLines(@"D:\Test.txt");
foreach (var line in lines)
{
var nameValue = line.Split(new char[] { ':' });
switch (nameValue[0].ToLower())
{
case "triptype":
customer.TripType = ((nameValue[1].ToLower() == "single") ? TripType.Single : TripType.Annual);
break;
case "sex":
customer.Sex = ((nameValue[1].ToLower() == "male") ? Sex.Male : Sex.Female);
break;
case "destination":
customer.Destination = ((nameValue[1].ToLower() == "uk") ? Destination.UK :
((nameValue[1].ToLower() == "europe") ? Destination.Europe : Destination.Worldwide));
break;
case "age":
customer.Age = Convert.ToInt32(nameValue[1]);
break;
case "travelperiod":
customer.TravelPeriod = Convert.ToInt32(nameValue[1]);
break;
}
}
//Console.Write("Type:");
//customer.TripType = ((Console.ReadLine().ToLower() == "single") ? TripType.Single : TripType.Annual);
//Console.Write("Age:");
//customer.Age = int.Parse(Console.ReadLine());
//Console.Write("Sex:");
//customer.Sex = ((Console.ReadLine().ToLower() == "male") ? Sex.Male : Sex.Female); ;
//Console.Write("Destination:");
//switch(Console.ReadLine().ToLower())
//{
// case "uk" :
// customer.Destination = Destination.UK;
// break;
// case "europe" :
// customer.Destination = Destination.Europe;
// break;
// case "worldwide" :
// customer.Destination = Destination.Worldwide;
// break;
//}
//Console.Write("TravelPeriod:");
//customer.TravelPeriod = int.Parse(Console.ReadLine());
string reason;
var customerPremium = new QuoteEngine().GetPremium(customer, out reason);
if (customerPremium != null)
{
Console.WriteLine("BasePremium({0}):{1}", customerPremium.Base, customerPremium.Base);
Console.WriteLine("Age({0}):{1}", customerPremium.Age[1], customerPremium.Age[0]);
Console.WriteLine("Sex({0}):{1}", customerPremium.Sex[1], customerPremium.Sex[0]);
Console.WriteLine("Destination({0}):{1}", customerPremium.Destination[1], customerPremium.Destination[0]);
Console.WriteLine("TravelPeriod({0}):{1}", customerPremium.TravelPeriod[1], customerPremium.TravelPeriod[0]);
Console.WriteLine("Tax({0}):{1}", customerPremium.Tax[1], customerPremium.Tax[0]);
Console.WriteLine("Total:{0}", customerPremium.Total);
}
else
{
Console.Write("Declined:" + reason);
}
Console.ReadKey();
}
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How do i find out the number of parameters passed into function?
Write code to read the records from a file and load any array of size 99?make sure that you take care of all the error conditions?
How do you initialize a static member of a class with return value of some function?
when will triggars the at new event in abap and web dybn pro?
Q2. A memory location has physical address D5687h. Compute: a. The offset address if the segment number is D445h. b. The segment number if the offset address is B577h.
code for connection from windows forms to sql server
How can we develop a multi-tier application in Java?
Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fit" instead of the number and for the multiples of five print "Bit". For numbers which are multiples of both three and five print "FitBit".
how do you generate source code for the automatic generation for receipt number
What is %Type,%Rowtype?
Explain the difference between an expert and a novice user. How would your strategy for designing user interfaces for an expert user differ from that for designing user interfaces for a novice user.
hii I inntrested abt scjp certification but i dont knw abt scjp plz send details abt scjp exam and syllabus.
why we use abstract in awt?
8.In DSP,Define Signal and System?and various type of signals.
My Qualification is MCA.My interview is on 5th may.They may ask q as------AS u r MCA...Why u r not tring anywhere else? What can be the ans?