Advertisement
Guest User

client

a guest
May 5th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Remoting.Channels;
  5. using System.Runtime.Remoting.Channels.Tcp;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9.  
  10. namespace ConsoleClient
  11. {
  12.     class MyClient
  13.     {
  14.        
  15.         static void Main(string[] args)
  16.         {
  17.  
  18.             TcpChannel tcpChannel = new TcpChannel();
  19.             ChannelServices.RegisterChannel(tcpChannel, true);
  20.             GradeCalculate remoteObject = (GradeCalculate)Activator.GetObject(typeof(GradeCalculate), "tcp://localhost:9998/gradecalculator");
  21.            
  22.            
  23.             string username, password;
  24.             //bool exit = true;
  25.             int totalModules;
  26.             int[] marks = new int[31];
  27.             int CourseAverage;
  28.             int AverageBest8;
  29.             string GradeEvalute;
  30.  
  31.  
  32.  
  33.             System.Console.WriteLine("please enter your Username");
  34.             username = Console.ReadLine();
  35.             System.Console.WriteLine("Please enter your password");
  36.             password = Console.ReadLine();
  37.             bool authenticated = remoteObject.authenticate(username, password);
  38.             Console.Clear();
  39.  
  40.             if (authenticated)
  41.             {
  42.  
  43.                 System.Console.WriteLine("Enter total number modules (atleast 12 and max 30)");
  44.                 totalModules = Convert.ToInt32(Console.ReadLine());
  45.  
  46.  
  47.                 if (totalModules >= 12 && totalModules <= 30)
  48.                 {
  49.  
  50.                     //int i = totalNoModules;
  51.                            
  52.                     for (int i = 1; i <= totalModules; i++)
  53.                     {
  54.                                
  55.                         Console.WriteLine("Enter marks for Module " + i);
  56.                         marks[i] = Convert.ToInt32(Console.ReadLine());
  57.                         //Console.WriteLine("you have entereed " + marks[i]);
  58.                     }
  59.                 }
  60.                 remoteObject.ShowMarksInInputOrder(marks, totalModules);
  61.  
  62.                 CourseAverage = remoteObject.CourseAverage(marks,totalModules);
  63.                 AverageBest8 = remoteObject.AverageBest8(marks);
  64.                 GradeEvalute = remoteObject.GradeEvaluate(CourseAverage, AverageBest8);
  65.  
  66.                 System.Console.WriteLine(GradeEvalute);
  67.  
  68.                 //for (int i =1; i <= totalModules; i++)
  69.                 //{
  70.                 //    Console.Write("marks ");
  71.                 //    Console.WriteLine(marks[i]);
  72.                 //}
  73.  
  74.  
  75.  
  76.  
  77.  
  78.             }
  79.  
  80.            
  81.             //System.Console.WriteLine(authenticated);
  82.  
  83.         }
  84.  
  85.  
  86.  
  87.  
  88.     }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement