Answer to Question #185493 in Visual Basic for tafadzwa

Question #185493

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 R 12.50 per book. The tax is calculated on the sum of the total book price and the shipping price. Book price R502.50 and number of books 3 .Display the order price


1
Expert's answer
2021-04-26T02:59:33-0400
Module Module1


    Sub Main()
        'Read the the book price
        Console.Write("Enter the book price: ")
        Dim bookPrice As Double = Double.Parse(Console.ReadLine())
        ''Read the number of book
        Console.Write("Enter the number of book: ")
        Dim numberBook As Integer = Integer.Parse(Console.ReadLine())
        Dim subTotal As Double = bookPrice * numberBook
        'The tax is calculated on the sum of the total book price and the shipping price
        'Add tax 15 % and a shipping charge of R 12.50 per book. 
        subTotal += numberBook * 12.5D
        Dim tax As Double = subTotal * 0.15D
        Dim orderPrice As Double = subTotal + tax
        Console.WriteLine("Subtotal: R" + orderPrice.ToString("C"))
        Console.WriteLine("Tax: R" + tax.ToString("C"))
        Console.WriteLine("Order price: R" + orderPrice.ToString("C"))
        
        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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS