Question: Fix the code using C# below to show : If the user enters a non-numeric input for the price of an item, they should be

Fix the code using C# below to show :

If the user enters a non-numeric input for the price of an item, they should be prompted to re-enter.

If the user enters a negative input for the price of an item, they should be prompted to re-enter.

Fix the code using C# below to show : If the user

The rest of the code is working but it prompts a read error when entered a non-numeric input or negative input for the price of an item without prompting to re-enter.

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Program { class Program { static void Main(string[] args) { double num,count=0; double Tax=0.00,ship=5.00,sum=0.00; double grandtotal; char line; do{ Console.WriteLine("What is the amount of item : "); do{ num = double.Parse(Console.ReadLine()); if(num3 && count 6 && count 10 && count hat is the amount of the item? - 10 Do you want to enter more purchases? -Y or N y hat is the amount of the item? - -10 Invalid data entered Please re-enter the amount of the item - n Invalid data entered Please re-enter the amount of the item - h Invalid data entered Please re-enter the amount of the item- 5.0 Do you want to enter more purchases? -Y or N y hat is the amount of the item? -? Do you want to enter more purchases? -Y or N n Sales Receipt Total Purchases: Sales Tax: Number of Items Purchased: Shipping charge: $15.00 $1.50 $5.00 $21.5e rand Total: Hit Enter to exit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!