Re: More help with assignment

  • From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx>
  • To: "Programming Blind" <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 9 Aug 2009 16:58:52 +0100

Hi Chris,

 Are you getting anywhere with your assignment?  I don't think the version
you posted on August 4th is compiling.  The first problem when I just copied
it into C# 2008 Express appears in the first line of Main.  What are you
trying to do here:

   char CostAgent(int){

The syntax highlighting indicates a problem before the left brace.  If you
are declaring a char variable or array, that brace shouldn't be there.  If
you are defining another object, Main is not the place to do it, if I
understand things correctly.

 It's some time since I looked at C# code, so tell me I'm wrong if
necessary.



 Martin





----- Original Message ----- From: "Chris Hallsworth" <christopherh40@xxxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, August 04, 2009 3:48 PM
Subject: More help with assignment


Hello all,
I'm still having problems with my assignment in Visual C# 2008 Express
Edition. First of all, please look at the code below and see why, when I
run
it, nothing but "Press any key to continue" is displayed. Also, When I
debug
the program, I'm now told that the version of DockingPort.exe that should
be
in the debug folder is missing. Please advise on what I should do next.
Now
here is the code:

-- start of code--
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DockingPort
{
   class Program
   {
       static void Main(string[] args)
       {
       char CostAgent(int){
Console.WriteLine("enter the vessel type and press enter");
       Char VesselType=Console.ReadLine();
If(VesselType=="o"){
   Return 1;}
       else If(VesselType=="c"){
           Return 4;}
       else If(VesselType=="r"){
           Return 2;}
       else If(VesselType=="b"){
           Return 1;}
       else If(VesselType=="p"){
           Return 2;}
       else If(VesselType=="f"){
           Return 1;}
           else{
           Console.WriteLine("Invalid vessel type, please try again");
       Console.ReadLine();
           }
       }
   char FreightAgent(int){
       Console.WriteLine("enter the vessel type and press enter");
       Char VesselType=Console.ReadLine();
       If(VesselType=="o"){
           Return 1;}
       else If(VesselType=="c"){
           Return 6;}
       else If(VesselType=="r"|"b"){
           Return 2;}
       else If(VesselType=="p"|"f"|){
           Return 1;}
              else{
           Console.WriteLine("Invalid vessel type, please try again");
   Console.ReadLine();}
   }
   char MarineSafetyInspector(int){
       Console.WriteLine("enter the vessel type and press enter");
       Char VesselType=Console.ReadLine();
       If(VesselType=="o"){
           Return 3;}
       else If(VesselType=="c"){
           Return 2;}
       Else If(VesselType=="r"|"b"){
           Return 1;}
       else If(VesselType=="p"){
           Return 2;}
       else If(VesselType=="f"){
           Return 1;}
       else{
           Console.WriteLine("Invalid vessel type, please try again");
       Console.ReadLine();}
   }
   Void StaffAttendance(){
Console.WriteLine("Enter the vessel type and press enter");
               Char VesselType=Console.ReadLine();
       If(VesselType=="o"|"c"|"r"|"b"|"p"|"f"){
           Console.WriteLine("Cost agents ="+CostAgent());
           Console.WriteLine("Freight Agents="+FreightAgent());
           Console.WriteLine("Marine Safety
Inspectors="+MarineSafetyInspector());}
       else{
                   Console.WriteLine("Invalid vessel type, please try
again");
       Console.ReadLine();}
   }
       }
   }
}
--End of code--

Thanks for the help in this matter.

--
Chris Hallsworth
E-mail: christopherh40@xxxxxxxxxxxxxx
MSN: ch9675@xxxxxxxxxxx
Skype: chrishallsworth7266
Klango: chrishallsworth

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind



--------------------------------------------------------------------------------



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.392 / Virus Database: 270.13.43/2281 - Release Date: 08/04/09
05:57:00

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: