Build the ItemToPurchase class with the following specifications: Attributes item_name (string) item_price (int) item_quantity (int) Default constructor Initializes item's name = "none", item's price = 0, item's quantity = 0 Method print_item_cost() Ex. of print_item_cost() output: Bottled Water 10 @ $1 = $10 In the main section of your code, prompt the user for two items and create two objects Ex: Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: 1 Item 2 Enter the item name: Bottled Water Enter the item price: 1 Enter the item quantity: 10 Add the costs of the two items together and output the total cost. Ex: TOTAL COST Chocolate Chips 1 @ S3 = S3 Bottled Water 10 @ $1 = $10 Total: $13
Q: Write an application that prompts for and reads the numerator and denominator of a fraction as integ...
A:
Q: Write a Java Program to take two strings from the user ka and b, print the result of putting them to...
A: Java is a high level,class based, object-oriented programming language that is designed to have as f...
Q: public class AverageWithSentinel public static final int END_OF_INPUT = -500'; %3D public static voi...
A:
Q: Instead of dynamically allocating an array to store the data, your program will will an STL array. E...
A: Explanation: Include the necessary header files. In the main function initialize the array with the...
Q: Please perform test cases according to the intructions provided. Box code is given below. Question i...
A: java is a compiled language that follows the concept of oops to make projects. It is used to build v...
Q: 32K L1
A: given - Suppose a direct-mapped cache uses a 32K L1 memory and a 256K L2 memory. How many of the L2 ...
Q: Discuss the purpose and importance of mathematical writing.
A: Perusing, composing, and arithmetic are, or ought to be, indivisible. Involved math can invigorate i...
Q: Computer science What is AWS S3's support for Replication Rules?
A: The automatic, asynchronous copying of objects between buckets in the same or separate AWS Regions i...
Q: 2-write V.B program to print ali, Date and time after each 3 sec and continue until stop the timer a...
A: I have answered this question in step 2.
Q: Instruction: A mathematician named Ulam proposed generating a sequence of numbers from any positive ...
A: PROGRAM EXPLANATION Import the java.util package. Create the main class. Define the main method. As...
Q: How does the database method, as opposed to the file system approach, result in less maintenance?
A: Introduction: The following factors contribute to the lower maintenance requirements of the database...
Q: List appropriate Worst Case Big O Notation under the different algorithms or data structure operatio...
A: To compare algorithms on the basis of running time complexity Big O notation is used.
Q: The population of the five most populous Australian cities at the last three census is recorded in t...
A: Since no programming language is mentioned, I am using Matlab. Code: cities=categorical({'Sydney...
Q: Compare and contrast cache memory and magnetic disk storage in a computer system with respect to the...
A: Please find the detailed answer in the following steps. Note: As per the Bartleby guideline I can...
Q: Consider a table called Employee with schema (empID, salary, rank, deptID) and a table called Projec...
A: We have to fetch the employee id's who are working in HR department Then we will check if manager of...
Q: a) consider the employee database . What are the appropriate primary keys? b) Consider the employee...
A: a) The appropriate primary key is written in bold and underlined: employee(person_name, street, city...
Q: Write an application that reads a value representing a number of seconds, then displays the equivale...
A: JAVA Program: import java.util.*;public class SecondsToTime{ public static void main(String[] arg...
Q: Consider how collaboration may be impacted if the cloud computing trend had any effect on the way pe...
A: Cloud collaboration is a type of enterprise collaboration that allows employees to work together on ...
Q: What is the definition of an object program?
A: Object program is the program that is executed by machine.
Q: Dynamic programming can only be used to solve optimization problems. True False
A: Dynamic programming is mostly used to tackle optimization challenges. When we talk about optimizatio...
Q: Used Python programming. Let's think of some creative ideas and implement them in this project. Yes!...
A: Now at first you can collect the images of the gates and truthtables as you want . Make sure the ima...
Q: In Bubble Sort Ascending Order Show the step by step process on how sorting was done such as first ...
A: answer is
Q: C++ numbering systems convert from octal to hexadecimal.
A: Given To know about the octal to hexadecimal in C++ .
Q: 1). ....reliable transport between sending and receiving process (TCP, UDP)
A: As per guidelines I can answer only first 3 sub-parts. I hope you will understand. Thank You. 1. TC...
Q: cts might arise when designing an architecture for which both availability and secu
A: Design conflicts might arise when designing an architecture for which both availability and security...
Q: Using Java Eclipse IDE Create gui like this Frame Java Swing or jframe
A: Explanation: I have provided an explanation within the code in the comment. Code run successfully a...
Q: Synaptic weights are w,-1.2, w,- -0.4, w,= 0.7. Find the given input above (or) below the line ?
A: The answer is
Q: In Merge Sort Ascending Order Show the step by step process on how sorting was done such as firs...
A: Merge Sort: It is the sorting technique which follows divide and conquer approach and uses this appr...
Q: Create a class named student with two overloaded methods named String[] info(String []name,int[] ma...
A: Note :- You have not mention the language of the program so i am doing you question in Java. Your Ja...
Q: Assume you're working on a fantastic social networking platform. You expect to have half a million u...
A: EXPLANATION AND ANSWER: 1.Prospecting via a Social Media Platform: Goldmine: The marketing potential...
Q: What precisely is autonomic computing, and how does it contribute to the advancement of cloud comput...
A: Answer in step 2
Q: Write a program that inputs the hourly rate and number of hours worked. Compute and display the gros...
A: Here I have taken input from the user and then stored it into 2 different variables. Next, I have ca...
Q: IN C PROGRAMMING LANGUAGE Input a 5 digit positive integer and print the count of ODD digits in the ...
A: C Program: #include <stdio.h>#include <math.h> // Function to count the odd digitsint co...
Q: use the laws of Boolean algebra to obtain a simpler equivalent expression, and draw the correspondin...
A: Final Output = (x' + y) . x . y = x' . x . y + y . x . y [By distributive property] = x . x' . y + ...
Q: In what ways does the information system differ from other systems in terms of organizational, manag...
A: Introduction: An information system (IS) is a structured, sociotechnical organizational structure us...
Q: d. Write down thể ô 10, 101, 10o 11, 10, and Execute it. Step through the program using the followin...
A: Given code is begin clear sum again: load zero compare n jumpeq done load sum add n store sum in n ...
Q: a. Write a python program that writes data to a file. The data consists of a series of records, each...
A: The Answer is
Q: Q7: Write the treatment plan for the following risk "Possibility of wrong data entery is 6.5%"
A: The answer is given below.
Q: 2) Design DFA for the following Language. Where Σ = {a,b} and give the formal definition of your mac...
A: Approach Used –The first thing we observe is that both 0’s and 1’s should be at least 2. If any of t...
Q: What is header file used for? Answer Choices: a. It is used to work with command line arguments. b....
A: stdarg.h is a header in the C standard library of the C programming language that allows functions t...
Q: Compare and contrast the three most common routing approaches. (Distance-vector routing, Link-state ...
A: Introduction: Routing is the process of determining the best route for traffic inside a network and ...
Q: You have been given the following code which represents some Unicode characters in UTF-8 encoding. E...
A: UTF-8 is called as “Unicode Transformation Format - 8 bits.” In order to store information, computer...
Q: Write the code to copy values in one array to another. In the following code snippet, we copy values...
A: To allocate space, new operator is used followed by type of variable. To de-allocate memory, delete ...
Q: 4. 1011012 = 10= _ 5. What is the gray code of 101011110010102? 16 6. Solve: ABF5H - 9CDFH
A: Ans:) This problem requires conversions from one base of another. The complete solution is given bel...
Q: For the grammar G = (E, NT, R, S) where = {a, b, S}, NT = {a, b} and R = {S→ aSb, SaSa, S→bSa, S→ bS...
A:
Q: Define coupling, cohesion, and refactoring Run zuul-with-enums-v2. How many rooms are there in the s...
A: Coupling: Coupling is the measure of the degree of interdependence between the modules. A good softw...
Q: 11. Write a JAVA program to input two strings x, y and create a new string of the form small + large...
A: Write a JAVA program to input two strings x, y and create a new string of the form small + large + s...
Q: Illustrate TWO (2) situations where security guards are the better choice in making complex decision...
A: Benefits of Guards1. They provide a visible “human” barrier to theft.The first reason why people wan...
Q: 1a.) Explain why an operating system is regarded as a resource manager; and give two examples of Ope...
A: The operating system acts as a manager of the above resources and allocates them to specific program...
Q: Determine the components of the vectors [u1, u2] and [V1, V2] so that a[u1, U2] + [V1, v2] generates...
A: Here, I have to provide a solution to the above question.
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:
Step by step
Solved in 3 steps with 3 images
- In Python: Write a class named Pet, which should have the following data attributes: _ _name (for the name of a pet) _ _animal_type (for the type of animal that a pet is. Example values are 'Dog','Cat', and 'Bird') _ _age (for the pets age) The Pet class should have an _ _init_ _ method that creates these attributes. It should also have the following methods: set_nameThis method assigns a value to the _ _name field set_animal_typeThis method assigns a value to the _ _animal_type field set_ageThis method assignsa value to the _ _age field get_nameThis method assignsa value to the _ _name field get_animal_typeThis method assignsa value to the _ _animal_type field get_ageThis method assignsa value to the _ _age field Once you have written the class, write a program that creates an object of the class and prompts the user to enter the name, type and age of his or her pet. This data should be stored as the objects attributes. Use the objects accessor methods to retrieve the pets…Attributes item_name (string) item_price (int) item_quantity (int) Default constructor Initializes item's name="none", item's price = 0, item's quantity=0 Method print_item_cost() Ex of print_item_cost() output: Bottled Water 10 @ $1 = $10 in the main section of your code, prompt the user for two items and create two objects of the ItemToPurchase class. Exc Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: 1 Item 2 Enter the item name: Bottled Water Enter the item price: 1 Enter the item quantity: 10 Add the costs of the two items together and output the total cost Ex TOTAL COST Chocolate Chips 1 @ $3-$3 Bottled Water 10 @ $1= $10 Total: $13Python Code please Point of Sale Write a program that will manage the point of sale in a store. Build the ItemToPurchase class with the following: Attributes item_name (string) item_price (int) item_quantity (int) Default constructor Initializes item's name = "none", item's price = 0, item's quantity = 0 Method print_item_cost() Example of print_item_cost() output:Bottled Water 10 @ $1 = $10 Extend the ItemToPurchase class to contain a new attribute. item_description (string) - Set to "none" in default constructor Implement the following method for the ItemToPurchase class. print_item_description() - Prints item_description attribute for an ItemToPurchase object. Has an ItemToPurchase parameter. Example of print_item_description() output:Bottled Water: Deer Park, 12 oz. Build the ShoppingCart class with the following data attributes and related methods. Note: Some can be method stubs (empty methods) initially, to be completed in later steps. Parameterized constructor…
- User-defined Class: You will design and implement your own data class. The class will store data that has been read as user input from the keyboard (see Getting Input below), and provide necessary operations. As the data stored relates to monetary change, the class should be named MoneyChange. The class requires at least 2 instance variables for the name of a person and the coin change amount to be given to that person. You may also wish to use 6 instance variables to represent amounts for each of the 6 coin denominations (see Client Class below). There should be no need for more than these instance variables. However, if you wish to use more instance variables, you must provide a legitimate justification for their usage in the internal and external documentation.Your class will need to have at least a default constructor, and a constructor with two parameters:one parameter being a name and the other a coin amount. Your class should also provide appropriate get and set methods for…Focus on classes, objects, methods and good programming styleYour task is to create a BankAccount class. Class name BankAccount Attributes __balance float float __pin integer integer Methods __init_()get_pin()check_pin()deposit()withdraw()get_balance() The bank account will be protected by a 4-digit pin number (i.e. between 1000 and 9999). The pin should be generated randomly when the account object is created. The initial balance should be 0.get_pin()should return the pin.check_pin(pin) should check the argument against the saved pin and return True if it matches, False if it does not.deposit(amount) should receive the amount as the argument, add the amount to the account and return the new balance.withraw(amount) should check if the amount can be withdrawn (not more than is in the account), If so, remove the argument amount from the account and return the new balance if the transaction was successful. Return False if it was not.get_balance()…Focus on classes, objects, methods and good programming style Your task is to create a BankAccount class. Class name BankAccount Attributes _balance float _pin integer Methods init () get_pin() check pin () deposit () withdraw () get_balance () The bank account will be protected by a 4-digit pin number (i.e. between 1000 and 9999). The pin should be generated randomly when the account object is created. The initial balance should be 0. get_pin () should return the pin. check_pin (pin) should check the argument against the saved pin and return True if it matches, False if it does not. deposit (amount) should receive the amount as the argument, add the amount to the account and return the new balance. withraw (amount) should check if the amount can be withdrawn (not more than is in the account), If so, remove the argument amount from the account and return the new balance if the transaction was successful. Return False if it was not. get_balance () should return the current balance.…
- Assignment:The BankAccount class models an account of a customer. A BankAccount has the followinginstance variables: A unique account id sequentially assigned when the Bank Account is created. A balance which represents the amount of money in the account A date created which is the date on which the account is created.The following methods are defined in the BankAccount class: Withdraw – subtract money from the balance Deposit – add money to the balance Inquiry on:o Balanceo Account ido Date createdclass TicTacToePlayer: # Player for a game of Tic Tac Toe def __init__(self, symbol, name): self.symbol = symbol self.name = name def move(self, board): move = int(input(self.name + " make your move 1-9:")) move -= 1 y = move % 3 x = move // 3 board[x][y] = self.symbol def is_symbol(self, symbol): if symbol == self.symbol: return True class TicTacToe: # Game of TicTacToe in a class! def __init__( self, p1_symbol="X", p2_symbol="O", p1_name="Player1", p2_name="Player2" ): self.p1 = TicTacToePlayer(p1_symbol, p1_name) self.p2 = TicTacToePlayer(p2_symbol, p2_name) self.board = [[" " for x in range(3)] for x in range(3)] def play_game(self): turn = 0 winner_symbol = False while not winner_symbol: self._print_board() if turn % 2: self.p2.move(self.board) # replace this line with a call…class Duration: def __init__(self, hours, minutes): self.hours = hours self.minutes = minutes def __add__(self, other): total_hours = self.hours + other.hours total_minutes = self.minutes + other.minutes if total_minutes >= 60: total_hours += 1 total_minutes -= 60 return Duration(total_hours, total_minutes) first_trip = Duration(3, 36)second_trip = Duration(0, 47) first_time = first_trip + second_tripsecond_time = second_trip + second_trip print(first_time.hours, first_time.minutes) what is the output
- class Duration: def __init__(self, hours, minutes): self.hours = hours self.minutes = minutes def __add__(self, other): total_hours = self.hours + other.hours total_minutes = self.minutes + other.minutes if total_minutes >= 60: total_hours += 1 total_minutes -= 60 return Duration(total_hours, total_minutes) first_trip = Duration(1, 45)second_trip = Duration(0, 42) first_time = first_trip + second_tripsecond_time = second_trip + second_trip print(first_time.hours, first_time.minutes)print(second_time.hours, second_time.minutes) WHAT IS THE OUTPUTBuild the ItemToPurchase class with the following specifications: Attributes item_name (string) item price (int) item_quantity (int) Default constructor Initializes item's name= "none", item's price=0, item's quantity 0 Method print_item_cost) Ex. of print_itemcost) output: Bottled Water 10 $1= $10 In the main section of your code, prompt the user for two items and create two objects of the ItemToPurchase class. Ex Item i Enterthe item name: Chocolate Chips Enterthe item price: Enterthe item quantity: Item 2 Enterthe item name: Bottled Water Enterthe item price: Enterthe item quantity: 10 Add the costs of the two items together end output the totel cost. Ex: TOTAL COST Chocolate Chipai@S2 55 Bottied Weter 10 $1 = 510 Total: 113class Duration: def __init__(self, hours, minutes): self.hours = hours self.minutes = minutes def __add__(self, other): total_hours = self.hours + other.hours total_minutes = self.minutes + other.minutes if total_minutes >= 60: total_hours += 1 total_minutes -= 60 return Duration(total_hours, total_minutes) first_trip = Duration(2, 58)second_trip = Duration(0, 49) first_time = first_trip + second_tripsecond_time = second_trip + second_trip print(first_time.hours, first_time.minutes)print(second_time.hours, second_time.minutes) what is the entire output