50.2k views
1 vote
// GetData() method accepts order number and quantity // that are used in the Main() method // Price is $3.99 each using System; using static System.Console; class DebugEight1 { static void Main() { int orderNum, quantity; double total; const double PRICE_EACH = 3.99; GetData(orderNum; quantity); total = quantity * PRICEEACH; WriteLine("Order #{0}. Quantity ordered = {1}", orderNum, quantity; WriteLine("Total is {0}", total.ToString("C")); }

User Axeman
by
5.9k points

1 Answer

4 votes

Answer:

The method definition to this question as follows:

Method definition:

//method GetData

public static void GetData(out int order, out int amount)//defining method GetData

{

String val1, val2; //defining String variable

Write("Enter order number "); //message

val1 = ReadLine(); //input value by user

Write("Enter quantity "); //message

val2 = ReadLine(); //input value by user

order = Convert.ToInt32(val1); //convert value in integer and hold in order variable

amount = Convert.ToInt32(val2); //convert value in integer and hold in amount variable

}

Explanation:

In the above C# method definition code a method GetData() is defined in which the GetData() method is a static method, in this method parameter two integer argument "order and amount" is passed, inside a method, two string variable "val1 and val2" is declared that is used to take input by the user and convert the value into integer and store this value in the function parameter variable.

User Jwillmer
by
6.9k points