es, a raise_price method that accepts a percentage as an argument to increase the price by percentage a reduce_price method that accepts a percentage as an argument to reduce the price by percentage demonstrate the class in a program to create 2 instances
Q: What differentiates an embedded operating system from an embedded system?
A: To answer the question, we must distinguish between an embedded OS and an embedded system. Embedded…
Q: What is the difference between putting the value 5 into cell number 6 and transferring the contents…
A: To execute each instruction, many stages are required, including fetch opcode, memory read, and…
Q: Is it tough to transition from on-premise servers to an IaaS architecture in terms of governance?
A: Architecture of IaaS: In the IaaS model, cloud providers host infrastructure such as servers,…
Q: What are the many metrics used to measure the reliability of software?
A: Metrics used to measure the reliability of software are: -> Mean Time to Repair -> Rate of…
Q: What steps does the web design process entail? The significance of each step should be clearly…
A: Step 1- Identify your goal Having a creative brief is the first step that will help you craft an…
Q: Make a list of the key advantages and disadvantages of computer use.
A: A computer is a machine having a set of instructions that allows it to do specific tasks and…
Q: ing offer? What are the disadvantages? Indicate which online apps or programs would benefit the most…
A: Asynchronous programming is an approach to performing equal programming where little pieces of…
Q: How about a listing the benefits of using Tables in Databases. write a brief remark on the subject…
A: Databases: Different databases, such as MySQL, SQL Server, Oracle Database, PostgreSQL, Informix,…
Q: Is there a significant disadvantage to a two-tier architecture? How can a multitier client–server…
A: Given: Two-tier client-server architecture: The two-tier architecture is built on the Client-Server…
Q: gle machine situation, how can a computer a sking?
A: Introduction: Below the In a single machine situation, how can a computer accomplish multitasking
Q: Computer science Identify any ten-risks related with IT project management.
A: The answer is given below.
Q: Justify that the Master theorem may be used for solving recurrences of the specified form. Solve the…
A: Master Theorem can be applied to all recurrence relation which are in the form, T(n) =aT(n/b) +cnk
Q: Which type disaster recovery plan (DRP) test requires the whole organization to participate in a…
A: Answer : Dry Run is the correct disaster recovery plan here.
Q: What is the purpose of the: a) processing unit b) programme counter in the von Neumann paradigm?
A: The processing unit of the von Neumann machine comprises of two sections. The first is the…
Q: How about a quick rundown of the compiler and a look at the testability tip?
A: Testability Tip: Testability refers to the ability to undertake an experiment to test a hypothesis…
Q: What is the difference between cohesion and coupling in the context of software design and…
A: The answer is given below.
Q: Explain why it's crucial to understand how operating systems interact with computers.
A: Answer the above question are as follows
Q: What Exactly Is Virtualization, and What Are Its Advantages and Disadvantages?
A: Introduction Virtualization is the method of executing a computer system's virtual instance in a…
Q: In network communication, what role do protocols play? Explain how a web server and a web client…
A: A protocol is a collection of rules and recommendations for data transmission. During the…
Q: pard and scanner are c
A: Solution - In the given question, we have to specify whether keyboard ans scanner are input devices…
Q: Explain the Life Cycle of Software Testing (STLC)
A: Introduction: The Software Testing Life Cycle (STLC) is comprised of six major stages:
Q: What are the fundamental components of an Android mobile application?
A: Introduction: Applications for Android devices or emulators are software packages that contain a…
Q: What are the many types of semaphores and what is a semaphore? Give it a purpose.
A: Introduction: Semaphore is a tool that allows processes to more sophisticatedly synchronise their…
Q: Determine, assess, and compare a variety of back-end compiler architectures?
A: Introduction: The front end and back end of the compiler are separated into two modules. Its…
Q: Identify the data dependencies (i.e., RAW, WAW, WAR) in the following code. Which instructions can…
A: RAW(Read After Write) dependency: I2 I3 ($t1) I1 I4 ($t0) I4 I5 ($t6) I1 I6 ($t0) I5 I7 ($t7)…
Q: ra
A: Computers have an extensive history, some tracing their origins back to the math device. Then again,…
Q: What exactly is structured programming, and why is it necessary? What are the key ideas that make a…
A: Introduction: Structured programming (also known as standard programming) is a programming paradigm…
Q: Distinguish between multiplexing on the basis of frequency and multiplexing on the basis of temporal…
A: Introduction: Division of frequency Multiplexing, often known as FDM, is a method of sending…
Q: Mention the primary programming language or platform that was utilized to create the website.
A: Introduction: I must specify the primary language or platform used to create the website here.
Q: What sparked the evolution of computer programming languages?
A: Introduction: The programming language(like c,c++) is, without a doubt, the most essential unit in…
Q: Information technology What is the core concept of mobile applications ?
A: Introduction: A mobile application, often known as a mobile application or just an app, is a…
Q: Use the incomplete contingency table provided to calculate the missing expected values of (b)…
A: Your answer is given below. Introduction :- Contingency Table: It is the table that displays sample…
Q: icient network possible if it has the following three characteris
A: Below the three things Is a successful and efficient network possible
Q: How does the Compiler go through the many stages?? Is it possible to provide a functional example of…
A: Compiler operates in the various phases each phase transform the source program from one…
Q: What exactly is the distinction between scripting and programming languages?
A: Introduction: All writing languages are also programming languages in their own right. Because…
Q: How many steps does web design entail? In-depth explanations of each phase's importance
A: Introduction: In this section, we must describe each of the following phases in WEB design and why…
Q: What are the arguments against the use of a universal programming language? ге
A: Introduction: For any coder, the C programming language is a great resource.
Q: What Are Mutable Objects and How Do They Work?
A: Introduction: The mutable objects are objects whose value is frequently updated after they have been…
Q: omputer Science Show that the given argument is either valid or invalid using resolution. My prom…
A: The given argument is valid .Below is the explanation:
Q: Why do reporting mechanisms make semantic security issues more likely?
A: Introduction: The reporting mechanisms make semantic security issues more likely :
Q: How can people and information systems collaborate to develop new technologies?
A: Introduction: Explain how humans and information systems work together to bring about technological…
Q: How many steps are involved in developing a website? Justify each step and its significance.
A: Given: In this section, we must describe each of the stages involved in WEB design and why they are…
Q: In what sense does the phrase "software scope" apply here?
A: Software Scope: The scope of a software project is a well-defined boundary that encompasses all of…
Q: What role may nanotechnology play in disease prevention and treatment? What is an example of another…
A: Introduction: Everything from cancer to colds, fractured bones to sunburn, and even deaths like…
Q: Compile a list of 10 hardware capabilities that might be implemented to aid the business's daily…
A: Capabilities of hardware: The hardware capabilities of an object define the system hardware…
Q: design entail? Describe each st
A: Introduction:The duties required in building intranet or internet-hosted websites are referred to as…
Q: Choose one of the listed programming languages and answer the below questions. 1. Python 2. C-sharp…
A: Language : Python 1. Characteristics: Python is one of the most generally involved language in this…
Q: Describe the features and functions of the data management system, which solved standard file…
A: Introduction: Security Management is a term that is used to refer to the process of securing a…
Q: hat are condition variables and how do you use them?What exactly is a monitor? What are condition…
A: Introduction: Method information is loaded into software packages in fixed-sized chunks, and each…
Q: What are some instances of the advantages and disadvantages of applying the concept of least…
A: Introduction: This idea, which is utilised in communication and security, states that users should…
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Write the code in python
Create a CellPhone class. It has 3 attributes: __manufact, __model, __retail_price. It also has the following methods:
- 3 Mutator methods to change the attributes,
- 3 Accessor methods to get the attributes,
- a raise_price method that accepts a percentage as an argument to increase the price by percentage
- a reduce_price method that accepts a percentage as an argument to reduce the price by percentage
demonstrate the class in a program to create 2 instances of CellPhone class, raise the price and reduce the price.
write the phone info to a file using pickle, and then read it from the file and display it on screen.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- Write a program named SalespersonDemo that instantiates objects using classes named Real EstateSalesperson and GirlScout. Demonstrate that each object can use a SalesSpeech() method appropriately. Also, use a MakeSale() method two or three times with each object, and display the final contents of each objects data fields. First, create an abstract class named Salesperson. Fields include first and last names; the Salesperson constructor requires both these values. Include properties for the fields. Include a method that returns a string that holds the Salespersons full name—the first and last names separated by a space. Then perform the following Create two child classes of Salesperson: Real EstateSalesperson and Girl Scout. The Real EstateSalesperson class contains fields for total value sold in dollars and total commission earned (both of which are initialized to 0), and a commission rate field required by the class constructor. The Girl Scout class includes a field to hold the number of boxes of cookies sold, which is initialized to 0. Include properties for every field. Create an interface named ISell able that contains two methods: SalesSpeech() and MakeSale(). In each Real EstateSalesperson and Girl Scout class, implement SalesSpeech() to display an appropriate one- or two-sentence sales speech that the objects of the class could use. In the Real Estatesalesperson class, implement the MakeSale() method to accept an integer dollar value for a house, add the value to the Real EstateSalespersons total value sold, and compute the total commission earned. In the Girl Scout class, implement the MakeSale() method to accept an integer representing the number of boxes of cookies sold and add it to the total field.Create a class named Billing that includes three overloaded computeBill()methods for a photo book store.•• When computeBill() receives a single parameter, it represents the price ofone photo book ordered. Add 8% tax, and return the total due.•• When computeBill() receives two parameters, they represent the price ofa photo book and the quantity ordered. Multiply the two values, add 8% tax,and return the total due.•• When computeBill() receives three parameters, they represent the price of aphoto book, the quantity ordered, and a coupon value. Multiply the quantityand price, reduce the result by the coupon value, and then add 8% tax andreturn the total due.Write a main() method that tests all three overloaded methods. Save theapplication as Billing.java.1. Create a class called Student, with the following attributes/variables:a. studentName (String)b. studentNumber (int)sc. regYear(long)d. faculty(String)e. department(String)2. Add the following methods in Student:a. accessors and mutators for all variablesb. toString methodi. Formulate your toString so that it only shows studentName,studentNumber and faculty3. Create a class called MyFriends, with the following attributes variables:a. studentArray(Student[])4. Add the following methods in MyFriends:a. fillArrayi. Using scanner ask how many students does the user want to inputii. Capture user input for all of his friends(Of course we are assuming all your friends would be similarUWC students, go ask around and meet new friends, alsopreferably not in the same Computer Science department … ifpossible … only if possible)b. maini. Call the fillArray methodii. Count how many Computer Science studentsiii. If half or more students are Computer Science students, thendisplay “You … need more…
- IN JAVA A furniture store specializes in office furniture and sells Office Chairs, Desks and Book Shelves. Customers can buy furniture using the application of the furniture shop. Create a class Furniture having id, finishing/polish, and price provide appropriate methods for the data members provide toString method and a method Buy which simply prints “Buying A Furniture”; as type of furniture is not specified. Next create class Chairs having fabric (String), arms (Boolean), as data members this extends the functionality of Furniture class. Provide appropriate methods for data members, also provide an override method Buy which helps customers buy the chair please note the following1. Arms are optional if customers wants to have armed chair then it will add extra cost of 1000 to the original price of chair otherwise price remains same. 2. User can also change color of polish (options available brown, black and white). Price of black and brown are Rs 2,000 each whereas price of…(The Rectangle class) Following the example of the Circle class in Section 8.2,design a class named Rectangle to represent a rectangle. The class contains:■ Two double data fields named width and height that specify the width andheight of the rectangle. The default values are 1 for both width and height.■ A no-arg constructor that creates a default rectangle.■ A constructor that creates a rectangle with the specified width and height.■ A method named getArea() that returns the area of this rectangle.■ A method named getPerimeter() that returns the perimeter.Draw the UML diagram for the class and then implement the class. Write a testprogram that creates two Rectangle objects—one with width 4 and height 40and the other with width 3.5 and height 35.9. Display the width, height, area,and perimeter of each rectangle in this order.this is for a python class 9.12 LAB: Product class In main.py define the Product class that will manage product inventory. Product class has three attributes: a product code, the product's price, and the number count of product in inventory. Implement the following methods: A constructor with 3 parameters that sets all 3 attributes to the value in the 3 parameters set_code(self, code) - set the product code (i.e. SKU234) to parameter code get_code(self) - return the product code set_price(self, price) - set the price to parameter price get_price(self) - return the price set_count(self, count) - set the number of items in inventory to parameter count get_count(self) - return the count add_inventory(self, amt) - increase inventory by parameter amt sell_inventory(self, amt) - decrease inventory by parameter amt Ex. If a new Product object is created with code set to "Apple", price set to 0.40, and the count set to 3, the output is: Name: Apple Price: 0.40 Count: 3 Ex. If 10…
- By using Java programming Write a class called ”BankAccount” that has the following variables:• A variable with type String and its name ”acoountHolderName”.• A variable with type int and its name ”accountNum”.• A variable with type double and its name ”balance”.Create the following three methods:• A method called ”Withdraw” of type void takes a parameter of type double called amount. The method takesthe amount of money a customer wants to withdraw from their balance and deducts it from the balance. Themethod must check if there is enough money to withdraw.• A method called ”Deposit” of type void and takes parameter of type double called amount. The method addsthe amount of money to a customer’s balance.• (Bonus) Create a method called ”GenerateAccountNum” to generate a random number with nine digits andassign the variable ”accountNum”The variables and methods names are case-sensitive.Python program for this project: Patient Charges Write a class named Patient that has attributes for the following data: First name, middle name, and last name Address, city, state, and ZIP code Phone number Name and phone number of emergency contact The Patient class’s _ _init_ _ method should accept an argument for each attribute. The Patient class should also have accessor and mutator methods for each attribute. Next, write a class named Procedure that represents a medical procedure that has been performed on a patient. The Procedure class should have attributes for the following data: Name of the procedure Date of the procedure Name of the practitioner who performed the procedure Charges for the procedure The Procedure class’s _ _init_ _ method should accept an argument for each attribute. The Procedure class should also have accessor and mutator methods for each attribute. Next, write a program that creates an instance of the Patient class, initialized with sample data. Then,…Write a Java class called BankAccount (Parts of the code is given below), which has two privatefields: name (String) and balance (double), and three methods: deposit(double amount),withdraw(double amount) and toString(). Write the necessary constructors, accessor methods andmutator methods. The deposit() method adds the amount to the account causing the current balanceto increase, withdraw() method subtracts the amount causing the current balance to decrease andtoString() method should return the name and the current balance separated by a comma. Forexample, if you print out the object with name Jake and balance 40.0 then it should print:Jake, $40.00public class BankAccount {private String name; ...public void deposit(double amount) {balance = balance + amount;}public void withdraw(double amount) {balance = balance – amount;}public BankAccount(){};public BankAccount(String name_new, double bal_new) {...}...}Write a client program called BankAccountClient that creates a BankAccount…
- PLEASE USE PYTHON PROGRAMMING Create a class called Numbers, which has a single class attribute called MULTIPLIER, and a constructor which takes the parameters x and y (these should all be numbers). Write a method called add which returns the sum of the attributes x and y. Write a class method called multiply, which takes a single number parameter aand returns the product of a and MULTIPLIER. Write a static method called subtract, which takes two number parameters, b and c, and returns b - c. Write a method called value which returns a tuple containing the values of x and y. Make this method into a property, and write a setter and a deleter for manipulating the values of x and y. class Numbers: # TODO: create a class attribute called MULTIPLIER def __init__(self, x, y): self.x = x self.y = y def add(self): # TODO: return x + y def multiply(self, a): # TODO: return the attribute MULTIPLIER * by a. @staticmethod def subtract(b, c):…Create a class named Calculate2. Add 2 instance variables, Quantity and UnitPrice. UnitPrice can include Rupees andCents.3. Add a no-argument constructor and a parameterized constructor.4. Add getters and setters for the 2 instance variables5. Add a user defined method named Total with no arguments. Total will calculate andreturn Quantity*UnitPrice. If Quantity is greater than 10, give 5% discount.6. Add a user defined method to display the total amount to the user.7. Create a Java Main application to create 2 objects using both constructors based onthe Calculate class to test the program.can you please answer number 4 for me 1. Create a class called Student, with the following attributes/variables:a. studentName (String)b. studentNumber (int)sc. regYear(long)d. faculty(String)e. department(String)2. Add the following methods in Student:a. accessors and mutators for all variablesb. toString methodi. Formulate your toString so that it only shows studentName,studentNumber and faculty3. Create a class called MyFriends, with the following attributes variables:a. studentArray(Student[])4. Add the following methods in MyFriends:a. fillArrayi. Using scanner ask how many students does the user want to inputii. Capture user input for all of his friends(Of course we are assuming all your friends would be similarUWC students, go ask around and meet new friends, alsopreferably not in the same Computer Science department … ifpossible … only if possible)b. maini. Call the fillArray methodii. Count how many Computer Science studentsiii. If half or more students are Computer Science…