Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.35 KB | None | 0 0
  1. #include <QCoreApplication>
  2. #include <QDebug>
  3. #include <QString>
  4. class Target
  5. {
  6. protected:
  7.     QString m_targetType;
  8.     QString m_attribute;
  9.     double m_velocity;
  10.     double m_range;
  11.     double m_elevationAngle;
  12.     double m_azimuthAngle;
  13. public:
  14.     Target(QString targetType = "Unknown",
  15.            QString attribute = "Unknown",
  16.            double velosity = 0,
  17.            double range = 0,
  18.            double elevetionAngle = 0,
  19.            double azimuthAngle = 0)
  20.         : m_targetType(targetType), m_attribute(attribute), m_velocity(velosity), m_range(range),
  21.           m_elevationAngle(elevetionAngle), m_azimuthAngle(azimuthAngle)
  22.     {
  23.         /*m_targetType = targetType;
  24.         m_attribute = attribute;
  25.         m_velocity = velosity;
  26.         m_range = range;
  27.         m_elevationAngle = elevetionAngle;
  28.         m_azimuthAngle = azimuthAngle;*/
  29.     }
  30.     void setTargetType(QString targetType)
  31.     {
  32.         m_targetType = targetType;
  33.     }
  34.     void getTargetInformation()
  35.     {
  36.         qDebug() << "Общие характеристики цели";
  37.         qDebug() << "Тип цели" << m_targetType << "Признак свой-чужой" << m_attribute << "Скорость" << m_velocity << "Дальность до цели" << m_range << "Угол места" << m_elevationAngle << "Угол азимута" << m_azimuthAngle;
  38.     }
  39.     void setFriendOrStranger(QString attribute) {
  40.         if (!attribute.compare("Friend")||!attribute.compare("Stranger"))
  41.             m_attribute = attribute;
  42.         else
  43.             qDebug() << "Incorrect attribute";
  44.     }
  45. };
  46.  
  47. class Nurs : public Target
  48. {
  49. private:
  50.     QString m_Nursname;
  51.     double m_caliber;
  52.     QString m_filler;
  53.     int m_hazardRank = 2;
  54. public:
  55.     Nurs(QString targetType = "",
  56.          QString attribute = "",
  57.          double velocity = 0,
  58.          double range = 0,
  59.          double elevetionAngle = 0,
  60.          double azimuthAngle = 0,
  61.          QString Nursname = "",
  62.          double caliber = 0,
  63.          QString filler = "") : Target (targetType, attribute, velocity, range, elevetionAngle, azimuthAngle),
  64.         m_Nursname(Nursname), m_caliber(caliber), m_filler(filler)
  65.     {
  66.         /*m_Nursname = Nursname;
  67.         m_caliber = caliber;
  68.         m_filler = filler;*/
  69.     }
  70. };
  71.  
  72. class Plane : public Target
  73. {
  74. private:
  75.     QString m_planeName;
  76.     double m_maxVelocity;
  77.     QString m_type;
  78.     int m_hazardRank = 3;
  79. public:
  80.     Plane(QString targetType = "",
  81.           QString attribute = "",
  82.           double velocity = 0,
  83.           double range = 0,
  84.           double elevetionAngle = 0,
  85.           double azimuthAngle = 0,
  86.           QString planeName = "",
  87.           double maxVelocity = 0,
  88.           QString type = "") : Target (targetType, attribute, velocity, range, elevetionAngle, azimuthAngle),
  89.         m_planeName(planeName), m_maxVelocity(maxVelocity), m_type(type)
  90.     {
  91.  
  92.     }
  93. };
  94.  
  95. class BPLA : public Target
  96. {
  97. private:
  98.     QString m_BPLAname;
  99.     QString m_type;
  100.     int m_hazardRank = 4;
  101. public:
  102.     BPLA(QString targetType = "",
  103.          QString attribute = "",
  104.          double velocity = 0,
  105.          double range = 0,
  106.          double elevetionAngle = 0,
  107.          double azimuthAngle = 0,
  108.          QString BPLAname = "",
  109.          QString type = "") : Target (targetType, attribute, velocity, range, elevetionAngle, azimuthAngle),
  110.         m_BPLAname(BPLAname), m_type(type)
  111.     {
  112.  
  113.     }
  114.     void getInformation()
  115.     {
  116.  
  117.     }
  118.  
  119. };
  120.  
  121. class Rocket : public Target
  122. {
  123. private:
  124.     QString m_rocketName;
  125.     QString m_filler;
  126.     double m_maxVelocity;
  127.     double m_maxHieght;
  128.     int m_hazardRank = 1;
  129. public:
  130.     Rocket(QString targetType = "",
  131.            QString attribute = "",
  132.            double velocity = 0,
  133.            double range = 0,
  134.            double elevetionAngle = 0,
  135.            double azimuthAngle = 0,
  136.            QString rocketName = "",
  137.            QString filler = "",
  138.            double maxVelocity = 0,
  139.            double maxHieght = 0) : Target (targetType, attribute, velocity, range, elevetionAngle, azimuthAngle),
  140.         m_rocketName(rocketName), m_filler(filler), m_maxVelocity(maxVelocity), m_maxHieght(maxHieght)
  141.     {
  142.  
  143.     }
  144.     void getInformation()
  145.     {
  146.  
  147.     }
  148.  
  149. };
  150.  
  151. int main()
  152. {
  153.     Rocket R_9M83("Rocket", "Friendly", 2000, 2000, 30, 20, "R_9M83", "Бризант", 5000, 7000);
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement