What is output by the code below? Score = 200 highScore if score > highScore: print("You beat the high score by", score-highScore, "points!") else: print("You needed", highScore =310 score, "points")
Q: What is the output of the following code? int x = 5, y = 3, and z = 1; if (x z)…
A: Given code int x=5, y=3 and z=1; if(x<y) if(y>z) System.out.println("X<y and y<z");…
Q: This method simulates the playing of one round of “Rock Paper Scissors”. In this strange version of…
A: Below is the required program: - Approach: - Import the package to use the Scanner class and define…
Q: Write a code to perform card counting. First you have to evaluate the card whether it is Ace (A),…
A: For the above question a description is given for which we have to take the user input of card type.…
Q: Write a program that asks for the names of three runners and the time it took each of them to finish…
A: #include<iostream>using namespace std;int main(){ char r1[20], r2[20], r3[20]; int t1,…
Q: Write a code snippet to prompt a user to enter two words. Then, pass these values as parameters in a…
A: Start. Read two words. Pass these two to the functions. Check for the number of upper and lowercase…
Q: What is the value of 3 after all the lines below finish executing? int i = 0; int j = 0; while (i <…
A: We are given a c++ code, and we are going to find the value of j. Logic: i loop will run from 0 to…
Q: Suppose that speed is a variable of type double and you want to assign Math.round(speed) to the…
A: Suppose that speed is a variable of type double and you want to assign Math.round(speed) to the…
Q: This method simulates the playing of one round of “Rock Paper Scissors”. In this strange version of…
A: Below is the complete Java program: - Approach: - Import the package to use the Scanner class and…
Q: The source code, written in pseudo code below, write down the minimal set of tests that would help…
A: Below is the complete solution with explanation for the given question for statement coverage with…
Q: What would be the result of y the following line of code? y= 10 *2 - 9 + 4; 15
A: Code in python :- y = 10 * 2 - 9 + 4print(y) Output:-
Q: How do I fix the error in the code? Error: Error ---------- Movie.toString() returns: Movie: […
A: code is given below:
Q: can you please write it in java.scanner.util form The Fast Freight Shipping Company charges the…
A: For every 500 miles the charges applies So, you can divide the distance by 500 and get the rate
Q: Suppose that the input is 0 5 6 4 9 8 –1. What is the output of the following code? (2, 3) Submit…
A: PROGRAM: //Header file #include <iostream> //Using namespace using namespace std; //Defining…
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: Analyzing the following code fragment, ends up with y equals to? x2; y =2; switch (x +2) { case 4: y…
A: switch statement is a branching statement which uses case to flow control.
Q: Write an application that asks the user to enter two integers and displays “The two numbers you…
A: Question. Write an application that asks the user to enter two integers and displays “The two…
Q: Write an application that allows a user to enter any number of student quiz scores, as integers,…
A: Introduction of the Program: This C++ program takes score from the user and if scores are between…
Q: What is the output of the following code snippet? print(not(3>4)) print(not(1&1)) print(not(4>8))…
A: 'not' is a logical operator in python. not operator reverse the result. If the result is true, not…
Q: The position x as a function of a particle that moves along a straight line is given by: x(t) = -…
A: Since no programming language is mentioned, I am using matlab. Code: syms…
Q: In the code given below, the values of installment1.dueDate and installment2.dueDate is getting…
A: Debug the given JavaScript code such that there is a difference of 5 months in the dueDate of the…
Q: ou are in a job where you earn a tip for service. You need a Java program that will calculate how…
A: Here I have taken input from the user and stored it into different variables. Next, I have used the…
Q: What kind of statement is this? If it is a dog (d), it has fleas (f).
A: Given: What type of statement is this?
Q: I always find myself asking at the end of the month, “Where did all that money go?" I'm sure this…
A: Purpose of the program: This program prompts the user to enter the number of categories for which…
Q: För System.out.println(“Hello World");
A: The above code is written in java programing language. To run the for loop in a finite way
Q: In Python User input must be 8 characters or shorter, and must be printed out in all capitals.…
A: Program outline: Ask user for input Find length of string If the user uses less than 8 characters:…
Q: The value of x is 3 at the beginning, if you are writing a computer code like below, what is the…
A: Introduction: An if statement is a programming conditional statement that, if proved true,…
Q: Write a program that calculates how much money you’ll end up with if you invest an amount of money…
A: In Cpp Program #include <iostream>#include <cmath>using namespace std; int main(){int…
Q: You have a red lottery ticket showing ints a, b, and c, each of which is 0, 2. If they are all the…
A: Given:
Q: Write a method named presentValue that performs this calculation. The method should accept the…
A: We know that the amount we get for a principal P after t years is P + PTR/100 So, according to the…
Q: Output the classic (albeit slightly modified) drinking song. 99 bottles of Pepsi on the wall, 99…
A: Given: Output the classic (albeit slightly modified) drinking song. 99 bottles of Pepsi on the wall,…
Q: Write a code snippet that reads a number and displays the square, cube, and fourth power with the…
A: As the question has asked about the math. Pow method, I have used Java program which has the math…
Q: This program does not throw an error, but when an odd number is input for the variable number, it…
A: Java Program for above : import java.util.Scanner; public class NumbersDemo2 { public…
Q: What is the output of the following code? int x = 0; if (x < 4) {…
A: Given: What is the output of the following code? int x = 0; if (x < 4)…
Q: Write a program that prompts the user to enter the distance todrive, the fuel efficiency of the car…
A: Program Plan: importing the libraries of utility class for scanner and other mathematical…
Q: If you run this piece of code, you will get an error. Why? a = [0 1 2 3 4 5 6 7]; a = a^2; ro
A:
Q: Assignment4C Heads or Tails? It is said that a perfectly fair coin will return heads 50% of the…
A: A program that prompt the user for a number of flip coins :-
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: ould change if you see the above variable declar
A: var x = “blue”; is there anything that you would change if you see the above variable…
Q: Tracking your BMI is a useful way of checking if you're maintaining a healthy weight. It's…
A: Note: Answering the question in python as no language is mentioned. Input : Weight of the person.…
Q: If the number of items bought is less than 5, then the shipping charges are $7.00 for each item…
A: Correct code Here shipping charges are $7.00 for each item, if the number of items is less than 5.…
Q: What is the output of the following ?code for i=1:4 for j=1:4 a=5;a=a+5; end end
A: Answer: 10 The output will be 10.
Q: 2. Write two (2) overloaded methods that will compute the total price of an item. Use the total item…
A: Step-1: Start Step-2: Create a class Program Step-2.1: Create a function priceOfItems and item &…
Q: To calculate VAT on a price without VAT, you can use the formula: VAT = VAT Rate ∗ price Without VAT…
A: Objective: This program determines the VAT on a given price without VAT using the formula,VAT =…
Q: What is the value of maxNumber after the code that follows is executed?int number = 0;int maxNumber…
A: The program is a Java program which uses function random to generate random numbers between 0 and 1.…
Q: The following code results in an error message. What will the error message be and how can it be…
A: First error that we encountered is :- shown below :- File "<string>", line 2 return p1 + p2…
Q: write a pseudo code and read a patient number, blood pressure figures (systolic or diastolic), and…
A: To write: To write a java program that displays the level of cholesterol and its level using the…
Q: method simulates the playing of one round of “Rock Paper Scissors”. In this strange version of the…
A: Rock, Paper, Scissors (sometimes called roshambo) has been a staple to settle playground…
Q: How many times will the output line be printed in the following code snippet? Please enter your…
A: For every outer loop execution inner loop executes 4 times(since k=0 to k<=3)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Please leave the fixed code and comments, thank you! 1. The following code should print out a random number between 1 and 10, why will it not function correctly? from random import randintprint (randint(10, 1)) 2. Why does the following code not return the expected value? def calcDiscountPrice(price, percentage): discount = price * percentage discountPrice = price - discount return discount 3. Why does the following code not return the expected value? def main():value = int(input("Enter number:"))tenPercent(value)print ("Ten percent is ", result)def tenPercent(num):return num * .1main()Complete the code that returns the value of ?(?)f(x), which has the value 1 inside the range −1≤?≤1−1≤x≤1 otherwise it is the value 0. ?(?)={1, ?∈[−1,1]0, otherwiseCan you please anser both of these questions listed below? Thank you! Program is Pyhton import randomimport math Which of the following will assign a random integer from 30 to 90, inclusive, to var?Select ALL that apply. Question 2 options: var = random.randrange(30,90) var = random.randint(30,90) var = math.randint(30,90) var = random.randrange(30,91) var = random.randint(30,91) def area(side1, side2): return side1 * side2s1 = 12s2 = 6Identify the statements that correctly call the area function. Select ALL that apply. Question 5 options: result = area(side1,side2) print(f'The area is {area(s1,s2)}') answer = area(s1,s2) area(s1,s2)
- In the code given below, the values of installment1.dueDate and installment2.dueDateis getting printed same but I want a difference of 5 months in both the dates.Please debug the code so that it gives correct output. var installmentDate = new Date();const installment1 = { "dueDate": Date(installmentDate), "paid":false };console.log(installment1.dueDate);installmentDate.setMonth(installmentDate.getMonth() + 5);const installment2 = { "dueDate": Date(installmentDate), "paid":false };console.log(installment2.dueDate);In the given code, the values of installment1.dueDate and installment2.dueDateis getting printed same but I want a difference of 5 months in both the dates.Please debug my code so that it gives correct output. var installmentDate = new Date();const installment1 = { "dueDate": Date(installmentDate), "paid":false };console.log(installment1.dueDate);installmentDate.setMonth(installmentDate.getMonth() + 5);const installment2 = { "dueDate": Date(installmentDate), "paid":false };console.log(installment2.dueDate);Write an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If the score entered is less than 0 or more than 10, display Score must be between 10 and 0 and do not use the score. After all the scores have been entered, display the number of valid scores entered, the highest score, the lowest score, and the arithmetic average.
- A first year level 100 first semester student wrote the code below but could not tell whether it will execute or not. Assuming you are in a group discussion and the issue came up, determine giving reasons why it will or will not run. How else will you initialize the variables and explain your answer? struct ShattaWale { int brukutu = 0; dourble AlomoBitters = 0; };What is the value of maxNumber after the code that follows is executed?int number = 0;int maxNumber = 0;for (int i = 0; i <= 10; i++) { number = (int)(Math.random() * 100); if (number >= maxNumber) { maxNumber = number; }} a. the largest of ten random numbers from 0 to 99 b. the largest of eleven random numbers from 0 to 99 c. the largest of ten random numbers from 100 to 1000 d. the largest of eleven random numbers from 100 to 1000int y = !(12 < 5 || 3 <= 5 && 3 > x) ? 7 : 9 Based on the code above, what is the value of y if x = 1?
- In this program, create a method with the following signature: public static double getAverage(double d1, double d2, double d3, double d4, double d5) This method will accept five doubles and return the average. Also in program, create a method with the following signature: public static char determineGrade(double avg) This method will take an average, then return the corresponding letter grade. Write in java and use test case# as an example.Write an application that prompts the user for two integers and then prompts the user to enter an option as follows: 1 to add the two integers, 2 to subtract the second integer from the first, 3 to multiply the integers, and 4 to divide the first integer by the second. Display an error message if the user enters an option other than 1 through 4 or if the user chooses the divide option but enters 0 for the second integer. Otherwise, display the results of the arithmetic.What is the output? #include <stdio.h> int main(void) { double dividend = 0.0; double divisor = 0.0; printf("%lf\n", dividend / divisor); dividend = 3.0; printf("%lf\n", dividend / divisor); return 0; } Question 5 options: inf nan nan inf inf 0.0 nan 0.0