0% found this document useful (0 votes)
77 views

C# Console - Else If Example

The document contains code for a C# program that asks the user to input their quarterly sales figures, calculates the total sales, average sales, and commission based on the total. The program outputs the total sales, average sales, and calculated commission.

Uploaded by

chinkee026
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

C# Console - Else If Example

The document contains code for a C# program that asks the user to input their quarterly sales figures, calculates the total sales, average sales, and commission based on the total. The program outputs the total sales, average sales, and calculated commission.

Uploaded by

chinkee026
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace Assignment1 { class Program { static void Main(string[] args) { double sale1, sale2, sale3, sale4, total, ave, com; Console.Write("Enter First Quarter Sale : "); sale1 = Convert.ToDouble(Console.ReadLine()); Console.Write("Enter Second Quarter Sale : "); sale2 = Convert.ToDouble(Console.ReadLine()); Console.Write("Enter Third Quarter Sale : "); sale3 = Convert.ToDouble(Console.ReadLine()); Console.Write("Enter Fourth Quarter Sale : "); sale4 = Convert.ToDouble(Console.ReadLine()); total = sale1 + sale2 + sale3 + sale4; ave = total / 4; Console.WriteLine("===================================="); Console.WriteLine(); if (total >= 5000 && total <= 10000) com = total * 0.10; else if (total > 10000 && total <= 20000) com = total * 0.15; else if (total > 20000) com = total * 0.20; else com = 0.00; Console.WriteLine("Total Sale : " + total.ToString()); Console.WriteLine("Average Sale : " + ave.ToString()); Console.WriteLine("Commission : " + com.ToString()); Console.ReadLine(); } } }

You might also like