johan s

johan s

  • NA
  • 8
  • 2.8k

Problem white foodVATRate

Jan 18 2012 5:19 AM
Hi.

  using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Uppgift_1
{
    class Product
    {
        private string Produuct;
        private decimal Price;
        private decimal Vat;
        private bool Food;
        private int Count;

        private const decimal foodVATRate = 0.12m, otherVATRate = 0.25m;
        private decimal Finalprice;
        private decimal Rate;

        public void Readinput()
        {         
            Console.Write("\n\nWhat is the product you want:  ");
            Produuct = Console.ReadLine();

            Console.Write("Unit price:  ");
            decimal.TryParse(Console.ReadLine(), out Price);

            Console.Write("Food item y/n:  ");
            char answer = char.Parse(Console.ReadLine());
            if ((answer == 'y') || (answer == 'Y'))
                Food = true;
            else
                Food = false;
           
            Console.Write("Count:  ");
            int.TryParse(Console.ReadLine(), out Count);

            Finalprice = (decimal)(Price * Count);
           
        }
       
        private void cal()
        {
            char answer = char.Parse(Console.ReadLine());
            if ((answer == 'y') || (answer == 'Y'))
                Vat = foodVATRate;
            else
                Vat = otherVATRate;

            Rate = Finalprice * Vat;
        }
 
        public void PrintRecept()
        {
            Console.Write("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++");
            Console.Write("\n\nThe product you want is: " + Produuct);
            Console.Write("\nThe price: "+ Price);
            Console.Write("\nFood item: "+Food);
            Console.Write("\nCount: "+Count);
            Console.Write("\n\nTotal price: "+Finalprice);
            Console.Write("\nVAT at: " +Rate);
            Console.Write("\n\n++++++++++++++++++++++++++++++++++++++++++++++++++++++");
        }
    }

    }
   
Can any way tell my way i don't get any thing in Console.Write("\nVAT at: " +Rate);?

Answers (8)