1. Create a class called Computer with a constructor having three arguments: memory, an integer, screen,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
Python version 38 class Computer def initself memory screen CPUIntel Constructor that takes m... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
Bill and Melinda Barns live in Dallas, Texas. Both of them graduated and are working in high paying jobs. Bill loves to control his own investments and has been contributing to a stock account the he...
-
[A] Create a class called Cycle which has two instance integer variables as properties, numberOfWheels and weight. Create a constructor with two parameters, using the same variable names in the...
-
What options would you have when you communicate with the other nearby villages so that your estimate of per-mile costs will be consistent and comparable for your manager? Explain
-
You can choose between two purchases: Machine A or Machine B. Machine A costs $25,000 and has a scrap value of $12,000 after 3 years. Machine B costs $30,000 and has a salvage value of $16,000 after...
-
A space station shaped like a giant wheel has a radius of 100 m and a moment of inertia of 5.00 X 108 kg m2. A crew of 150 is living on the rim, and the stations rotation causes the crew to...
-
List the benefits of activity-based costing. How could these reduce costs?
-
The distribution of the ages of the winners of the Tour de France from 1903 to 2016 is approximately bell-shaped. The mean age is 27.9 years, with a standard deviation of 3.3 years. Use the...
-
Bose Corporation is an organization that specializes in audio equipment that meets virtually any audio challenge. Bose Corporation's audio technologies can be found in home stereos, stadiums, the...
-
Some people feel that a budget is only a guideline, while others believe budgets should be strictly adhered to. What do you think? If you were the GM, what would be your general budget philosophy and...
-
The Jackson independent School District began the year with the following accounts on its Balance Sheet related to property taxes (all amounts are in thousands of dollars). All accounts have normal...
-
Discussing, Developing and Deciding Your Project Scope Statement Work with your supervisor at your Host Company, to identify a project that you can work on, i.e. a defined piece of work that you can...
-
Assume r* = 2%; inflation in year 1 = 2%; inflation in year 2 = 4%; MRP = 0.1%(t). What is the yield on a 2-year Treasury?
-
14 1. Using a binomial interest rate tree, fill out the table below. (100 points) 15 The first four columns are inputs. P0.5 is the price of a six-month zero-coupon bond. P1 and CR 16 respectively,...
-
What is the amount of risk reduction resulting from the lack of perfect positive correlation between the various assets groups?
-
12 International investments. In recent years many UK-based MNCs have increased their investments in foreign securities, which are not as susceptible to the negative shocks of the UK market. Also,...
-
Teaching the Conventions of Academic Discourse A study of scholarly research articles from six disciplines provides insights about academic writing that composition instructors can use to prepare...
-
Tersise and AC) and AG) matrica be defined as Let the EC) Lecture 16 Suppose A IR"*" is Invertible Show that E) A (J-1) AG for s=1..... n-l
-
Test your confidence in the following Project Decisions: SI. # Question 01 02 03 04 05 06 07 08 09 10 How many years did it take to construct the largest Egyptian Pyramid- Pyramid of Cheops? When was...
-
Write the following method that tests whether a two-dimensional array has four consecutive numbers of the same value, either horizontally, vertically, or diagonally.public static...
-
If you know the balance and the annual percentage interest rate, you can compute the interest on the next monthly payment using the following formula: interest = balance * (annualInterestRate/1200)...
-
Listing 28.14, NineTail.java, presents a solution for the nine tails problem. Revise this program for the 4 * 4 16 tails problem. Note that it is possible that a solution may not exist for a starting...
-
Use the existing pattern in this chapter to model a student email account. a. Draw a class diagram of using Any Account pattern. b. Generate a significant use case for this context. c. Map the use...
-
How do you apply a stable analysis pattern to a particular context?
-
What characteristics do you check for each BO?
Study smarter with the SolutionInn App