Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Wallpaper
- Dim RoomPerimeter As Single
- Dim RollWidth As Single
- Dim RollLength As Single
- Dim WallDrop As Single
- 'Definition of four required values
- Sub Main()
- Console.WriteLine("Welcome to the application. Please press Enter to continue.")
- Console.ReadLine()
- 'A little bit of a start screen.
- Console.WriteLine("Please enter, in metres, the perimeter of the room you wish to wallpaper.")
- RoomPerimeter = Console.ReadLine
- 'User defines the RoomPerimeter value here.
- While RoomPerimeter < 1
- Console.WriteLine("That's not a valid perimeter, please correct any mistakes you may have made.")
- RoomPerimeter = Console.ReadLine
- End While
- 'Loop that will refuse to proceed further down the program until a valid RoomPerimeter value is entered.
- Console.WriteLine("Please enter, in metres, the width of your wallpaper rolls.")
- RollWidth = Console.ReadLine
- 'User defines the RollWidth value here.
- While RollWidth < 0.1
- Console.WriteLine("That's not a valid roll width, please correct any mistakes you may have made.")
- RollWidth = Console.ReadLine
- End While
- 'Loop that refuses to progress until RollWidth is a valid value
- Console.WriteLine("Please enter, in metres, the length of your wallpaper rolls.")
- RollLength = Console.ReadLine
- 'User defines the RollLength value here.
- While RollLength < 1
- Console.WriteLine("That's not a valid roll length, please correct any mistakes you may have made.")
- RollLength = Console.ReadLine
- End While
- 'Confirmation that RollLength is valid (ie: greater than 0), with looping refusal if the RollLength value is still invalid.
- Console.WriteLine("Please enter, in metres, the 'drop' of the walls you are wallpapering.")
- WallDrop = Console.ReadLine
- 'User defines the WallDrop value here.
- While WallDrop < 0.1
- Console.WriteLine("That's not a valid wall drop, please correct any mistakes you may have made.")
- WallDrop = Console.ReadLine
- End While
- 'Confirmation that WallDrop is valid (ie: greater than 0) with refusal loop
- Dim X As Single
- Dim Y As Single
- Dim Z As Single
- Dim Z2 As Single
- 'Two values used to determine how many rolls the user will need.
- X = RoomPerimeter / RollWidth
- Y = RollLength / (WallDrop + 0.1)
- Z2 = (X / Y)
- Z = Math.Round((X / Y) + 0.5)
- 'The calculations used to get the result, 'Z'.
- Console.WriteLine(X)
- Console.WriteLine(Y)
- Console.WriteLine(Z2)
- Console.WriteLine(Z)
- Console.WriteLine("You will need this many rolls to wallpaper the room.")
- Console.ReadLine()
- 'The result, complete with a pause so the user can write down how many rolls they will need
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment