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
- suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that deactivates the alarm, and armed with contains a boolean describing whether or not the alarm is activated. Alarm has a function disarm that changes the value of armed to False if the user gives a parameter containing the string that represents the alarm's code. Call the disarm function on the Alarm object myAlarm and give it the code "93478". using pythonYour task is to implement a variation of the classic word game Hangman, which involves players guessing the letters in a word chosen at random with a finite number of guesses. While there are alternate versions such as category Hangman and Wheel of Fortune, which involve players guessing idioms, places, names and so on, we will be sticking with the traditional version. Requirements:You will implement a function called main that allows users to play an interactive hangman game against the computer. The computer should pick a word, and players should then try to guess letters in the word until they win or run out of guesses.Here is the overarching behaviour we expect:1. The program should load a list of available words from the text file provided. Note that the file you have been given contains words in lowercase.2. The computer should then select a word at random from the list at random.3. The user is given a certain number of guesses at the beginning.4. The game is interactive; the…Your task is to implement a variation of the classic word game Hangman, which involves playersguessing the letters in a word chosen at random with a finite number of guesses. While there arealternate versions such as category Hangman and Wheel of Fortune, which involve playersguessing idioms, places, names and so on, we will be sticking with the traditional version. Requirements:You will implement a function called main that allows users to play an interactive hangman gameagainst the computer. The computer should pick a word, and players should then try to guess lettersin the word until they win or run out of guesses.Here is the overarching behaviour we expect:1. The program should load a list of available words from the text file provided. Note thatthe file you have been given contains words in lowercase.2. The computer should then select a word at random from the list at random.3. The user is given a certain number of guesses at the beginning.4. The game is interactive; the user…
- Write a java program that contains variables to hold employee data like; employeeCode, employeeName and date Of Joining. Write a function that assigns the user defined values to these variables. Write another function that asks the user to enter current date and then checks if the employee tenure is more than three years or not. Call the functions in main. Now write a runner class that declares two employee objects and check their tenure periods.A main() function is given below. Based on this function, your task is to write complete code required to run the main() function successfully. Class Rectangle{Private:int len;int width;static int objectCount;public:All functions that are needed. };int main(){int len;int width;cin>>len;cin>>width;Rectangle r1(len,width);Rectangle r2(4,6);Rectangle r3();Rectangle r4();Rectangle r5();r3 = r1 + r2;r4 = r1 - r2;r5 = r1 * r2;if(r3 == r4){cout<<"Both are equals"<<endl;}else if(r3 > r4){cout<<"r3 is greater than r4"<<endl;}else if(r3 < r4){cout<<"r4 is greater than r3"<<endl;} return 0;}Please solve in JAVA only You are in charge of the cake for a child's birthday. You have decided the cake will have one candle for each year of their total age. They will only be able to blow out the tallest of the candles. Count how many candles are tallest. ExampleCandles = [4,4,1,3]The maximum height candles are 4 units high. There are 2 of them, so return 2. Function DescriptionComplete the function birthdayCakeCandles in the editor below. birthdayCakeCandles has the following parameter(s):• int candles[n]: the candle heights Returns• int: the number of candles that are tallest Input FormatThe first line contains a single integer n, the size of candles[].The second line contains n space-separated integers, where each integer describes the height of candles[i]. Constraints• 1 ≤ n ≤ 105• 1 ≤ candles[i] ≤ 107 Sample Input 043 2 1 3 Sample Output 02 Explanation 0Candle heights are [3,2,1,3]. The tallest candles are 3 units, and there are 2 of them. import java.io.*;import…
- Write a program email.cc that takes an email address in the following format: firstname.lastname@hotmail.com, such as jon.doe@hotmail.com, extracts from it the firstname and the lastname, and prints them in the following format: Lastname, Firstname. Your program should have and use at least the following functions:(a) getEmaillAddress that prompts a user to enter an email address as a string andreturns it.(b) extract that takes as its parameter an email address and returns the firstname andlastname.(c) capitalize that takes as its parameter a string and capitalize its first letter.(d) display that takes as its parameters 2 strings corresponding to the firstname andlastname, and displays them in the following format: Lastname, Firstname.Your program should repeatedly prompts the user to enter the email address in the previous format. The program should then output it as in the examples below. jon.doe@uleth.caDoe, JonTry again (Y/N) -- Ycarol.smith@uleth.caSmith, CarolTry again (Y/N)…Give solution in C ++ Language with secreenshoot of source code. Part 01In this task, you need to do the following:• Write a function named displayMessage() that takes user name as input in character array and then shows greetings• Now take the name input in main() and pass the name as an argument to displayMessage() function• Change the displayMessage() method such that it returns the number of characters after displaying the greetings part 02Write a function power that takes two parameters a and b. And it returns the power as ab.Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in each row. Rows 1 and 2 are first class, rows 3 through 7 are business class, and rows 8 through 13 are economy class. Your program must prompt the user to enter the following information: a. Ticket type (first class, business class, or economy class) b. Desired seat
- We're going to explore the law of large numbers here with a dice rolling program. Seed the random number generator with the current time and then roll three 6-sided dice (often described as 3d6) a total of 1,000,000 times and keep track of the number of times each sum 3 - 18 occurs. Be sure to separate all functions and methods (if you chose to use a class or structure) into both the prototype and an implementation below the main. 1. Build a regular c-type function that returns a random number between 3 - 18. This will simulate a single roll of three dice. Use the prototype: int rollDice(void);2. In the main, roll the dice 1,000,000 times and tally up the results in an array. I DO NOT want each individual roll printed to screen. Let the index represent the number rolled and the value will represent the number of times that number has been rolled. For example, a[3] = 5357 a[4] = 14750...a[18] = 4981 This array set-up will mean that the result 3 occurred 5,357 times and the…In this task, we’re going to be simulating an email message. Some of the logic hasbeen filled out for you in the email.py file.● Open the file called email.py.● Create a class definition for an Email which has four variables:has_been_read, email_contents, is_spam and from_address.● The constructor should initialise the sender’s email address.● The constructor should also initialise has_been_read and is_spam to false.● Create a function in this class called mark_as_read which should changehas_been_read to true.● Create a function in this class called mark_as_spam which should changeis_spam to true.● Create a list called inbox to store all emails (note that you can have a list ofobjects).● Then create the following methods:○ add_email - which takes in the contents and email address from thereceived email to make a new Email object.○ get_count - returns the number of messages in the store.○ get_email - returns the contents of an email in the list. For this, allowthe user to input an index…In Java: Develop a void function that takes two integers and prints whether the first number is divisible by the second. For example, with arguments 51 and 17, the function should print “51 is divisible by 17”. With arguments 17 and 8, the function should print “17 is not divisible by 8”. Call the function twice with different arguments to show each possible result. What happens when the second argument is greater than the first?