C# COIS1020H Question 4 Compute Taxes

Feb 3rd, 2012
Studypool Tutor
Nottingham Trent University
Price: $15 USD

Tutor description

Q4: Write a C# program that has a Main method and a user-defined method called ComputeTax. The Main method asks the user to enter an item's cost (double) and the percentage sales tax (double). The item cost is a positive number and the percentage sales tax is a number between 0.0 and 1.0. Main then calls the method named ComputeTax which has two parameters that will hold the item's cost and percentage sales tax as arguments. The method returns the overall price of the item (double) which should be output by Main. For example, if an item's cost is $3.50 and percentage sales tax is 10% (entered as 0.1), then the value returned by the ComputeTax (and printed by Main) is $3.85. The method header for ComputeTax should look like: public static double ComputeTax (double itemCost, double perTax) **** Note: On this assignment you can assume the correct datatype: that is, if the program requests a double, you can assume that the user will input a double, etc. You do need to check that the data is

Word Count: 94
Showing Page: 1/2
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace CSTaxes{ class Program { public static double ComputeTax(double itemCost, double perTax) { if (perTax >= 0.0 && perTax <= 1.0) { return itemCost + itemCost * (perTax / 100); } throw new Exception("Percentage sales tax out of range (0.0 to 0.1)!"); } static void Main(string[] args) {

Review from student

Studypool Student
" awesome work thanks "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1822 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors