swift programming

Define a class named The class contains the following public elements: A Double stored property that contains the amount of money (dollars and cents) described by an object of the class. A read-only, computed property. The getter calculates and returns the minimum number of U.S. bills and coins that add up to the amount in the stored property. The return value is an Int array of length 9 that contains (beginning with index 0 of the array) the number of $50 bills, $20 bills, $10 bills, $5 bills, $1 bills, 25¢ coins, 10¢ coins, 5¢ coins, and 1¢ coins. For example, if the stored property contains 47.23, the return value is: [0, 2, 0, 1, 2, 0, 2, 0, 3] However, if the amount in the stored property is negative, return nil. An initializer with one Double parameter; it assigns the parametric value to the stored property. In the playground (outside of the class): Define 6 variables of type Cash. Initialize one to a negative number; initialize another to zero; initialize the remaining variables to “random-ish” amounts in the range of 0 < amount <= 100 Print the values of the variables to the debug area.



Answered by xjkkjd

We have mentors from

Contact support