Why does the following code not return the expected value? def calcDiscountPrice(price, percentage): discount = price * percentage discountPrice = price - discount return discount
Q: What is the final value of variable myNum after the following code fragment executes? int myNum 0;…
A: [Please note that here, we are adding a code statement that will display the value of the myNum…
Q: Analyze the following code. Is count < 100 always true, always false, or sometimes true or…
A: The collect program below Point A is always true in this program #include <iostream>using…
Q: What values are returned by each of the following?a. Math.round(2.3)b. Math.round(2.7)c.…
A: Math.round() method In Java, the Math.round() function is used to round numbers to the nearest…
Q: L DRAW ACTIVI T Y.
A: Here is the answer below:-
Q: What is the value of x in the given code? def getX(num): if num > 10: return 10 else: return 20 x =…
A: b. x = 20 Explanation:- the parameter for getX is 5. So, num =5 condition: if num > 10 then…
Q: Python please. so this code is in the split method, how would I re write in the find/in/endswith…
A: Answer: Python Source Code: import redef end_finder(ipString, endString): return…
Q: How many times does the following code execute? err=l; count=0; while err>0.25 count=count+1; end…
A: A) Infinetely many
Q: Which of the following option is correct? Public static int sum(int[] theArray, int cell) { Iff(???)…
A: Correct answer: Java C#if(cell>theArray.length-1) if(cell>theArray.Length-1) Explanation- Here…
Q: public static int myMethod (int y, int z) { if (y > z) return y * z; else return myMethod (y - 2,…
A: In this problem, we need to give a condition when will the stack overflow condition will occur.…
Q: GetContestantNumber - This method gets and returns a valid number of contestants and is called twice…
A: Actually, given information: GetContestantNumber - This method gets and returns a valid number of…
Q: Complete the code that returns the value of ?(?)f(x), which has the value 1 inside the range…
A: Given that, given function f(x), which has the value 1 inside the range -1≤x≤1 otherwise it is the…
Q: // calculating power i.e., base^degree (2.0)^10=1024.0 // Note: you cannot use existing Math.pow()…
A: Required :- // calculating power i.e., base^degree (2.0)^10=1024.0 // Note: you cannot use existing…
Q: in c# please Write method QualityPoints that inputs a student’s average and returns 4 if the…
A: As per the requirement program is developed. Algorithm: Step 1: Write the main method. Step 2:…
Q: What will be the result after executing this statement: SELECT UPPER('Bakhit Said Ahmed') FROM dual?…
A: UPPER(): The UPPER() function in SQL converts a string to upper-case.
Q: What is the final value of variable myNum after the following code fragment executes? int myNum = 0;…
A: From the above given options Option B will be the correct answer Explanation: As we can see in the…
Q: n netbeans, Write a method named costAfterDiscount that is passed 2 double parameters named Cost…
A: Dear Student, Your asked method is provided below
Q: What is the value of balance after the following code is executed? int balance = 10; while…
A: Step 1:- Program:- #include <iostream>using namespace std;int main(){ int balance = 10;…
Q: This is only for python, code the progam. This program should record products and see how much…
A: 1) Below is program to record products and see how much money is spent on each. Add missing method…
Q: What would be the value of bonus after the following statements are executed? int bonus, sales =…
A: According to the question Output:
Q: Will the following statement cause an error? Why or why not? string luckyNumber = 7;
A: Error: “Yes”, the given code causes an error.
Q: What is the value of donuts after the following code executes? int donuts = 10;…
A: The "if" statement is a control statement that will test a condition before the control executes the…
Q: In the Card1 class, the compareTo() method orders cards by first comparing the card’s suits and then…
A: What is the level of suits in poker?There is no color scale in normal poker to match hands. If two…
Q: How would you calculate the odds of customer winning a single purchased Lotto Game? Well, what are…
A:
Q: Debug the section of code that follows. Check the code carefully for all 10 errors and list the…
A: ERRORS : 1) Line 3: There is no datatype named integer, rather it is called int 2) Line 4: There is…
Q: String[] name={"John", "Mary", "Jim", "Sam"}; Which choice is correct? Group of answer choices…
A: String Datatype: The datatype is a set of values and each datatype have its own purpose. Based on…
Q: The makeABid method includes the following two statements: Bid bid = new Bid(bidder, value); boolean…
A: In this problem, we will discuss about creating an anonymous object.
Q: Rewrite the below Java assignments in the correct version. char aChar = 5.5; i. if (salesAmount >10…
A: Please find the answer and a sample program below. Then the program contains the examples of all the…
Q: You use a shopping list when you're buying groceries. groceries = {"chicken": 8, "apples": 6,…
A: Answer: Pythin Source Code: groceries = {"chicken":8,"apples":6,"cucumbers":3,"milk":2,"orange":4}…
Q: Java Your program will read in a credit card number and expiration date from the user and validate…
A: The program makes use of Scanner class defined inside java.util package. The syntax for it is:…
Q: What will be displayed on the console when j = 2 in the following code segment? You can give an…
A: Given a code snippet: cout<<"Value of j = "<<j<<endl; for(int…
Q: How many times 'p' value will be printed by running the following code? p = 2 while p <= 10: priht…
A: Explanation: Given: p = 2while p<=10: print("p=",p) p = p+2output:So clearly p will print 5…
Q: Need help writing the following method: getCourseSize() – returns the number of students registered…
A: From the given program, we can see that we have a students table. To implement the requirements, we…
Q: What is output by the following code segment ? (Supposed all variables are declared as int) count =…
A: The output of the given code segment is as follows: 0 00 000…
Q: If you use following form This will be a GET method O True O False
A: <form action="postpage.php"> this will be a GET method True
Q: What is the value of average after the following code? int x, sum = 0,…
A: Here we have declared three variables. Next, we have a loop that generates numbers from 0 to 5,…
Q: In this lab, you are asked to implement two methods, power and factorial, and then test these…
A: public class Main{public static void main(String[] args) { System.out.println(power(5,4));//testing…
Q: Create a method which takes two int parameters and swaps them. Print the values before and after…
A: java Code for above (will work on intellij perfectly) : import java.util.Scanner; class Prog{…
Q: public String getCustomerId(){ return customerId; } public void…
A: 1- First, need to import the Junit jar file. There is two jar file required for test the Junit…
Q: What value is printed after the following statements are executed? mylist = ['HELLO'] * 5…
A: Given :- What value is printed after the following statements are executed?mylist = [ 'HELLO '] *…
Q: will the variable declarations will cause an error? Why? double boxWidth = 205.25;
A: The data type double is used for double precision 64 bit IEEE 754 floating points. It used for…
Q: Answer the following true/false questions using the following code. And state why it is true or…
A: 1. Yes we can tell what type of variable match is by seeing the above code. True 2. Yes we can tell…
Q: Write the method header for a method named ShowRetailPrice. The method should include parameter…
A: We create a private method called "ShowRetailPrice" We need to include parameters for list price and…
Q: JAVA ONLY Please create a code that checks if 'user' favourite game is in the top 3 games. if the…
A: By defining array and using for loop we can solve this problem.
Q: What the value of decLoopVariable after the third time through this loop? Dim…
A: Please find the answer below :
Q: The special case return value that will terminate the following code i
A: The special case return value that will terminate the following code is ____________________. int…
Q: Q2) write a java code to calculate the average for 3 student (each student has 5 subjects) and…
A: The marks for the students are in the range 0 to 50, with 50 being the highest marks. The Java…
Q: The code I am using will not return the correct type. For example the expected answer is [1] and my…
A: I correct the code ,give the correct code ,correct output screenshot ,code screenshot and I also…
Q: What does the following code do? In [1]: def mystery (a, b) : if b == 1: ...: return a else: return…
A: recursion is used here.
Q: What is output by the code below? Score = 200 highScore if score > highScore: print("You beat the…
A: You needed 110 points
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Why does the following code not return the expected value?
def calcDiscountPrice(price, percentage):
discount = price * percentage
discountPrice = price - discount
return discount
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Compare userNumber with compareNumber and display 'Numbers are not equal' if the numbers are different. Then, display 'Variables are not identical' if the variables are not identical (not strictly equal). let compareNumber = 3; // Code will be tested with: 3, 8, 42let userNumber = '3'; // Code will be tested with: '3', 8, 'Hi'Using C++ Language Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NUM_VALS elements. Ex: If userValues is {2, 1, 2, 2} and matchValue is 2 , then numMatches should be 3.Your code will be tested with the following values:matchValue: 2, userValues: {2, 1, 2, 2} (as in the example program above)matchValue: 0, userValues: {0, 0, 0, 0}matchValue: 10, userValues: {20, 50, 70, 100} code: #include <iostream>using namespace std; int main() { const int NUM_VALS = 4; int userValues[NUM_VALS]; int i; int matchValue; int numMatches = -99; // Assign numMatches with 0 before your for loop cin >> matchValue; for (i = 0; i < NUM_VALS; ++i) { cin >> userValues[i]; } /* Your solution goes here */ cout << "matchValue: " << matchValue << ", numMatches: " << numMatches << endl; return 0;}Member Methods are: • To calculate and find Dearness Allowance (DA) - (DA - 30% of basic salary), • To calculate and find House Rent Allowance (HRA) (35% of basic salary in case the basic salary is > 400, otherwise it is 30% of basic salary), • To calculate and find Gross_salary (Basic + DA + HRA),
- int pid1 = fork(); int pid2 = fork(); printf("PID: %d %d\n", pid1, pid2); Output with explanationdef calcDiscountPrice(price, percentage): discount = price * percent discountPrice = price - discount return discount Why can't I get this to show the discount?Marketing person contains the values { total product sales, commission rates, person base salary}. Write a pseudo code for using that values of makerting person.
- Implement all the classes using Java programming language from the given UML Class diagram. Note: This problem requires you to submit just two classes: Customer.java, Invoice.java. Do NOT include "public static void main()" method inside all of these classes. Graders will be testing your classes, using the unit-testing framework JUnit 4. Customer - ID:int -name:String -discount:int Discount rate in percent +Customer(ID:int,name:String, discount:int) +getID():int +getName ():String +getDiscount():int +setDiscount(discount:int):void +toString():String "name (ID)" The Customer class models, a customer design as shown in the class diagram. Write the codes for the Customer class and a test driver to test all the public methods. Invoice - ID:intNote: passing value without return anythingPayment = Principal [rate ((1 + rate)months)] [(rate + 1)months - 1] For the formula to compute monthly payment, see Listing 2.9, ComputeLoan.java. (Financial application: loan amortization schedule) The monthly payment for a given loan pays the principal and the interest. The monthly interest is computed by multiplying the monthly interest rate and the balance (the remaining princi- pal). The principal paid for the month is therefore the monthly payment minus the monthly interest. Write a program that lets the user enter the loan amount
- VBA - EXCEL Engine – optional – this indicates the solving method that needs to be used to get to a solution. 1 for the Simplex LP method, 2 for the GRG Nonlinear method, or 3 for the Evolutionary method. This corresponds to the Select a Solving Method dropdown list in the Solver Parameters dialog box EngineDesc – optional -this is an alternate way of selecting the solving method – here you would type the strings “Simplex LP”, “GRG Nonlinear” or “Evolutionary”. This also corresponds to the Select a Solving Method dropdown list in the Solver Parameters dialog box What happens when the code demonstrates: Engine:=1, EngineDesc:="GRG Nonlinear" ?Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NUM_VALS elements. Ex: If userValues is {2, 1, 2, 2} and matchValue is 2 , then numMatches should be 3. Your code will be tested with the following values:matchValue: 2, userValues: {2, 1, 2, 2} (as in the example program above)matchValue: 0, userValues: {0, 0, 0, 0}matchValue: 10, userValues: {20, 50, 70, 100} In JavaAssign numMatches with the number of elements in userValues that equal matchValue. userValues has NUM_VALS elements. Ex: If userValues is {2, 1, 2, 2} and matchValue is 2 , then numMatches should be 3.Your code will be tested with the following values:matchValue: 2, userValues: {2, 1, 2, 2} (as in the example program above)matchValue: 0, userValues: {0, 0, 0, 0}matchValue: 10, userValues: {20, 50, 70, 100} CODE: import java.util.Scanner; public class FindMatchValue {public static void main (String [] args) {Scanner scnr = new Scanner(System.in); final int NUM_VALS = 4;int[] userValues = new int[NUM_VALS];int i;int matchValue;int numMatches = -99; // Assign numMatches with 0 before your for loop matchValue = scnr.nextInt();for (i = 0; i < userValues.length; ++i) {userValues[i] = scnr.nextInt();} /* Your solution goes here */ System.out.println("matchValue: " + matchValue + ", numMatches: " + numMatches);}}