- 2
is there anyone who can help me to solv a task???
you have to write code for the below mentioned classes and implement their relationship with each other. 2. As Cal_Distance() function will implement the same formula for all inner and outer planets, so you are required to implement this function in Planet class only. 3. You are also required to calculate the distance of Mercury from Sun in Kilometers. 4. 1. Class Planet: Attribute: Name: string Radius: double Distance: double Methods/Operations/Getters/Setters: Print: void Cal_Distance: double
2 Respuestas
0
2. Class Inner_Planet:
Methods/Operations/Getters/Setters:
Print: void
Cal_Distance: double
3. Class Mercury:
Methods/Operations/Getters/Setters:
Print: void
Cal_Distance: double
Important points:
• Your program should be able to create an object for Mercury class having a Name, Radius and Distance without creating an explicit object of Planet class.
• All Planet attributes should be directly accessible to Inner_Planet and Mercury and should not be accessible publically.
• Definition of both functions, Print() and Cal_Distance(), should be included in Planet class. Override these functions in Inner_Planet and Mercury classes.
• Display the values of attributes and calculated distance as shown in sample output.
Note:
1. Radius of Mercury is 2440 KM.
2. Use Member Initialization list where needed.
0
above description n cmnt is full query of my requirmnt