Advertisement
CardinalGaming

Module 4 Example 2

Sep 13th, 2021
1,273
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Module Module1
  2.  
  3.     Sub Main()
  4.         'COMPUTE THE 5% DISCOUNT FROM A GIVEN PRICE
  5.        Dim price As Double
  6.         Dim discount As Double
  7.         Dim discount_percentage As Double
  8.  
  9.         Console.Write("Please enter the Item price: $")
  10.         price = Console.ReadLine
  11.  
  12.         Console.Write("Enter the discount: ")
  13.         discount_percentage = Console.ReadLine
  14.  
  15.         'discount_percentage = discount_percentage / 100
  16.        discount_percentage /= 100
  17.  
  18.         discount = price * discount_percentage
  19.  
  20.         Console.WriteLine("The discount for the price of $" & price _
  21.             & " is $" & discount)
  22.         Console.WriteLine("The final price for the item is: $" & price - discount)
  23.  
  24.         Console.ReadKey()
  25.     End Sub
  26.  
  27. End Module
  28.  
Advertisement
RAW Paste Data Copied
Advertisement