Your task is to create a function that simulates a vending machine. Given an amount of money (in cents & to make it simpler) and a product Number, the vending machine should output the correct product name and give back the correct amount of change. The coins used for the change are the following: [500, 200, 100, 50, 20, 10] The return value is an object with 2 properties: product: the product name that the user selected. • change: an array of coins (can be empty, must be sorted in descending order). Examples vendingMachine (products, 200, 7) vendingMachine (products, 500, 0) "Enter a valid product number" vendingMachine (products, 90, 1) → "Not enough money for this product" - - {product: "Crackers", change: [50, 20, 10
Q: What fundamentally distinguishes the telephone network from the Internet
A: The Internet and phone networks are both switched networks that use circuit and packet switching.
Q: To be more explicit, in what ways are the BIOS and UEFI passwords on certain PCs able to be…
A: On the windows which contains the system informations in the start panel and under the BIOS mode we…
Q: Dissertate on WebGL and OpenGL ES.
A: Points on WebGL 1. WebGL stands for Web Graphics Library. This library is used to generate…
Q: Why and how do numerous Linux commands behave in the same way on Macs and Linux systems,…
A: The utility of Linux operating system is known as the Linux commands.
Q: What belongs in the XXX and YYY in the statement below in order to generate a random number between…
A: Random generator = new Random(); generator.nextInt(XXX) - YYY; nextInt() method in Random class will…
Q: Write a program that reads maximum 100 integers entered by user ranging from 1 to 9 and displays the…
A: Here is the python program for above implementation. See below step.
Q: Consider the following grammar with terminals [, ], a, b, c, +, and -: a) S→ [SX] | a X+SY | Yb | &…
A: To apply the needed rules at the correct position by the parser, first and follow need to be found.
Q: Where does Windows store deleted files when you use File Explorer or Windows Explorer to remove them…
A: The answer to the question is given below with an explanation
Q: Find the errors in the following C program and fix them. You may directly mark the error and fix it…
A: Given code contains some error which need to be fixed for proper execution of the code.
Q: describe
A:
Q: Create a function that takes two "sorted" arrays of numbers and returns an array of numbers which…
A: In this problem we need to design the Java script program. Input - that takes two "sorted" arrays…
Q: A computer consists of a processor and an I/O device D connected to main memory M via a shared bus…
A: According to the information given:- We have to follow the instruction in order to get If…
Q: 5. Creating Lookups 6. Automatic Lookups 7. Geospatial Lookups 8. External Lookups 9. KV Store…
A: 5. Creating lookups: Creating a lookup field not only improves the meaning of the data, but helps…
Q: What is JVM and is it platform independent?
A: JVM is also known as Java Virtual Machine.
Q: List the justifications for why a company could want firewalls for physical security measures.
A: Firewall - A firewall is a network device that offers network security based on security policies.…
Q: Assume that after installing a motherboard, someone forgets to connect the wires from the casing to…
A: Numerous wires protrude from the front panel of the computer casing and link to the motherboard's…
Q: a) Write C++ statements to declare and initialize an array of strings named appliances to store the…
A: We need to write a C++ code for the given scenario.
Q: What various kinds of data structures exist?
A: A data structure is a collection of "values" of the data type that are stored and organized to…
Q: Assume the following declaration: truct Student string name; int matricNo; Marks marks;
A: //Program: #include<iostream>#include<string>using namespace std;struct Student{string…
Q: 14 Use Gauss-Jordan elimination to solve the following linear system: -3x+4y=-6 5x-y=10 OA (2.0)…
A: According to the information given:- We have to solve and find out the correct option.
Q: A nonpipelined processor has a clock rate of 2.5 GHz and an average CPI (cycles per instruction) of…
A: a. Given no of Stages=5 Time for execution =(no of stages+((no of instructions))-1)…
Q: Functions f(x)= x + 2 and g(x)=x²-2x Evaluate (g. g)(-1) 03 -3 05 08 O
A: The following solution is
Q: What is JVM and is it platform independent?
A: Java bytecode (.class files) can be executed in a runtime environment that is provided by the Java…
Q: What various kinds of data structures exist?
A: Data structures The data structure is a way to store and organize the data. By using data structure,…
Q: If at all possible, would you be able to elaborate on the metrics used i
A: Introduction: A software metric is a measurable or countable measure of a program's properties that…
Q: A computer consists of a processor and an I/O device D connected to main memory M via a shared bus…
A: Given that, on an average, six cycles are required by the instruction.
Q: Consider a system employing interrupt-driven I/O for a particular device that trans- fers data at an…
A: In this question we have to solve the given parts for the system employing interrupt driven I/O for…
Q: 'Hello" should use a character array of length A. 5 B. 6 C. 7 L to store.
A: Using Python3 language for the validation of the answer.
Q: Where does Windows store deleted files when you use File Explorer or Windows Explorer to remove them…
A: The question is Where does Windows store deleted files when you use File Explorer or Windows…
Q: JAVA Problem Create a function that determines whether elements in an array can be re-arranged to…
A: The complete JAVA code is given below with OUTPUT screenshot Happy Coding ?
Q: How can forensic investigators retrieve data that is both volatile and non-volatile from machines…
A: The answer of the question is given below:
Q: What possible use may a motherboard power connection in the SATA type serve?
A: Here is the explanation regarding SATA port.
Q: Describe the disruptions caused by the Internet and related technologies. Disney World received…
A: The internet and related technologies have disrupted many industries, including the travel industry.…
Q: Declare a string of 20 unsigned bytes named bArray and initialize all the elements to zero
A: INTRODUCTION: A source operand, a destination operand, or both are possible requirements for each…
Q: Describe and contrast the various methods available for scheduling Linux commands to be performed at…
A: We can complete various tasks at specific times and dates with the assistance of commands for…
Q: Consider the following grammar with terminals [, ], a, b, c, +, and -: S→ [SX] | a X +SY | Yb | &…
A: (a)Parsing Table a b c + - [ ] $ S S -> a S -> [SX] X X -> Yb X -> ε X -> +SY…
Q: A. Write an Assembly program to load the register E with the value 12 and the register H with the…
A: The question is to write the assembly language code for the given problem.
Q: Think about a multiuser, time-sharing, multiprogramming system. Which process protection-related…
A: Multi-user is defined as a user who is capable of handling more than one person or task at the same…
Q: How can the practical use of virtual servers and services be shown and explained?
A: Virtualization is becoming more substantial in the world of innovation as people realize how it may…
Q: Q.1 Ans. Discrete Mathematics Assignment-5 Give an example to show that all three=, <=, and < are…
A:
Q: Produce a Turing Machine state diagram that decides the following language. You do not need to show…
A: Given: La = {anbn : n>=0} Logic to build turing machine for La is : step1) start reading input,…
Q: The program must include a looping structure to both receive user input and process it until the…
A: The java programming is the object oriented programming languages that are used to create the web…
Q: on why it's so important that you comprehend compressed z
A: Introduction: As we know The subject of this article is compressed zip files and folders. as it. A…
Q: When would you suggest RADIUS or Kerberos be used instead of tacacs+?
A: Users that need access to a network are sent to the Tacacs+ server, which stands for terminal access…
Q: Why is a two-stage instruction pipeline unlikely to cut the instruction cycle time in half, compared…
A:
Q: Considering the c++ program below, and [4, 5, 8, 3] as user inputs, answer the following questions:…
A: We need to answer the questions based on given C++ code.
Q: Create a function that takes two "sorted" arrays of numbers and returns an array of numbers which…
A: In this problem, we need to create a new method with that takes two "sorted" arrays of numbers and…
Q: What is the method that DMA uses to increase the concurrency of the system? In what ways does it…
A: DMA represents the DIRECT MEMORY ACCESS. Means there is a direct way to access the memory not by the…
Q: What are the two advantages of layered protocols?
A: The question has been answered in step2
Q: Please answer number 1 and 2 as they are all linked altogether with the subparts by following the…
A: It is defined as a object-oriented programming, platform-independent, and secure programming…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- The Spider Game Introduction: In this assignment you will be implementing a game that simulates a spider hunting for food using python. The game is played on a varying size grid board. The player controls a spider. The spider, being a fast creature, moves in the pattern that emulates a knight from the game of chess. There is also an ant that slowly moves across the board, taking steps of one square in one of the eight directions. The spider's goal is to eat the ant by entering the square it currently occupies, at which point another ant begins moving across the board from a random starting location. Game Definition: The above Figure illustrates the game. The yellow box shows the location of the spider. The green box is the current location of the ant. The blue boxes are the possible moves the spider could make. The red arrow shows the direction that the ant is moving - which, in this case, is the horizontal X-direction. When the ant is eaten, a new ant is randomly placed on one of the…Python In this assignment, a game called treasure hunt will be written object oriented.There are 3 types of treasures in the game. Diamond, Emerald and Gold. Diamond is 100 points, Emerald 70 points and Gold is 50 points.There are thieves in the game that will prevent you from hunting for treasure. Encountering a thief they steal some of your treasure. You will randomly generate which thief will steal from which treasure and how much.At the beginning of the game, the player has no treasure. X, Y, Z and H will be randomly identified at the start of the game. Define X Diamonds, a random number between X -> 100-200.Let a random number be defined between Y Emerald Y -> 100-200.Define a random number between Z Gold Z -> 100-200.You will define H thieves. Let it be defined between H -> 5-20. It will collect these randomly selected treasures to the player.For example:1- Diamond2-Emerald3-Diamond4-Gold5-Thief (k = treasure to steal, n = how many pieces he can steal)6-Gold.... In…Problem: An online grocery store sells items on a web page. A user adds items to a basket and he clicks on the submit button when he completes. The store sells food and electronic items. The electronic items require VAT payment of 15 percentage of their prices. There are packed and lose food. The lose food is measured in weights. User specifies the weight amount or the quantity in his selection of items depending on its type. The price is computed as the product of the price per item or the price per weight and the weight or quantity are given by the user. Write an application that reads a user basket list and produces the bill receipt. Check the given samples of input/output in the figures below. The bill receipt contains the list of item details in decreasing order according to the price computed for each item. Use the selection sort' to sort the items in the list and do not use java given sort method. Selection sort is an algorithm used to arrange elements in a list. It selects the…
- printTodaysDate is a function that accepts no parameters and returns no value. Write a statement that calls printTodaysDate.George runs a company. He manages James and Jamila, who each have a small team to manage. In James' team are Jill and Jenny. In Jamila's team are Jewel, Jasmine and Jeremy. Create a JSON object in a string variable called company where each item has a name field and a field called manages which contains an array of the people managed by that person. If a person does not manage anybody, they have no field called manages. Then convert the JSON string to a dictionary in a variable called company_dict. Finally, write a recursive function that accepts the dictionary as an argument and lists each person and their level in the organisation, so that George is at level 1, James and Jamila are at 2, and so on. Call the function and print the result. It should look like this: George is at level 1 James is at level 2 Jill is at level 3 Jenny is at level 3 Jamila is at level 2 Jewel is at level 3 Jasmine is at level 3 Jeremey is at level 3 The function can either return a string, which you print…Please submit a flowchart of your program for your project below. Need a class which will contain: Student Name Student Id Student Grades (an array of 3 grades) A constructor that clears the student data (use -1 for unset grades) Get functions for items a, b, and c, average, and letter grade Set functions for items a, n, and c Note that the get and set functions for Student grades need an argument for the grade index. Need another class which will contain: An Array of Students (1 above) A count of number of students in use You need to create a menu interface that allows you to: Add new students Enter test grades Display all the students with their names, ids, test grades, average, and letter grade Exit the program Add comments and use proper indentation. Nice Features: I would like that system to accept a student with no grades, then later add one or more grades, and when all grades are entered, calculate the final average or grade. I would like the system to display the…
- IN C# PLEASE Create class Cube. The class has attributes length and width and depth, each of which defaults to 1. It has read-only properties that calculate the Perimeter and the Area for a side of the cube, and another that calculates the cubed feet for the cube. (You will have to research how to do that calculation online) It has properties for length and width and depth. The set accessors should verify that length and width and depth are all floating-point numbers greater than 0.0 and less than 20.0. Write an app to test class Cube by creating 3 cubes of different sizes.In previous chapters, you have created programs for the Greenville Idol competition. Now create a Contestant class with the following characteristics: The Contestant class contains public static arrays that hold talent codes and descriptions. Recall that the talent categories are Singing Dancing, Musical instrument, and Other. The class contains an auto-implemented property that holds a contestants name. The class contains fields for a talent code and description. The set accessor for the code assigns a code only if it is valid. Otherwise, it assigns I for Invalid. The talent description is a read-only property that is assigned a value when the code is set. Modify the GreenvilleRevenue program so that it uses the Contestant class and performs the following tasks: The program prompts the user for the number of contestants in this years competition; the number must be between 0 and 30. The program continues to prompt the user until a valid value is entered. The expected revenue is calculated and displayed. The revenue is $25 per contestant. The program prompts the user for names and talent codes for each contestant entered. Along with the prompt for a talent code, display a list of the valid categories. After data entry is complete, the program displays the valid talent categories and then continuously prompts the user for talent codes and displays the names of all contestants in the category. Appropriate messages are displayed if the entered code is not a character or a valid code.Create an application for generating lottery tickets of random numbers. Each lottery ticket has a fixed count of numbers to be played with each number selected being within a given range. For example, when the range of numbers is 1 through 100, and 5 numbers are to be played, the lottery ticket will be composed of 5 unique values between 1 and 100. The values are selected at random. The main function is responsible for obtaining the upper range of the numbers and the count of numbers to be played from the end user. The count of numbers must be less than the upper range. The main function will call the generateLotto function to generate the lottery ticket and then call the displayTicket function to display the resulting lottery ticket. Any number of lottery tickets may be generated. The generateLotto function should accept two parameters. The first should be the upper range for the numbers while the second parameter represents a count of the numbers to be played. For example,…
- Create an application for generating lottery tickets of random numbers. Each lottery ticket has a fixed count of numbers to be played with each number selected being within a given range. For example, when the range of numbers is 1 through 100, and 5 numbers are to be played, the lottery ticket will be composed of 5 unique values between 1 and 100. The values are selected at random. The main function is responsible for obtaining the upper range of the numbers and the count of numbers to be played from the end user. The count of numbers must be less than the upper range. The main function will call the generateLotto function to generate the lottery ticket and then call the displayTicket function to display the resulting lottery ticket. Any number of lottery tickets may be generated. The generateLotto function should accept two parameters. The first should be the upper range for the numbers while the second parameter represents a count of the numbers to be played. For example,…Create an application for generating lottery tickets of random numbers. Each lottery ticket has a fixed count of numbers to be played with each number selected being within a given range. For example, when the range of numbers is 1 through 100, and 5 numbers are to be played, the lottery ticket will be composed of 5 unique values between 1 and 100. The values are selected at random. The main function is responsible for obtaining the upper range of the numbers and the count of numbers to be played from the end user. The count of numbers must be less than the upper range. The main function will call the generateLotto function to generate the lottery ticket and then call the displayTicket function to display the resulting lottery ticket. Any number of lottery tickets may be generated. The generateLotto function should accept two parameters. The first should be the upper range for the numbers while the second parameter represents a count of the numbers to be played. For example,…Previously in this chapter you saw the card_dealer.py program that simulates cards being dealtfrom a deck. Enhance the program so it simulates a simplified version of the game of Blackjackbetween two virtual players. The cards have the following values:Numeric cards are assigned the value they have printed on them. For example, the value ofthe 2 of spades is 2, and the value of the 5 of diamonds is 5.Jacks, queens, and kings are valued at 10.Aces are valued at 1 or 11, depending on the player’s choice.The program should deal cards to each player until one player’s hand is worth more than 21points. When that happens, the other player is the winner. (It is possible that both players’ handswill simultaneously exceed 21 points, in which case neither player wins.) The program shouldrepeat until all the cards have been dealt from the deck.If a player is dealt an ace, the program should decide the value of the card according to thefollowing rule: The ace will be worth 11 points, unless that…