Question: 1. Create a class called Computer with a constructor having three arguments: memory, an integer, screen, a string and CPU, an optional argument with
1. Create a class called Computer with a constructor having three arguments: memory, an integer, screen, a string and CPU, an optional argument with the default value 'Intel'. Any object of the Computer class is defined by three instance variables: self.memory, self.screen and self.CPU. They take the values of the arguments. 2. Create a method price that returns the price of a computer, i.e., an integer value. This price is calculated as follows: The base price is $400. If there is strictly more that 8GB of memory and up to 16GB inclusive, the price is increased by $120. . If there is strictly more than 16GB of memory, the price is increased by $240. . If the screen is 'retina' the price is increased by $100. If the CPU is 'AMD' the price is decreased by $80. 3. Outside the class, create a Computer object with a memory of 12GB, a retina screen and an AMD processor. Print its price by calling the price mehtod on this object.
Step by Step Solution
3.52 Rating (169 Votes )
There are 3 Steps involved in it
Python version 38 class Computer def initself memory screen CPUIntel Constructor that takes m... View full answer
Get step-by-step solutions from verified subject matter experts
