Which value of z will make result = 50? switch (z) { case 1: result = 10; break; case 2: result = 20; break; case 3: result = 30; break; default: result = 50; } a. 1 b. 2 c. 3 d. Any value other than 1,2, and 3
Q: Which value of x results in short circuit evaluation, causing y (x >= 7) && (y A. 6 B. 7…
A: In between first part (x >= 7) and second part (y < 4) there is a logical AND operator. So,…
Q: Problem 18: Write a java program that will create games for two users. This common game is…
A: The logic for the Game: - Scissor is beaten by the Rock. Rock is beaten by the Paper as paper can…
Q: Create a program in SFC for the following: A three way switch where the left position operates…
A: SFC : Sequential Function Chart is a graphical programming language that displays the process flow…
Q: You and a partner are developing a program that lets a user play tic-tac-toe against the computer.…
A: Program Plan: The following steps are included in TicTacToe application: Step 1: Import Scanner…
Q: In Python: You have exchange rates from one currency to another USD -> BTC [some value]. Use a list…
A: In Python: You have exchange rates from one currency to another USD -> BTC [some value]. Use a…
Q: A) What will be the value of x after the following code is executed? int x, y = 4, z = 6; x =…
A: A) The value of x after the given code is executed
Q: Write a program in c language for a single switch light if you entered 1 then, it will printout a…
A: #include <stdio.h> int main(){ int num; printf("enter the number");…
Q: What is the ending value of y? int x; int y; x = 2; y = ((x + 1) / 5) + (x / 2) ; a. 1…
A: Coded using Java.
Q: Which expressions for YYY and ZZZ correctly output the indicated ranges? Assume int x's value will…
A: Given: if(YYY){// Output "0-29"}else if (ZZZ) {// Output "30-39"}else {// Output "40+"}
Q: п/2 f (x) = [«(xz – x-1)? + (1 – x2i-1)°], i=1 re a is a parameter that you can vary (for example, 1…
A: The answer is
Q: After lockdown, the government decided to support customers by halving the customer’s electricity…
A: Your Java program is given below as you required with an output. Algorithm :- Start Prompt user to…
Q: Q6. Write a program on difference among if and switch in Java Language.
A: If statement: It is a conditional statement. It checks for the condition under if If true, the…
Q: Write a program to generate the below series in java. 4,32,128,256....n
A: Intro Write a program to generate the below series in java. 4,32,128,256....n
Q: What does the term “boundary testing” mean? If your program was doing calculations and took in…
A: What is Boundary Testing? Boundary testing also known as boundary value analysis. In boundary value…
Q: This is for Java Programming language. How can I answer this question, please? I am yet to find the…
A: Program approach: Create class AcmeParts. Declare essential variables. Input hour worked and shift.…
Q: Suppose you save $100 each monthin a savings account with annual interest rate 3.75%. The monthly…
A: Since, programming language is not mentioned in the question, we will answer this question in Java…
Q: Sample Runs Run 1 Player rolls: 5, 6, 6 Two of a Kind! (+25) Computer rolls: 6, 2, 2 Two of a Kind!…
A: Please find the code and output below
Q: a Java program to swap 2 no without using temporary method.
A: a Java program to swap 2 no without using temporary method
Q: This is in JAVA For what values of integer x will Branch 3 execute? If x Else If x > 9: Branch 2…
A: Given: If x < 10 : Branch 1<br/> Else If x > 9: Branch 2 Else: Branch 3
Q: To write a java program that display inputs of an integer, n, from the command line and displays the…
A: //create the main class public class Sum_of_Numbers { //definition of the main function…
Q: make a simple calculator using java using switch case that take you input number and one operator as…
A: Question : make a simple calculator using java using switch case that take you input number and…
Q: Write a JavaScript function timer(), which implements a countdown timing utility. When calling the…
A: Objective: A function should be written to provide a countdown timing functionality in a web…
Q: Write one program on difference among if and switch in Java Language.
A: class Leap year { public static void main(String arg[]) { long a,y,c; Scanner…
Q: JAVA, include pseudo code* Mexico population is 130,000,000 and it grows 1.37% per year. US…
A: I have given java code with output below.
Q: 6. What is printed by the following when executes? 1 str "His shirt is red" 2 pos 3 print (pos)…
A: Code: str = "His shirt is red"pos = str.find("is")print(pos) Result: Answer : D
Q: Write a program that computes the value of a using repeated multiplication. That is, given positive…
A: According to the information given:- We have to write a program that compute the value of ab
Q: Java - Which of (a)–(d) is false? Multiple choice A postfix expression does not require parenthesis…
A: A post fix expression doesn't have parenthesis at all We can convert infix to post fix and post fix…
Q: Computer science lab You are given X servers which you have to place in X slots. Slots and servers…
A: import java.util.*; import java.io.*; public class Main { public String problemName = ""; class…
Q: Suppose you can buy chocolate bars from a vending machine for $1 each. Inside every chocolate bar is…
A: Write a test program in C++that would allow the user to enter amount of dollars and then use the…
Q: Write a Java conditional statement that implements the following table, where grade is an integer…
A: Please find the answer below :
Q: Qty: X Machine A Total? Current Sol A Sol B Machine B Qty: 1 Machine A takes in X units of solution…
A: Answer: I have done code and also I have attached code as well as code screenshot and output
Q: Given the numbers: 17 20 23 -99 total = keyboard.nextInt( ); val = keyboard.nextInt( );…
A: Given the numbers: 17 20 23 -99 total = keyboard.nextInt( ); val = keyboard.nextInt( ); while…
Q: ate a java program that calculates a customer’s bill for a local cable company. There are two types…
A: I have written JAVA CODE below:
Q: 1. Based on the following C++ code fragment: int k; cin >> k; switch (k) { case 4: case 3: k = k +…
A: a) What is displayed on the screen if the value input for k is 1 ? when k is 1 switch case 1: will…
Q: What are the final values of a, b, and d? What is the final value of a? Please write the answer like…
A: All these are the python codes
Q: 7. Explain what's going. on. When would you use this data type? /*…
A: Note: Since the question is multiple one we are advised to do only first question. Kindly post other…
Q: Please do base coverage for code given below with two characteristics public void tick() throws…
A: Here i write characteristics of this code:…
Q: Write a JavaScript function timer(), which implements a countdown timing utility. When calling the…
A: Given question has asked to write JavaScript function timer(), which implements a countdown timing…
Q: (Intro to Python) 1. print(3 * 'un' + 'ium') Group of answer choices none of these ununium…
A: 1. Sample output: Explanation: The given code statement will print 3 times 'un' along with an…
Q: 1. Write a program that converts a time from 24-hours notation to 12-hours notation. The following…
A: import java.text.SimpleDateFormat;import java.util.*; public class Main { public static void…
Q: Given the following list: x = [[1, 2, 3], 0, 'myStrElement', [4, 5, 6] ] What will be printed by: a)…
A: Requirements :- please see the solution in next step
Q: The Monty Hall Cash game costs $12 to play. Once you pay, you have a choice of three doors. Behind…
A:
Q: (Intro to Python) 4. fruit = "orange" print(len(fruit)) Group of answer choices 5 6 4 none of…
A: GIVEN: (Intro to Python) 4. fruit = "orange" print(len(fruit)) Group of answer choices 5 6 4…
Q: s the user options to encrypt and decrypt with DES and AES. The program should further offer the…
A: Q. Write a program (in JAVA) that gives the user options to encrypt and decrypt with DES and AES.…
Q: Write a Java program that reads a tic-tac-toe board and determines who has won the game or if it is…
A: About the program: A Tic-Tac-Toe board is given after some moves are played. Find out if the given…
Q: The coverString method will take 2 string parameters from the caller. Your job is to write an…
A: Solution - Programming language - Java All necessary comments are included in program code.…
Q: a. Write Java classMessage that automatically gives each created Message object a unique serial…
A: The given problem is to be solved in Java where the use of static data members is needed to show how…
Q: Write a program in c language for a single switch light if you entered 1 then, it will printout a…
A: Include necessary header files declare a integer variable n to get the input from the user write a…
Q: Java eclipse: write a program that simulates throwing a die n times.
A: Below is solution in java with explanation to solution code given using java comments. import…
Q: Write a program that converts a time from 24-hours notation to 12-hours notation. The following is a…
A: Note, as there is no specific programming language mentioned in the above question, so I am using…
java
-------
-
Which value of z will make result = 50?
switch (z) {
case 1: result = 10; break;
case 2: result = 20; break;
case 3: result = 30; break;
default: result = 50;
}
a. 1
b. 2
c. 3
d. Any value other than 1,2, and 3
Step by step
Solved in 2 steps
- Integer userValue is read from input. Assume userValue is greater than 1000 and less than 99999. Assign tensDigit with userValue's tens place value. Ex: If the input is 15876, then the output is: The value in the tens place is: 7 2 3 public class ValueFinder { 4 5 6 7 8 9 10 11 12 13 GHE 14 15 16} public static void main(String[] args) { new Scanner(System.in); } Scanner scnr int userValue; int tensDigit; int tempVal; userValue = scnr.nextInt(); Your code goes here */ 11 System.out.println("The value in the tens place is: + tensDigit);// Program gets a quantity ordered from user // then determines price and discount based on quantity // price per item before discounts is $6.00 // order 15 or more, get a 20% discount // order 10 to 14 - get a 14% discount // order 5 to 9, get a 10% discount using System; using static System.Console; using System.Globalization; class DebugSeven3 { static void Main() { int quantity; double price; quantity = GetQuantity(); price = CalculatePrice(int quantity); WriteLine("Final price for {0} items is {1}.", quantity, price.ToString("C", CultureInfo.GetCultureInfo("en-US"))); } private static int GetQuantity() { int quan; WriteLine("Enter number of items >> "); quan = Convert.ToInt32(ReadLine()); return quan; } private double CalculatePrice(int quantityOrdered) { double PRICE_PER_ITEM = 6.00; double price = 0; double discount = 0; int[] quanLimits = {0, 5, 10, 15}; double[] limits =…PLEASE HELP ME! ? Maximize and use alternative method to this code! package com.btech.pf101; import java.io.bufferedreader; import java.io.inputstreamreader; import java.util.calendar; import java.util.date; public class pawnshopcode { private static final bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); private static string name; private static int age; private static string address; private static string contactno; private static int itemtype; private static string itemtypename; private static final int itemtype_gagdet = 1; private static final int itemtype_jewelry = 2; private static final int itemtype_musicinstrument = 3; private static final int itemtype_homeequipment = 4; private static final int itemtype_landtitle = 5; private static string itemdescription; private static int periodtype; private static string periodtypename; private static final int periodtype_days = 1; private…
- int main(){ if(var1>50) { num = 20.0 } else { if(var1>35) ---- Line 7 { num= 35.0; } else if (var1<80) { num=60.0; } else { num=40.0; }} What should be the outcome of the condition in line 7 in order for the value of num to be equal to 60.0?Enter the name of Stock: Oracle Corporation Enter the symbol of Stock: URCL Enter the previous closing price: 34.5 Enter the current price: 34.35 Stock name: Oracle Corporation Stock symbol: ORCL Stock ID: 59 Price-change percentage: - 0.434782608695648 Challenge Question - Using GregorianCalendar and Date classes: (Use the GregorianCalendar class) Java API has the Date class and GregorianCalendar class in the java.util package, which you can use to obtain the current date with specific details like current year, current month, current day of a date and so on. Write a program to perform these tasks: 1. Display the current year, month, and day. 2. Display the current date by using the to String() method from the Date class. 3. Display the current time-which is used to display the number of milliseconds- by using getTime() method from the Date class. We will use it in the step 17. 4. - Display the current year by using get(GregorianCalendar.YEAR) method from to GregorianCale class. 5-…int x=10,y=12,z=13,w=10; X=X+2; //value of X Z=X++ +10; //value of x W=--y +3; //value of y and w and z W=W+X-1; //value of W
- Enter the name of Stock: Oracle Corporation Enter the symbol of Stock: URCL Enter the previous closing price: 34.5 Enter the current price: 34.35 Stock name: Oracle Corporation Stock symbol: ORCL Stock ID: 59 Price-change percentage: - 0.434782608695648 Challenge Question - Using GregorianCalendar and Date classes: (Use the GregorianCalendar class) Java API has the Date class and GregorianCalendar class in the java.util package, which you can use to obtain the current date with specific details like current year, current month, current day of a date and so on. Write a program to perform these tasks: 1. Display the current year, month, and day. 2. Display the current date by using the to String() method from the Date class. 3. Display the current time-which is used to display the number of milliseconds- by using getTime() method from the Date class. We will use it in the step 17. 4. - Display the current year by using get(GregorianCalendar.YEAR) method from to GregorianCale class. 5-…Instructions: In the code editor, you are provided with a treasureChestMagic() function which has the following description: Return type - void Name - treasureChestMagic Parameters - an address of an integer Description - updates the value of a certain integer randomly You do not have to worry about how the treasureChestMagic() function works. All you have to do is ask the user for an integer and then call the treasureChestMagic() function, passing the address of that integer you just asked. Finally, print the updated value of the integer inputted by the user. Please create a main code for my function that works with this. This is my code: #include<stdio.h>#include<math.h> void treasureChestMagic(int*); int main(void) { // TODO: Write your code here return 0;} void treasureChestMagic(int *n) { int temp = *n; int temp2 = temp; *n = *n + 5 - 5 * 5 / 5; temp2 = (int) pow(2, 3); if(temp % 3 == 0) { *n = temp * 10; } else if(temp %…Write a statement that assigns finalValue with the multiplication of userNum1 and userNum2. Ex: If userNum1 is 6 and userNum2 is 2, finalValue is 12. let userNum1 = 6; // Code tested with values: 6 and 4let userNum2 = 2; // Code tested with values: 2 and -2 let finalValue = 0;
- Using C++ Dice game with varying dice (d4-d20) The game will consist of two or more players. Each player will attempt to reach a set number (say 100) By rolling dice and adding up the results of the dice roll. if the player rolls a certain number (in this case a 6) then the player gets two more tries, if they roll a 6 two more times, they lose their turn and gain no points that round. The goal to get to 100 first. During a round, each player takes a turn. At the beginning of the game, each player rolls a dice, with the higher roll going first each round. A player’s total score is the sum of their turn scores, the users will have the ability to choose either to stop or to continue after first roll, if a player decides to stop, then their turn ends and their score for that turn is their maximum roll during that turn, if the player decides to continue, they roll the dice again. At the end of the game the program should display the winner your program should have at least four of…What does this function do? SOURCE CODE 1. int T(int x, int y) 2. 3. int sum 4. if (odd (x)) |l odd (m) is true if and only 11Question Using Java programming language write a program to manage a hotel with 24 rooms;10 rooms are Executive, with price Gh ₵ 2500.00 per night,7 rooms are Chalets, with amounts Gh ₵ 1500.00 per night7 rooms are Ordinary, with amount Gh ₵ 500.00 per night The program should allow customers to book for rooms for a number of nights, and update the number of empty rooms available for each category when a customer has paid fully and has checked-in; also update the number of empty rooms available when customer checks-out.Customers should make bookings with their first names, telephone number A customer should be prompted to know if a room is booked (meaning a another customer has booked it but has not paid fully, or has not checked-in) A customer should be prompted to know if a room is occupied (meaning a booked room has been fully paid for, or the customer has checked-in) A customer should be prompted to know if a room is available (meaning a room has neither been booked nor…