Click here to Skip to main content
15,913,854 members
Home / Discussions / C#
   

C#

 
GeneralRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
Gideon Engelberth12-Dec-09 10:56
Gideon Engelberth12-Dec-09 10:56 
GeneralRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
BillWoodruff13-Dec-09 12:28
professionalBillWoodruff13-Dec-09 12:28 
AnswerRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
Nicholas Butler12-Dec-09 23:28
sitebuilderNicholas Butler12-Dec-09 23:28 
GeneralRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
BillWoodruff13-Dec-09 12:21
professionalBillWoodruff13-Dec-09 12:21 
GeneralRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
Nicholas Butler13-Dec-09 22:45
sitebuilderNicholas Butler13-Dec-09 22:45 
GeneralRe: Replace "inner list" of a generic class inheriting from List<T> ? [modified] Pin
BillWoodruff14-Dec-09 4:50
professionalBillWoodruff14-Dec-09 4:50 
Answera "partial solution" to : re : Replace "inner list" of a generic class inheriting from List<T> ? Pin
BillWoodruff13-Dec-09 12:51
professionalBillWoodruff13-Dec-09 12:51 
QuestionUsing Methods within a Switch Case Pin
DevonDaDude11-Dec-09 22:47
DevonDaDude11-Dec-09 22:47 
Hello, everyone! I'm in need of assistance. I have to write a program calculating a user's input in a switch case.. I'm having problem.. Within my switch case, I reference a method to execute if the case statement is true.

A Little about my program:

The user will be given a menu. User will then select the option they desire and the amount they would like... User can keep entering the same option over and over(which I initialize the counter).

Here's a snippet of my code.

This is a Method of the Switch:
//Switch Statement Intialize
static void SwitchIntialize(ref int userResponse)
{
    switch (userResponse)
    {
        case 1:
                GetY(out yQ, out yTotal);
            break;

        case 2:
            {
                GetZ(out zQ, out zTotal);

            }
            break;

        default:
            {
                Console.WriteLine("Sorry, You've entered an Invalid Number");
                Console.WriteLine("Please try Again!!");
            }
            break;


    }


}



Now, This is my Method

//Calculates
  static void GetY(out double yQ, out double yTotal)
  {
      const double yPrice = 60.5;
      Console.WriteLine("How many pounds would you like of  Y? ");
      yQ = Convert.ToDouble(Console.ReadLine());
      yQ += yQ;
      yTotal = yQ * yPrice;
  }//EOF GetY

  //Calculates
  static void GetZ(out double zQ, out double zTotal)
  {

      const double zPrice = 20.39;
      Console.WriteLine("How many pounds would you like of Z? ");
      zQ = Convert.ToDouble(Console.ReadLine());
      zQ += zQ;
      zTotal = zQ * zPrice;


  }//EOF z




For my final output, I will have to display how many lbs of X,Y, and Z the user purchase and the price of it..

I've also, declare it in my main as,

SwitchIntialize(ref int userChoice)






The Errors, that I've encountered are:

The Name yQ does not exist in the current context.
The name yTotal does not exist in the current context.
The best overloaded method match 'Program.GetY(out double, out double); has some invalid arguments
Argument '1': cannot convert from 'out yQ' to 'out double'
Argument '2': cannot convert from 'out yTotal' to 'out double'




The Name zQ does not exist in the current context.
The name zTotal does not exist in the current context.
The best overloaded method match 'Program.GetZ(out double, out double); has some invalid arguments
Argument '1': cannot convert from 'out zQ' to 'out double'
Argument '2': cannot convert from 'out zTotal' to 'out double'
AnswerRe: Using Methods within a Switch Case Pin
Abhinav S11-Dec-09 22:56
Abhinav S11-Dec-09 22:56 
GeneralRe: Using Methods within a Switch Case Pin
OriginalGriff11-Dec-09 23:03
mveOriginalGriff11-Dec-09 23:03 
GeneralRe: Using Methods within a Switch Case Pin
Abhinav S11-Dec-09 23:09
Abhinav S11-Dec-09 23:09 
GeneralRe: Using Methods within a Switch Case Pin
Saksida Bojan12-Dec-09 1:49
Saksida Bojan12-Dec-09 1:49 
GeneralRe: Using Methods within a Switch Case Pin
Richard MacCutchan12-Dec-09 3:08
mveRichard MacCutchan12-Dec-09 3:08 
GeneralRe: Using Methods within a Switch Case Pin
DevonDaDude15-Dec-09 18:20
DevonDaDude15-Dec-09 18:20 
AnswerRe: Using Methods within a Switch Case Pin
OriginalGriff11-Dec-09 23:01
mveOriginalGriff11-Dec-09 23:01 
AnswerRe: Using Methods within a Switch Case Pin
PIEBALDconsult12-Dec-09 3:59
mvePIEBALDconsult12-Dec-09 3:59 
GeneralRe: Using Methods within a Switch Case Pin
DevonDaDude12-Dec-09 15:45
DevonDaDude12-Dec-09 15:45 
QuestionUse of << and >> [modified] Pin
Joe Rozario11-Dec-09 19:16
Joe Rozario11-Dec-09 19:16 
AnswerRe: Use of << and >> Pin
Abhinav S11-Dec-09 19:56
Abhinav S11-Dec-09 19:56 
AnswerRe: Use of << and >> [modified] Pin
DaveyM6911-Dec-09 21:27
professionalDaveyM6911-Dec-09 21:27 
GeneralRe: Use of << and >> Pin
Joe Rozario11-Dec-09 21:46
Joe Rozario11-Dec-09 21:46 
GeneralRe: Use of << and >> Pin
DaveyM6911-Dec-09 22:37
professionalDaveyM6911-Dec-09 22:37 
GeneralRe: Use of << and >> Pin
Joe Rozario16-Dec-09 17:59
Joe Rozario16-Dec-09 17:59 
AnswerRe: Use of << and >> Pin
harold aptroot11-Dec-09 21:45
harold aptroot11-Dec-09 21:45 
QuestionHow to show multiple crystal reports in single Report Viewer. [modified] Pin
sher_azam11-Dec-09 18:35
sher_azam11-Dec-09 18:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.