Guest User

Wallpaper App Thing

a guest
May 9th, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.01 KB | None | 0 0
  1. Module Wallpaper
  2.     Dim RoomPerimeter As Single
  3.     Dim RollWidth As Single
  4.     Dim RollLength As Single
  5.     Dim WallDrop As Single
  6.     'Definition of four required values
  7.  
  8.     Sub Main()
  9.         Console.WriteLine("Welcome to the application. Please press Enter to continue.")
  10.         Console.ReadLine()
  11.         'A little bit of a start screen.
  12.  
  13.         Console.WriteLine("Please enter, in metres, the perimeter of the room you wish to wallpaper.")
  14.         RoomPerimeter = Console.ReadLine
  15.         'User defines the RoomPerimeter value here.
  16.  
  17.         While RoomPerimeter < 1
  18.             Console.WriteLine("That's not a valid perimeter, please correct any mistakes you may have made.")
  19.             RoomPerimeter = Console.ReadLine
  20.         End While
  21.         'Loop that will refuse to proceed further down the program until a valid RoomPerimeter value is entered.
  22.  
  23.         Console.WriteLine("Please enter, in metres, the width of your wallpaper rolls.")
  24.         RollWidth = Console.ReadLine
  25.         'User defines the RollWidth value here.
  26.  
  27.         While RollWidth < 0.1
  28.             Console.WriteLine("That's not a valid roll width, please correct any mistakes you may have made.")
  29.             RollWidth = Console.ReadLine
  30.         End While
  31.         'Loop that refuses to progress until RollWidth is a valid value
  32.  
  33.         Console.WriteLine("Please enter, in metres, the length of your wallpaper rolls.")
  34.         RollLength = Console.ReadLine
  35.         'User defines the RollLength value here.
  36.  
  37.         While RollLength < 1
  38.             Console.WriteLine("That's not a valid roll length, please correct any mistakes you may have made.")
  39.             RollLength = Console.ReadLine
  40.         End While
  41.         'Confirmation that RollLength is valid (ie: greater than 0), with looping refusal if the RollLength value is still invalid.
  42.  
  43.         Console.WriteLine("Please enter, in metres, the 'drop' of the walls you are wallpapering.")
  44.         WallDrop = Console.ReadLine
  45.         'User defines the WallDrop value here.
  46.  
  47.         While WallDrop < 0.1
  48.             Console.WriteLine("That's not a valid wall drop, please correct any mistakes you may have made.")
  49.             WallDrop = Console.ReadLine
  50.         End While
  51.         'Confirmation that WallDrop is valid (ie: greater than 0) with refusal loop
  52.  
  53.         Dim X As Single
  54.         Dim Y As Single
  55.         Dim Z As Single
  56.         Dim Z2 As Single
  57.         'Two values used to determine how many rolls the user will need.
  58.  
  59.         X = RoomPerimeter / RollWidth
  60.         Y = RollLength / (WallDrop + 0.1)
  61.         Z2 = (X / Y)
  62.         Z = Math.Round((X / Y) + 0.5)
  63.         'The calculations used to get the result, 'Z'.
  64.  
  65.         Console.WriteLine(X)
  66.         Console.WriteLine(Y)
  67.         Console.WriteLine(Z2)
  68.         Console.WriteLine(Z)
  69.         Console.WriteLine("You will need this many rolls to wallpaper the room.")
  70.         Console.ReadLine()
  71.         'The result, complete with a pause so the user can write down how many rolls they will need
  72.     End Sub
  73.  
  74. End Module
Advertisement
Add Comment
Please, Sign In to add comment