The following code displays double temperature = 42; if (temperature <= 5) System.out.println("too cold"); else if (temperature >= 35) System.out.println("too hot"); else System.out.println ("just right"); too cold O just right too hot too cold too hot just right
Q: def area(side1, side2): return side1 * side2 s1 = 12 s2 = 6 Identify the statements that…
A: A. print(f'The area is {area(s1,s2)}') B. answer = area(s1,s2) D. area(s1,s2)
Q: Write a C++ program to convert kilometers to miles or miles to kilometers. The user will choose…
A: Define functions to get the number of kilometers, get the number of miles, convert kilometers to…
Q: In the Raptor program Write a program that lets the user play the game of Rock, Paper, Scissors…
A: Description of the program 1. When the program begins, a random number in the range of 1 through 3…
Q: What does the following code display: int value = 41; System.out.printın ( "Incrementing value: " +…
A: Here, we have given the java code. We need to complete the whole code in order to extract the output…
Q: Java Program
A: I have provided JAVA CODE along with CODE SCREENSHOT and OUTPUT…
Q: Write a if-elif-else statement that distinguishes between a negative number or 0, a number between 0…
A: The elif is also known as else if. The elif is allows us to check for multiple expressions.
Q: PLEASE FIX AND MODIFY THIS JAVA PROGRAM SO WHEN I UPLOAD IT TO HYPERGRADE IT PASSES ALL TEST CASSES…
A: Algorithm: Retail Price Calculator1. Create a class named RetailPriceCalculator.2. Define a static…
Q: Complete the program below that prints the wages for 3 employees based on the following: Regular…
A: Prompt thе usеr to еntеr thе hourly ratе for еach еmployее.Prompt thе usеr to еntеr thе hours workеd…
Q: String number = “1”; switch ( number ) { case 1: System.out.println( "The number is 1" );…
A: In switch cases, you have used integer. But you have passed String to the switch. So change data…
Q: OBJECT: To compute the net pay of an employee, given his/her pay rate, number of hours, and…
A: OBJECT: To compute the net pay of an employee, given his/her pay rate, number of hours, and…
Q: QUESTION 15 Analyze the code and answer the questions that follow: int value = 1; do {…
A: We have a source code in Java, which prints value and takes input from user until he doesn't press…
Q: Study the pseudocode in picture above. Declare the variables testScoreString and classRankString.…
A: start input testScore, classRank if testScore >= 90 if classRank >= 25 then output…
Q: Fahrenheit to Celsius using multiple statements Given a Fahrenheit value temperatureFahrenheit,…
A: Step-1: StartStep-2: Declare variable temperatureFahrenheit and take input from the userStep-3:…
Q: Find the output of the code below : void main( ) { int circle =…
A: In the given C++ code, we have to find out the output. In this, we used if, if-else conditions with…
Q: Simulate the dice game of lucky sevens. The rules are: roll two dice if the sum equals 7, win $4 if…
A: NOTE : As the question is not specific about which Programming Language is to be used to write the…
Q: There are errors in the following code snippet. Locate and fix all the errors with you! to get full…
A: After fixing the given code, I have provided PYTHON CODE along with CODE SCREENSHOT and…
Q: 2) Write pseudocode that performs the following: Ask a user to enter a number. If the number is…
A: Declare Number as integer Accept Number from user if number >=0 and number <=10 then print…
Q: Note: Help me debug and complete code The program should do the following: Show the customer the…
A: Program: Programs contain a set of lines of code, where the instructions are given through these…
Q: What will be the value of x after the following code is executed? int x = 0; while (x < 50) {…
A: In this question we need to choose the correct option which will be the value of x after execution…
Q: What is the value of x after the following statements are executed
A: Explanation: The switch statement is a multiway branch statement that allows a value to change the…
Q: The following code was intended for obtaining the number of times you have to divide 1 by 2 to get a…
A: Given: The following code was intended for obtaining the number of times you have to divide 1 by 2…
Q: The following is related to a Java Code: The following if statement determines whether choice is…
A: Answer: given condition is : if (choice == 'Y' || choice == 'y') inorder to make only one comparison…
Q: This needs to be made in Javascript. Leap Year Detector: Design a program that asks the user to…
A: A year is leap year, if it is evenly divisible by 100 and 400 or evenly divisible by 4 but not by…
Q: The Game of Nim: The game of Nim starts with a random number of stones between 15 and 30. Two…
A: let us see the code:- The Game of Nim: The game of Nim starts with a random number of stones between…
Q: In Blue j Write a program in the Tips class that reads the subtotal and the gratuity rate from…
A: if the user enters 10 for subtotal and 15% for gratuity rate, the program displays $1.5 as gratuity…
Q: Variables have been declared: int jobCode; double payRate; Rewrite the following if statement using…
A: here's the equivalent code using a switch statement with no code duplication:
Q: This program assigns values to two variables // and performs mathematical operations with them
A: Errors 1. System.out.println("adding " + x + y); The above statement concatenates the value of x and…
Q: Design the worst calculator ever: an application that accepts two numbers from the user and, when a…
A: Algorithm to create a calculator Start the program. Declare variables num1, num2, result, and…
Q: TOPICS: Data and Expressions MUST BE IN JAVA. PLEASE USE COMMENTS AND WRITE THE CODE IN SIMPLEST…
A: logic:- read numerator and denominator While dividing numerator and denominator type cast any one…
Q: What is the value of num3 after the following code is executed: int num1 = 5; int num2 = num1 * 3;…
A: We need to find the output of the given code.
Q: wing code displays temperature = 42; %3D perature = 35) m.out.println ("too hot")N n. out.println…
A: Q6. The value of temperature is 42. Therefore the first if condition if(temperature<=5) will be…
Q: ert feet into meters: Write a program which reads the number in feet, converts it to meters, and…
A: Code: #include <iostream>using namespace std;int main(){ float feet, meters,inches;…
Q: ISSUE NEEDED TO BE SOLVED: I attached the error codes that keep presenting themselves with the code…
A: Below is the explanation:
Q: Write a program that randomly generates a lottery between 100 and 999 (random.randint(100, 999)),…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and 2 OUTPUT…
Q: What is output by the code below? batteryLife = 15 if batteryLife 90: print("Mostly Charged…
A: answer is : Low Battery Explanation : here the battery life is 15 first it will goes to if…
Q: QUESTION5: The Speed of Sound. The following table shows the approximate speed of sound in air,…
A: PROGRAM CODE: #include <iostream> // include header file for input output…
Q: Alyssa is very particular about what she gets for dinner. The more hungry she is, the more she can…
A: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: The temperature of tin in degrees Fahrenheit is read from input into integer variable temp. If temp…
A: Start the program.Read the temperature value in degrees Fahrenheit from the user and store it in the…
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 < 1968: print("Probably has…
Q: Chapter 5. PC #2. Retail Price Calculator (page 312) Write a program that asks the user to enter an…
A: Below is the java code for the class RetailPriceCalculator:1import java.util.Scanner; 2 3public…
Q: Prompt Problem: A company wants a program that will calculate the weekly paycheck for an employee…
A: Flowchart:
Q: int stop = 6; int num =6; int count=0; for(int i = stop; i >0; i-=2) { num += i;…
A: The given code is in Java.
Q: def area(side1, side2): return side1 * side2 s1 = 12 s2 = 6 Identify the statements that…
A: Here we have a function named area(), which takes 2 input parameters and returns the area. Now, to…
Q: This code is intended to change the y location of an ellipse that has been created and increase the…
A: If condition is used to alter the flow of control based on Condition
Q: The following C code checks if color is 4 and if the size is 2, 4, or 6, but it doesn't work. Why?…
A: The code checks if the size is 2, 4 or 6, and the correct syntax for checking the whether the length…
Step by step
Solved in 4 steps
- 9. What will the following print out? = 0; int num System.out.println("Song titles with numbers include: "); switch (num) { case 12: System.out.println("12 days of Christmas"); case 99: System.out.println("99 bottles of beer on the wall"); System.out.println("99 Luftballons"); case 7: System.out.println("7 Chinese Brothers"); case 50: System.out.println("50 Mission Cap"); default: System.out..println ("If I had a million dollars"); А. Song titles with numbers include: 7 Chinese Brothers 50 Mission Cap If I had a million dollars В. Song titles with numbers include: 7 Chinese Brothers С. Song titles with numbers include: 12 Days of Christmas 99 bottles of beer on the wall 99 LuftBallons 7 Chinese Brothers D. Song titles with numbers include: If I had a million dollarsConvert totalMeters to hectometers, decameters, and meters, finding the maximum number of hectometers, then decameters, then meters. Ex: If the input is 815, then the output is: Hectometers: 8 Decameters: 1 Meters: 5 Note: A hectometer is 100 meters. A decameter is 10 meters. 1 #include 2 using namespace std; 3 4 int main() { 5 6 7 8 9 10 11 12 13 14 15 16 17 18 int totalMeters; int numHectometers; int numDecameters; int numMeters; cin >>totalMeters; cout << "Hectometers: cout << "Decameters: cout << "Meters: " << numMeters << endl; " << numHectometers << endl; << numDecameters << endl; 2 3Java question Write a program that plays the Rock-Paper-Scissors game againstthe computer. When played between two people, each personpicks one of three options (usually shown by a hand gesture) atthe same time, and a winner is determined. In the game, Rockbeats Scissors, Scissors beats Paper, and Paper beats Rock. The program should randomly choose one of the three options (with-out revealing it), then prompt for the user's selection. At that point, the program reveals both choices and prints a statementindicating if the user won, the computer won, or if it was a tie.Continue playing until the user chooses to stop, then print thenumber of user wins, losses, and ties.
- In this lab, you use the flowchart and pseudocode found in the figure below to add code to a partially created Java program. When completed, college admissions officers should be able to use the Java program to determine whether to accept or reject a student, based on his or her test score and class rank. start input testScore, classRank if testScore >= 90 then if classRank >= 25 then output "Accept" else output "Reject" end if else if testScore >= 80 then if classRank >= 50 then output "Accept" else output "Reject " endif else if testScore >= 70 then if classRank >= 75 then output "Accept" else output "Reject" end if else out put "Reject" end if end if end if stop Instructions Study the pseudocode in picture above. Declare the variables testScoreString and classRankString. Write the interactive input statements to retrieve: A student’s test score (testScoreString) A student's class rank (classRankString) Write the statements to convert the string representation…8. What will the following print out? int num = 7; System.out.println("Song titles with numbers include: "); switch (num) { case 12: System.out.println ("12 days of Christmas"); case 99: System.out.println("99 bottles of beer on the wall"); System.out.println ("99 Luftballons"); case 7: System.out.println ("7 Chinese Brothers"); case 50: System.out.println("50 Mission Cap"); default: System.out.println("If I had a million dollars"); } А. Song titles with numbers include: 7 Chinese Brothers 50 Mission Cap If I had a million dollars В. Song titles with numbers include: 7 Chinese Brothers С. Song titles with numbers include: 12 Days of Christmas 99 bottles of beer on the wall 99 LuftBallons 7 Chinese Brothers D. Song titles with numbers include:Write an if statement in Java that prints "Pass" if the grade is greater than or equal to 70 and prints "Fail" if the grade is below 70. If the grade is below 70 print "You have to do Exam2."
- A magic date is one when written in the following format, the month times the date equals the year e.g. 6/10/60. Write code that figures out if a user entered date is a magic date. The dates must be between 1 - 31, inclusive and the months between 1 - 12, inclusive. Let the user know whether they entered a magic date. If the input parameters are not valid, return false. examples: magicDate(6, 10, 60) -> truemagicDate(50, 12, 600) -> false4 Write an if-else statement to output "Exceeds capacity" if the value of roomCapacity is greater than 161. Otherwise, output "Does not exceed capacity". End with a newline. Ex: If the input is 163, then the output is: Exceeds capacity 1 import java.util.Scanner; 3 public class Relational { 4 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int roomCapacity; L23456789 5 11 10 11 12 } 13 } roomCapacity = scnr.nextInt (); /* Your code goes here */ 2This needs to be done in Java! (Calculating Sales) An online retailer sells five products whose retail prices are as follows: Product 1, $2.98; product 2, $4.50; product 3, $9.98; product 4, $4.49 and product 5, $6.87. Write an application that reads a series of pairs of numbers as follows: product number quantity sold Your program should use a switch statement to determine the retail price for each product. It should calculate and display the total retail value of all products sold. Use a sentinel-controlled loop to determine when the program should stop looping and display the final results.
- The following code results in an error message. What will the error message be andhow can it be fixed? def TryParseInt(p1, p2):return p1 + p2#Calling Codep3 = TryParseInt(10)Chapter 5. PC #2. Retail Price Calculator (page 312) Write a program that asks the user to enter an item’s wholesale cost and its markup percentage. It should then display the item’s retail price. For example: • If an item’s wholesale cost is 5.00 and its markup percentage is 100 percent, then the item’s retail price is 10.00. • If an item’s wholesale cost is 5.00 and its markup percentage is 50 percent, then the item’s retail price is 7.50. The program should have a method named calculateRetail that receives the wholesale cost and the markup percentage as arguments, and returns the retail price of the item. Class name: RetailPriceCalculator Here is a working code but please fix it so it will in Hypergrade which as all the test casses. I DO NOT NEED THANK YOU IN THE PROGRAM. IT HAS TO PASS ALL THE TEST CASSES PLEASE. THANK YOU!!!!!: import java.util.*;class RetailPriceCalculator{ // creating a method public static double calculateRetail(double wholesale,double…Write a program that converts Celsius temperature to Fahrenheit Temperatures. The formula is as follows: F=9/5C + 32 The program should ask the user to enter a temperature in celcius and then display the temperature converted to Fahrenheit. The program should work exactly like the provided use cases. There will be hidden use-cases to test the code so don't hard code the provided Use case only program a genelizesd solution display the converted temperature in 2 decimal places.