using System;
using System.Collections.Generic;
namespace App
{
class Program
{
public static void Main()
{
Console.Write("Enter the first name: ");
string firstName = Console.ReadLine();
Console.Write("Enter the last name: ");
string lastName = Console.ReadLine();
displayGreetingMessage(firstName +" "+ lastName);
displayGreetingMessage(firstName, lastName);
Console.Write("Enter the total items: ");
float totalItems = float.Parse(Console.ReadLine());
Console.Write("Enter the price: ");
float price = float.Parse(Console.ReadLine());
Console.WriteLine("The total price of an item (price = 10): {0}", computeTotalPriceItem(totalItems));
Console.WriteLine("The total price of an item (price = {0}): {1}", price, computeTotalPriceItem(totalItems, price));
Console.ReadLine();
}
private static void displayGreetingMessage(string fullName)
{
Console.WriteLine("Welcome, {0}", fullName);
}
private static void displayGreetingMessage(string firstName, string lastName)
{
Console.WriteLine("Welcome, {0} {1}", firstName, lastName);
}
public static float computeTotalPriceItem(float totalItems)
{
return totalItems * 10.0f;
}
public static float computeTotalPriceItem(float totalItems, float price)
{
return totalItems * price;
}
}
}
Comments