Create a console-based program named Commission. Its Main() method calls two oth
ID: 3650913 • Letter: C
Question
Create a console-based program named Commission. ItsMain() method calls two other methods. Th e first called
method should ask a salesperson for the dollar value of
daily sales and return the entered value to the Main()
method. (Assume all sales are in whole dollars.) Th e
second called method should calculate the salesperson
Explanation / Answer
using System; using System.Collections.Generic; using System.Linq; using System.Text; public class Program { public static int getDailySales() { string str; str = "Enter daily sales amount: $"; Console.Write(str); str = Console.ReadLine(); return int.Parse(str); } public static double calCommission(int sales) { if (sales >= 0 && sales < 1000) { return sales * .03; } else if (sales >= 1000 && sales < 3000) { return sales * .04; } else return sales * .05; } public static void Main(string[] args) { string line; int sold; double commission; line = "Commission calculation "; Console.Write(line); sold = getDailySales(); commission = calCommission(sold); line="Form $"+sold+" sells, your commission is $"+commission+"."; Console.WriteLine(line); } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.