Answer to Question #279143 in C# for Hey

Question #279143

Create a console program that will compute for the fare of passengers, depend on



its passenger type.



-Regular Passenger



- Senior Passenger



- PWD Passenger

1
Expert's answer
2021-12-13T16:57:37-0500
using ConsoleApp1.ServiceReference1;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
   class Program
   {
       static void Main(string[] args)
       {
           Console.WriteLine("Enter passenger type(1 - regular, 2 - senior, 3 - PWD)");
           int fare = 0;
           int type = Convert.ToInt32(Console.ReadLine());
           switch (type)
           {
               case 1:
                   fare = 10; break;
               case 2:
                   fare = 15; break;
               case 3:
                   fare = 20; break;
           }
           Console.WriteLine("Passenger fare is ${0}", fare);
           Console.ReadLine();
       }
   }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS