"""
CD Class for SI@UCF
5/16/13
Sawyer Hood
"""
class CD:

	#Initializes CD object.
	def __init__(self, artist, title, sku, cost):
		self.artist = artist
		self.title = title
		self.sku = sku
		self.cost = cost
	
	#Returns a string that represents a CD object in a readable format.
	def __str__(self):
		return "Sku: "+str(self.sku)+" Artist: "+self.artist+" Title: "+self.title+" Cost: $"+str(self.cost)

	#This method creates a CD based on the object it is called on. In 
  	#particular, the new CD's artist name is the same. The title is the 
  	#same as the original but has "II" appended to it. The cost is 2
  	#dollars more than the original, and the sku is one more than the
  	#original sku
	def make_sequal(self):
		return self.__class__(self.artist, self.title+" II", self.sku+1, self.cost+2)

	#Returns true if the CD object costs less than or equal to value, and
  	#false otherwise.
	def under_cost(self, value):
		if self.cost <= value:
			return True
		else:
			return False

	#Changes the cost of the CD object by discounting it by rate. For
  	#example, if rate = .25 and the cost of the CD is $20.00, this cost
  	#should be reduced to $15.00.
	def discount(self, rate):
		self.cost -= self.cost * rate

def main():
	
	#First CD info
	name = input("Enter artist for the first CD: ")
	title = input("Enter title for the first CD: ")
	sku = int(input("Enter sku for the first CD: "))
	price = float(input("Enter price for the first CD: "))
	one = CD(name, title, sku, price)

	#Second CD info
	name = input("Enter artist for the second CD: ")
	title = input("Enter title for the second CD: ")
	sku = int(input("Enter sku for the second CD: "))
	price = float(input("Enter price for the second CD: "))
	two = CD(name, title, sku, price)

	#Read in discount
	rate = float(input("What discount rate do you want for the first CD?: "))
	if rate < 0 or rate > 1:
		rate = .1

	one.discount(rate)
	three = two.make_sequal()

	#Print out all CD's under $15
	print("Here is information for your CDs under $15.")
	if one.under_cost(15):
		print(one)
	if two.under_cost(15):
		print(two)
	if three.under_cost(15):
		print(three)

main()


