Class Example | Swift & IOS Tutorials

Swift & IOS Application Development Tutorials

Example 1:

Introduction the Swift and Xcode Playground

Using playgrounds, implement the classes shown in the diagram below.

Width and height will be in meters.

For this example;

* Create StudyRoom and ClassRoom instances.

* Classroom instance will also initialize an equipment dictionary. This [String: Double] dictionary will hold the name and the price for each equipment ( as an example; computer: 3500, projector: 2000 etc.) There should be at least 5 equipments in a classroom.

* Print meaningful descriptions for each instance. All properties should be visible in the description. Area information should be included in the description.

* Classroom instances should also calculate and display the total cost of the equipments present in the class.

* calculateArea() functions should calculate the area of the room in square meters.



Leave a Reply

Your email address will not be published. Required fields are marked *