Advertisement
Guest User

class use: School C#

a guest
Nov 23rd, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. class Program
  2. {
  3. public static void Main(string[] args)
  4. {
  5. int nationalAvg;
  6. School s1 = new School("School number 1", "Tel-Aviv", 81);
  7. School s2 = new School("School number 2", "Beer-Sheva", 81);
  8. nationalAvg = (s1.getPercent() + s2.getPercent()) / 2;
  9. if(s1.getPercent() >= 80 && s1.getPercent() > nationalAvg)
  10. {
  11. s1.setCategory(1);
  12. }
  13. else if(s1.getPercent() >= 70 && s1.getPercent() >= nationalAvg)
  14. {
  15. s1.setCategory(2);
  16. }
  17. if (s2.getPercent() >= 80 && s2.getPercent() > nationalAvg)
  18. {
  19. s2.setCategory(1);
  20. }
  21. else if (s2.getPercent() >= 70 && s2.getPercent() >= nationalAvg)
  22. {
  23. s2.setCategory(2);
  24. }
  25. if(s1.getCategory() == s2.getCategory())
  26. {
  27. Console.WriteLine("The schools are in the same category");
  28. }
  29. s1.pInfo();
  30. s2.pInfo();
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement