using System; namespace _2_6 { internal class Program { static void Main(string[] args) { double price, total; Console.WriteLine("******************************"); Console.WriteLine(" Program Laundty Fee "); Console.WriteLine("******************************"); // Input customer details Console.Write("code: "); string CODE = Console.ReadLine(); Console.Write("name: "); string NAME = Console.ReadLine(); Console.Write("Enter quantity of clothes: "); int QUANTITY = int.Parse(Console.ReadLine()); // Variable to store the laundry price double PRICE = 0.0; // Calculate laundry cost if (QUANTITY >= 1 && QUANTITY <= 100) { PRICE = 200.0; // Fixed price for 1-100 pieces } else if (QUANTITY >= 101 && QUANTITY <= 300) { PRICE = 300.0; // Fixed price for 101-300 pieces } else if (QUANTITY >= 301 && QUANTITY <= 500) { PRICE = 500.0; // Fixed price for 301-500 pieces } else if (QUANTITY > 500) { PRICE = 500.0 + (QUANTITY - 500) * 5.0; // Additional charge for pieces above 500 } // Display results Console.WriteLine("\n===== Laundry Service Receipt ====="); Console.WriteLine("Customer Code: " + CODE); Console.WriteLine("Customer Name: " + NAME); Console.WriteLine("Quantity of Clothes: " + QUANTITY + " pieces"); Console.WriteLine("Total Laundry Cost: " + PRICE.ToString("F2") + " THB"); } } }
Standard input is empty
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _2_6 { internal class Program { static void Main(string[] args) { double price, total; Console.WriteLine("******************************"); Console.WriteLine(" Program Laundty Fee "); Console.WriteLine("******************************"); // Input customer details Console.Write("code: "); string CODE = Console.ReadLine(); Console.Write("name: "); string NAME = Console.ReadLine(); Console.Write("Enter quantity of clothes: "); int QUANTITY = int.Parse(Console.ReadLine()); // Variable to store the laundry price double PRICE = 0.0; // Calculate laundry cost if (QUANTITY >= 1 && QUANTITY <= 100) { PRICE = 200.0; // Fixed price for 1-100 pieces } else if (QUANTITY >= 101 && QUANTITY <= 300) { PRICE = 300.0; // Fixed price for 101-300 pieces } else if (QUANTITY >= 301 && QUANTITY <= 500) { PRICE = 500.0; // Fixed price for 301-500 pieces } else if (QUANTITY > 500) { PRICE = 500.0 + (QUANTITY - 500) * 5.0; // Additional charge for pieces above 500 } // Display results Console.WriteLine("\n===== Laundry Service Receipt ====="); Console.WriteLine("Customer Code: " + CODE); Console.WriteLine("Customer Name: " + NAME); Console.WriteLine("Quantity of Clothes: " + QUANTITY + " pieces"); Console.WriteLine("Total Laundry Cost: " + PRICE.ToString("F2") + " THB"); } } }