Advertisement
wis3_guy

Vehicle Class

Apr 28th, 2013
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace VehicleGUI
  7. {
  8. public class Vehicle
  9. {
  10. //Members
  11. public string vin;
  12. public string make;
  13. public string model;
  14. public string year;
  15. public double mileage;
  16. public double mpg;
  17.  
  18. public Vehicle()
  19. {
  20. vin = "123456";
  21. make = "Ford";
  22. model = "Taurus";
  23. year = "1999";
  24. mileage = 25000;
  25. mpg = 35;
  26.  
  27. }
  28.  
  29. public Vehicle(string newVin, string newMake, string newModel, string newYear, double newMileage, double newMpg)
  30. {
  31. vin = newVin;
  32. make = newMake;
  33. model = newModel;
  34. year = newYear;
  35. mileage = newMileage;
  36. mpg = newMpg;
  37.  
  38. }
  39.  
  40. //Properties
  41. public string Vin
  42. {
  43. get { return vin; }
  44. set { vin = value; }
  45. }
  46.  
  47. public string Make
  48. {
  49. get { return make; }
  50. set { make = value; }
  51. }
  52.  
  53. public string Model
  54. {
  55. get { return model; }
  56. set { model = value; }
  57. }
  58.  
  59. public string Year
  60. {
  61. get { return year; }
  62. set { year = value; }
  63. }
  64.  
  65. public double Mileage
  66. {
  67. get { return mileage; }
  68. set { mileage = value; }
  69.  
  70. }
  71.  
  72. public double Mpg
  73. {
  74. get { return mpg; }
  75. set { mpg = value; }
  76. }
  77.  
  78. public bool is_under_50K()
  79. {
  80. if (mileage < 50000)
  81. return true;
  82.  
  83. else return false;
  84. }
  85.  
  86. public bool is_good_mpg()
  87. {
  88. if (mpg > 35)
  89. return true;
  90. else return false;
  91.  
  92. }
  93.  
  94. }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement