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
what is the work of 1tier,2tier,&ntier? Plz Explain it!
Find out the list of roles which gives access to GUI activities? thanks in advance
What is autocall macro and how to create autocall macro? what is the use of it?
When we use Windows authentication mode
Suppose we are doing 4 operations on database using service, first operation is successful but due to some reason remaining 3 operations are failed. I) is this transaction successful or not? ii) How can you give that error message to user?
Given an array of size n, containing every element from 1 to n+1, except one. Find the missing element.
I am work in it aompenei
how can we maintain the previous version scripts to new version.
which book we learned this mantis? how many version are realsed this mantis upto now?
Given n red balls and m blue balls and some containers, how would you distribute those balls among the containers such that the probability of picking a red ball is maximized, assuming that the user randomly chooses a container and then randomly picks a ball from that.
what is dot net framework
what is the difference between SCAN AND CHECK,LOKUP AND XFOOT? where we can use thease opcodes? Can any body tell me real time senariao with example?
i am getting the error while compiling my cics program with including db2 dclgen member it is showing that ur dclgen member not including and all the host variables are undeclared
why we use mantis? what u mean mantis in IT trends? addvantages of mantis?
what is the diffrence between software and hardware language?