In: Computer Science
Complete this programming problem in this assignment by using Microsoft Visual Studio Suite. Compile your solutions for each problem solved in a Word or Google document which includes (a) the pseudocode, (b) the C# codes and (c) the execution result (screen capture just the answer part using Snipping Tool, avoiding non-related or blank spaces). Notice for readability, that the (a) & (b) are in text mode and the (c) is in image mode. Use proper titles and wording in the results, such as Console.WriteLine("The total change to be made is {0:C}.", change); so that the results could be easily understood by a third party reader.
Question: Write a C# program to compute the profit made for
selling goldfish flakes online. The wholesale cost for a case of
24-boxes is $118. The price for sale with shipping charge is $9.59
per box. Shipping cost is $1.35 per box. The onlinelisting charge
is 12% of the customer payment. The payment processing cost is 4%
of the payment. Compute and display the following figures for
selling 25 cases of the products: the total wholesale cost for 25
cases; the total revenue for 25 cases of 24 boxes per case, the
total listing cost, the total payment processing cost, and the
total profit made.
(a)Pseudo Code:
Function problem(input: customerpayment)
Var wholesalecost=25*118;
Var revenue= customerpayment+(9.59+1.35)*(118/24)*25;
Var llistcost=0.12*customerpayment;
Var paymentcost=0.04*customerpayment;
Var sprice= revenue-(listcost+paymentcost);
If sprice>wholesalecost :profit (sprice-wholesalecost)
Else if sprice<wholesalecost: loss(wholesalecost-sprice)
Else print(‘No loss or Gain’)
(b)C# Code:
using System;
public class Problem
{
public static void Main()
{
double wholesalecost, revenue, listcost, paymentcost, customerpayment,sprice,plamt;
wholesalecost= 25 * 118;
Console.Write("\n\nWholesalecost : {0}\n\n", wholesalecost);
Console.Write("Input Customer Payment: ");
customerpayment= Convert.ToDouble(Console.ReadLine());
revenue= customerpayment+(9.59+1.35)*(118/24)*25;
Console.Write("\n\nTotalRevenue : {0}\n\n", revenue);
listcost=0.12*customerpayment;
Console.Write("\n\nTotalListingCost : {0}\n\n", listcost);
paymentcost=0.04*customerpayment;
Console.Write("\n\nTotalPaymentProcessingCost : {0}\n\n", paymentcost);
sprice=revenue-(listcost+paymentcost);
if(sprice>wholesalecost)
{
plamt = sprice-wholesalecost;
Console.Write("\nYour profit amount : {0}\n", plamt);
}
else if(wholesalecost>sprice)
{
plamt = wholesalecost-sprice;
Console.Write("\nYour loss amount : {0}\n", plamt);
}
else
{
Console.Write("\nYou are running in no profit no loss condition.\n");
}
}
}