Guest User

Untitled

a guest
Dec 11th, 2019
86
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace IOOP
  8. {
  9. class Car
  10. {
  11. double speed = 0, acceleration = 5.0;
  12. string make;
  13. int year;
  14.  
  15. public Car(string carmake, int caryear)
  16. {
  17. make = carmake;
  18. year = caryear;
  19. }
  20.  
  21. public double getSpeed()
  22. {
  23. return speed;
  24. }
  25.  
  26. public void accelerate()
  27. {
  28. speed += acceleration;
  29. }
  30.  
  31. public void brake()
  32. {
  33. if (speed < acceleration)
  34. {
  35. speed = 0;
  36. }
  37. else
  38. {
  39. speed -= acceleration;
  40. }
  41.  
  42. }
  43.  
  44. public void brake(float brakespeed)
  45. {
  46. if (speed < brakespeed)
  47. {
  48. speed = 0;
  49. }
  50. else
  51. {
  52. speed -= brakespeed;
  53. }
  54.  
  55. }
  56.  
  57.  
  58. }
  59.  
  60.  
  61.  
  62. }
RAW Paste Data