Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help editing code so it dispays: double int 0.06 tax on $79.95 is $4.80 dou

ID: 3545113 • Letter: N

Question

Need help editing code so it dispays:


double int

0.06 tax on $79.95 is $4.80

double double

0.06 tax on $79.95 is $.480


using System;
public class TaxCalculation
{
    public static void Main()
    {
        
        TaxCalculate(79.95, 0.06);
        TaxCalculate(79.95, 6);
    }
    
    public static void TaxCalculate(double salePrice,
       double taxRate){
    Console.WriteLine("The tax using doubles is {0}.", (salePrice * taxRate).ToString("C"));
                }
    
     public static void TaxCalculate(double salePrice, int percentage){

      double taxRate = (double) percentage * .01;

   Console.WriteLine("The tax using a double and integer is {0}.", (salePrice * taxRate).ToString("C"));

                }

}

Explanation / Answer

Hello, here is the answer for your question. highlighted lines are modifed/added.


using System;

public class TaxCalculation

{

public static void Main()

{

TaxCalculate(79.95, 0.06);

TaxCalculate(79.95, 6);

Console.ReadKey();

}


public static void TaxCalculate(double salePrice, double taxRate){

Console.WriteLine("double double");

Console.WriteLine(taxRate+" tax on $"+salePrice+" is {0}", (salePrice * taxRate).ToString("C"));

}

public static void TaxCalculate(double salePrice, int percentage){

double taxRate = (double) percentage * .01;

Console.WriteLine("double int");

Console.WriteLine(taxRate+ " tax on $" + salePrice + " is {0}", (salePrice * taxRate).ToString("C"));

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote