Question #187786


A book store needs to calculate the price of an order from the book price and the number of books that were ordered. Add tax (15%) and a shipping charge of R12.50 per book. (The tax is calculated on the sum of the total book price and the shipping price). Display the order price.



Expert's answer

Module Module1


    Sub Main()
        'get the number of books that were ordered
        Console.Write("Enter the number of books that were ordered: ")
        Dim numberBooks As Integer = Integer.Parse(Console.ReadLine())
        'get the book price
        Console.Write("Enter the book price: ")
        Dim bookPrice As Double = Double.Parse(Console.ReadLine())
        'Add tax (15%) and a shipping charge of R12.50 per book. 
        '(The tax is calculated on the sum of the total book price and the shipping price). 
        Dim subtotalOrderPrice As Double = numberBooks * bookPrice
        Dim shippingCharge As Double = numberBooks * 12.5D
        Dim tax As Double = (subtotalOrderPrice + shippingCharge) * 0.15
        Dim orderPrice As Double = subtotalOrderPrice + shippingCharge + tax
        'Display the order price.
        Console.WriteLine("The subtotal: R{0}", subtotalOrderPrice)
        Console.WriteLine("The shipping charge of R12.50 per book: R{0}", shippingCharge)
        Console.WriteLine("The tax: R{0}", tax)
        Console.WriteLine("The order price: R{0}", orderPrice)


        Console.ReadLine()
    End Sub


End Module

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS