Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 1

Python version 38 class Computer def initself memory screen CPUIntel Constructor that takes m... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Java Programming, Comprehensive Version

Authors: Y. Daniel Liang

10th Edition

133761312, 978-0133761313

More Books

Students also viewed these Programming questions

Question

Is there administrative support?

Answered: 1 week ago

Question

List the three solutions for developing a more playful attitude.

Answered: 1 week ago

Question

Distinguish between hyperstress and distress.

Answered: 1 week ago