Case Study 1: The following fragment of code in Figure 1 show the function to calculating the total price of soft drink orders. The soft drink is sold in boxes of 12 bottles and there are available in three flavour: falvour A (RM60), B(RM80) and C(RM100). int calcPrice (int qttyA, int qttyB, int qttyC, double price){ int discount = 0; if(qttyA== 2) discount = 5; else if (qttyA== 1 && qttyB == 1) discount = 8; else if (qttyC == 3) else endif price = ((qttyA*60) + (qttyB 80) + (qttyC* 100))* (100-discount)/100; return price; discount = 10; discount = 2; Figure 1: Fragment of total purchase code.
Q: Examples: addOdd(1) -> 1 addOdd(2) -> 1 addOdd(3) -> 4 addOdd(7) -> 16 public int addOdd(int n)…
A: The addodd() function calculates the sum of all positive odd numbers less than or equal to n. It…
Q: Write multiple if statements: If car_year is before 1968, print "Probably has few safety features."…
A: The source code of the program car_year=int(input())if car_year<1967: print("Probably has few…
Q: QI) Give a short answer (Choose five branches): a) What is the meaning of the data encryption in…
A: “Since you have posted multiple questions, we will provide the solution only to the first five…
Q: 5. Using the languages L1 and L2 from the previous problem, enumerate the first 6 strings in the…
A: Introduction:- L1={ 011, 101, 110 } L2={ 00, 100, 001 }
Q: I'm working on a Visual Studio Code project on Inheritance. Create a new project. So you'll have…
A: Here's an example of how you can connect the Vehicle.cs file to the Program.cs file: Vehicle.cs:…
Q: why after run show me exit status 1
A:
Q: Add string conversion operations to the following print statement such that it prints aaaaa525252 to…
A: print(a * 5+ (5 + 2)*3) Output:- aaaaa525252
Q: namespace std; // function to print the menu void printMenu() { cout<<"Program 1: Gladiolus"<<endl;…
A: I have included a function named printSpace() which will only print blank spaces instead of :.
Q: All functions must be designed to accept at least one argument. O That's true. O That's untrue. *
A: The solution is given below with explanation
Q: 15.On a continental tour, a traveling salespersonmakes software-based presentations at everyplace he…
A: Hard drives are portable and affordable storage devices.
Q: Write a function to convert the Roman Numeral list to Hexidecimal.
A: Lets define a function called roman_to_hex that will take a list of roman numbers from user and…
Q: I need the python code for this system of differential equations. I have the octave code. In 1995,…
A: According to the question, We have to write python code for the following equation:
Q: 4. Consider the following languages over {0, 1}: L₁ = {w: w contains more 1's than 0's and |w| £ 3}…
A: Please refer to the following steps for the complete solution to the problem above.
Q: How would you accomplish the following task using a loop in Python (enter your code in the text…
A: Algorithm : 1. Start 2. Set variable 'i' equal to 1 3. Use a for loop to iterate through the range…
Q: Proposition Show that the marking algorithms LRU and FWF are.
A: Intruduction: a special online algorithm family for the paging problem called marking algorithms.…
Q: Write a complete program for finding a longest common substring:
A: Brute Force implementation for the above problem in R programming. # Function to find the length of…
Q: 3.1.1: Cardinality and equality of sets. Jump to level 1 Fill in the missing value such that A = B A…
A: Your answer is given below with an explanation.
Q: Create a binary file with name and roll number of student and display the data by reading the…
A: A python Program for binary file with name and roll number of student and display the data by…
Q: Let's say you have bought a new 16GB pen drive. When you plug it into the computer, you notice that…
A: The reason for the difference in memory size of a pen drive can be attributed to several factors.…
Q: Talk about how processes and threads are scheduled and what parallels and distinctions there are…
A: In an operating system, both threads and processes are scheduling units. They differ in terms of…
Q: 3.2.1: Sets of sets and power sets. zqy7 Jump to level 1 A = {4,7,1} P(A) = {0, {4}, {7}, {Ex: 5 {4,…
A: Power set is the group of all possible subsets. So it will include empty set and original set as…
Q: f i want to add in the program in visual studio web application forms to detect an Ir sensor going…
A: Here's an example of code that you can use to detect an IR sensor connected to an Arduino in a…
Q: Let us define the custom tribonacci sequence as follows. To = A T₁ = B T₂ = C Ti = Ti-3 + Ti-2 +…
A: In this question we have to write a program for the Custom Tribonacci Sequence as per the given…
Q: An 'expression' in programming is... * O any code that performs an operation using a single…
A: In programming languages expression termed as value which will get after running chuck of code or…
Q: Write a function to convert the Roman Numeral list to Hexidecimal. DCXXXVII DCCXXXIII CMLXXXIII…
A: Introduction Function: Function is a block of code that performs a specific task and is reusable,…
Q: Problem1- Heap insertion and trickle-up Initial list A 42 78 3 we propose to first heapify the…
A: The correct answer for the above mentioned question is given in the following steps for your…
Q: Please help me on the questions below. This are questions on Discrete mathematics. Please help…
A: Below is the complete solution with explanation in detail for the given question about sets and…
Q: Various Operating Methods: Here, we'll go further into each of the four memory allocation strategies…
A: The process of assigning physical or virtual memory space to computer applications and services is…
Q: Sites like Zillow get input about house prices from a database and provide nice summaries for…
A: The following program in Python calculates and outputs the current price, change in price since last…
Q: Prove that, for any sets A and B, it is true that AU(ANB) = A. Hint. You must do lhs ≤ rhs and rhs…
A: Given that, A∪(A∩B)=A In this expression, the sets are A, B.
Q: how to add in visual studio web application forms using serialPort to read the ir sensor from the…
A: Below is the complete solution with explanation in detail for the given question about adding…
Q: QUESTION 2 Which of the following is NOT secondary storage device? random access memory solid state…
A: Introduction : A secondary device is a computing device that is used in addition to a primary…
Q: F(L) = {0¹¹ a0¹ |a € A, n >0} Consider the condition that A is the language over {0, 1}. Using the…
A: Given language is, F(L)= {0na0n | a∈ A, n>=0} In this language, set of input alphabets are {0, a}
Q: 1.Perform penetration and vulnerability testing on partners with which you share your data…
A: Penetration testing and vulnerability testing: Penetration testing (pen-testing) is a security…
Q: Modify the quicksort function so that it calls insertion sort to sort any sublist whose size is less…
A: Here's an implementation of the original and modified quicksort algorithm: import timeimport…
Q: When using a 40 bit long secret key with a symmetric encryption algorithm, how many possible values…
A: Given that key is 40 bits long and each bit can only represent either one or zero. So for each bit,…
Q: 462500.3140334.qx3zqy7 Jump to level 1 Write an if-else statement for the following: If…
A: Program Approach: Step 1: Create a user input integer variable num_difference for taking integer…
Q: IN c++ pretty please ; apply_Irvine_libs.asm - A simple test program calling various Irvine…
A: In this problem we need to design the code to solve this given problem in the given programming…
Q: Convert the following measurements 2,500,000 A KA
A: here is the solution.
Q: D denotes Decimal, B means Binary, and H means Hexadecimal number, respective. 1. Perform the…
A: “Since you have posted multiple questions with multiple sub-parts, we will provide the solution only…
Q: Let M=({a, b, c, d, e}, {0,1), a, fs, {b, d}) be the DFA and f, is given by: لبه fs a b CP с d 0 a с…
A: the answer is an shown in the below picture :
Q: One out of a thousand Coke bottles you have is poisonous. You have ten test strips that you may use…
A: In this question we have to discuss a strategy for identifying a poisoned bottle among 1000 bottles.…
Q: ep/9 assembly language program that corresponds to the followin
A: Consider the given code : char ch;int main () {scanf("%c", &ch);ch--;printf("%c\n",…
Q: a, d and, f Fast pls i will give u like for sure solve this question correctly in 5 min
A: - We need to talk about the order of growth in functions a, d, f.
Q: Good access control policies require what two properties? Group of answer choices A smart user clear…
A: Access control policies: Access control policies are rules and regulations that are put in place to…
Q: Read floating-point numbers from input until a floating-point number is read that is not in the…
A: Algorithm of the code: 1. Create a variable to hold the user input and a variable to hold the sum of…
Q: in sonography, what challenges do you think you might have in regards to the code of ethics? 2.…
A: Introduction The answer to the aforementioned question is provided for your convenience in the step…
Q: Write a program that converts Celsius temperatures to Fahrenheit # temperatures. The formula is as…
A: 1) Since programming language is not specified I have written program in python 1) Below is program…
Q: List only the movies that have a value for gross (not NULL values). Include all columns in the…
A: The SQL query you provided is used to retrieve data from the "movies" table. The query selects…
Q: I can't see the screenshots. Is there anyway you can can make them available?
A: Following is the program and output as per your requirement check if screenshots are visible now.…
Step by step
Solved in 2 steps
- Write a function numRolls that simulates the following dice game: a player repeatedly rolls a pair ofdice until the second time that doubles is rolled. The function then returns the total number of rollsmade. For example, suppose the player rolls the following pairs: (3,2), (3,3), (1,5), (5,5). The game thenstops because the player has rolled doubles twice, (3,3) and (5,5). The function returns 4, the totalnumber of rolls made: Use python6...Consider the definition of the function main. int main() { double rate, hours, amount; . . . } Each of the functions described must have the appropriate parameters to access these variables. Write the following definitions: a. Write the definition of the function getHoursRate that prompts the user to input the hours worked and rate per hour to initialize the variables hours and rate of the function main. b. Write the definition of the value-returning function payCheck that calculates and returns the amount to be paid to an employee based on the hours worked and rate per hour. The hours worked and rate per hour are stored in the variables hours and rate, respectively, of the function main. The formula for calculating the amount to be paid is as follows: For the first 40 hours, the rate is the given rate; for hours over 40, the rate is 1.5 times the given rate. c. Write the definition of the function printCheck that prints the hours worked, rate per hour, and the salary. d. Write the…Q. Please solve this C++ program and show all the steps. (kindly do not use any advanced coding or coding info from any other program. Don't copy from other sources too) a) Add a new function convMonth to the class Date that returns the month in letters (e.g., January, February, etc.). b)Add a function that prints the date using the following format: Month dd, yyyy . Example, January 21, 2023 c) Test the new functions of the class Date by creating dynamically (i.e., using pointers) two objects of the class Date and invoking the new member functions on both objects. Deliverables: date.h, date.cpp, testdate.cpp. (any description or thought process of this coding problem will be really useful, particularly in part c) please let me know if there's any way I could contact you for further assistance,( please!) Thank you !
- Hi, OCaml programming 1. Create a type slidingTile, consisting of a char matrix and two integers xand y. The integers x and y are the coordinates of an empty tile. 2. Create a function val slide : slidingTile -> int -> int -> slidingTile = <fun> that given a slidingTile and two integers, that represent a location in thematrix, it slides the tile from the specified location to the empty tile, thenreturns the altered slidingTile. If provided location is not adjacent to theempty tile, or out of bounds, then return the slidingTile unaltered. 3. Create a function val print_tile : slidingTile -> unit = <fun> that prints a slidingTile on screen with the corresponding characters fromthe matrix. However, print an empty space where the empty tile is instead.1. Write a function which takes one parameter int num, and prints out a countdown timer with minutes and seconds separated by a colon (:). It should print out one line for each second elapsed and then pause one second before printing out the next line. A few things to note: - You can assume that calling the function usleep(1000000) makes the program pause for one second - It should count down from num minutes:zero seconds to zero minutes:zero seconds - Your function must have the following signature: void timer(int num) You do not need to demonstrate calling this function from main(). You don't need to format the output nicely; the below is acceptable output for calling this function when minutes is 10: 10:0 9:59 9:58 … 9:1 9:0 8:59 8:58 … 0:2 0:1 0:0ASSIGNMENT Consider the following function. What is the purpose of the function f? Please do explain and describe in details all possible answers for this function given below.int f(int n) {if ((a >= b) && (c < b)) return b; else if (a >= b) return f(a, c, b); else return f(b, a, c);} To find the maximum number between a, b, and c. To find the middle number between a, b, and c. To find the minimum number between a, b, and c. None of the other statements. Suppose the letters a,b,c,d,e,f have probabilities of 1/2, 1/4, 1/8, 1/16, 1/32, 1/32 respectively. Which of the following is the Huffman code for the letter a,b,c,d,e,f? Please show how is the Huffman tree, so that you can determine one of the options below. 0, 10, 110, 1110, 11110, 11111 11, 10, 01, 001, 0001, 0000 11, 10, 011, 010, 001, 000 110, 100, 010, 000, 001, 111 An adjacency matrix of a graph is given below: matrix at photoFirst, draw the graph defined by that adjacency matrix, and label the…
- Consider the definition of the function main. int main() { double rate, hours, amount; . . . } Each of the functions described must have the appropriate parameters to access these variables. Write the following definitions: a. Write the definition of the function getHoursRate that prompts the user to input the hours worked and rate per hour to initialize the variables hours and rate of the function main. b. Write the definition of the value-returning function payCheck that calculates and returns the amount to be paid to an employee based on the hours worked and rate per hour. The hours worked and rate per hour are stored in the variables hours and rate, respectively, of the function main. The formula for calculating the amount to be paid is as follows: For the first 40 hours, the rate is the given rate; for hours over 40, the rate is 1.5 times the given rate. c. Write the definition of the function printCheck that prints the hours worked, rate per hour, and the…def rectangle_overlap(rect1_bl_x,rect1_bl_y, rect1_tr_x,rect1_tr_y, rect2_bl_x,rect2_bl_y, rect2_tr_x,rect2_tr_y): """ (int,int,int,int,int,int,int,int) -> str Function determines whether two rectangles overlap. When rectangles overlap, the function checks for the following scenarios 1. The two rectangles share the same coordinates 2. The first rectangle is contained within the second 3. The second rectangle is contained within the first 4. The rectangles have overlapping area, but neither is completely contained within the other Function inputs represent x and y coordinates of bottom left and top right corners of rectangles (see lab document) The function return one of the following strings corresponding to the scenario "no overlap" "identical coordinates" "rectangle 1 is contained within rectangle 2" "rectangle…(Fibonacci) The Fibonacci series0, 1, 1, 2, 3, 5, 8, 13, 21, …begins with the terms 0 and 1 and has the property that each succeeding term is the sum of the twopreceding terms. a) Write a nonrecursive function fibonacci(n) that calculates the nth Fibonaccinumber. Use unsigned int for the function’s parameter and unsigned long long int for its returntype. b) Determine the largest Fibonacci number that can be printed on your system.
- Consider the following function definition: void too2(int a[ ], int howMany) { for (int index = 0; index < howMany; index++) a[index] = 2; } Which of the following are acceptable function calls? int myArray[29]; too2(myArray, 29); too2(myArray, 10); too2(myArray, 55); "Hey too2. Please, come over here." int yourArray[100]; too2(yourArray, 100); too2(myArray[3], 29);C++ PLEASE WRITE FULL FUNCTION DEFINITION for THE FUNCTION IN PART B Given the Class Definition for ClockType discussed extensively in class, write what would have to be added to the IMPLEMENTATION FILE for the Class ClockType to overload the “= =”, i.e., the comparison “equal-equal sign,” here: That is, write the FULL FUNCTION DEFINITION for THE FUNCTION associated with Class ClockType to overload the “= =” remembering the private members are: b) int hr; // that contains the hours int min; // that contains the minutes int sec; // that contains the secondsSuppose that you are required to check if two tran carts have equal stacks of cargo. Explain how you are going to archieve this by overloading the equality operator. Create a function to overload this operator that accommodates any data type.