Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
186 views
in Programming by (15 points)

Elon Musk is on the expedition of sending another tesla with a robot this time to space. He has released his robot’s name as “IronRobot” but wants his robot’s version to be confidential and cannot be accessed directly. IronRobot’s initial version is 22 and the current version is being set only by the developer by using objects. It should not be accessed directly and should be encapsulated.

  1. Create class for Robot to read name and version
  2. Version should be a private variable
  3. Display the initial and current version of IronRobot 

Input Format:

Read the current version,version

Constraint:

22<version<=100

Output Format:

Robot name

Initial Version

Current Version

Error if trying to access the private variable - version directly in code

Sample Input:

23

Sample Output:

IronRobot

22

23

Please log in or register to answer this question.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...