Rewrite the following code segment using conditional operators (?/:) double discount_percent; if (subtotal >= 100) discount percent = .1; else discount_percent = .05;
Q: Assume the following code has been written: amount = 5 item = 'hotdogs' total = 7.0 Wriite a line…
A: Use the below line to format "{:.2f}".format(total)
Q: A company manufactures three products engines, pumps and fans. They give a discount of 10% on orders…
A: I have provided C++ CODE along with CODE SCREENSHOT and also provided OUTPUT…
Q: Marketing person contains the values { total product sales, commission rates, person base salary}.…
A: The Answer is
Q: A cashier distributes change using the maximum number of five dollar bills, followed by one dollar…
A: Code comments have been added in the code for better explanation of the code for your reference.
Q: Assuming x is 5, y is 6, and z is 8, indicate by circling the T or F whether each ofthe following…
A: Note: There are multiple questions are given in one question. According to the rule, you will get…
Q: write a selection statement that decreases the value associated with shelf_life by 4 if the value…
A: Given requirement, write a selection statement that decreases the value associated with shelf_life…
Q: Enter the meal charge: 53.60 For a meal costing $53.60. The total tax is $3.62, tip $10.72, and…
A: Given: As per the given output, I am given a solution in the c++ program and shown the output in…
Q: When determining whether a number is outside a range, it’s best to use this logical operator. 1. And…
A: When determining whether a number is outside a range, it’s best to use this logical operator.1.…
Q: Rewrite the following statement with an if/else statement: total += count = = 1? sales : count *…
A: if((total+count)==1) { Print sales; } else { Print count * sales; }
Q: Determine whether the following is valid switch statement. If not, explain why. Assume that n is an…
A: C++ Switch Statements Use the switch statement to select one of the many code blocks to be executed.…
Q: //The function must return the value indicated in the comments // The calcDiscountPrice function…
A: As given, we need to find out the variable value that needs to be returned from the function.
Q: Rewrite the following If statement as a Select Case statement If radTwin.Checked = True Then dblCost…
A: Case statement is given in the next step :
Q: Write a cout statement so the variable profit is displayed in a field of 12 spaces, in fixed-point…
A: Given: Write a cout statement so the variable profit is displayed in a field of 12 spaces, in…
Q: price discount; discount 75%;
A: Rules for valid variable name: It should start with letter or underscore. No special characters…
Q: QUESTION 5 Convert the following conditional statement to switch statement: if (numBooks >=0 &&…
A: Convert the following conditional statement to switch statement:if (numBooks > =0 &&…
Q: The following code displays 1 for the value of the balance. int balance = 1000; while (true) { if…
A: The program is written in C++. Please find the answer and explanation in the below step.
Q: Write code to get information of 5 students (Exam id , average) then check the average them if it is…
A: As no programming language is mentioned, it is solved using basic C++
Q: The value of (y) in the statement (y = acosd ( x)) is displayed in .degrees
A: Two MCQs are given based on loop and function, answer with justification given below.
Q: mplement the ff. decision table using a nested if statement. Assume that the grade point average is…
A: Implementing Nested-If statement: The following statement shows the nested-if conditions for given…
Q: Write a program using if . else statement to display student's bachelor class of graduation based on…
A: The program is written in java.The program will display student’s bachelor class ofgraduation based…
Q: Convert the switch case statement below to if. else if statement. int option; printf ("Please…
A: A switch statement is used to check the given option with the cases. If that case matches then…
Q: 1. Use nested if multiple selection structure to write a program that determine the shipping cost…
A: Using Nested if-Statement: In the below Code, Firstly, it is checking for whether…
Q: Write an If...Then...Else statement that displays the string “Overtime pay” in the lblMsg control…
A: To Find: “If…Then…Else” statement that displays the string “Overtime pay” in the “lblMsg” control…
Q: Using switch syntax to write a program that calculates and prints the bill for a cellular telephone…
A: As no programming language is mentioned, it is solved using basic C++
Q: Write a multi-way selection statement that adds 1 to minors if age is less than 18, adds 1 to adults…
A: The Python program along with the snapshot of code and output is given below:
Q: Write the equivalent case structure from the following selection structure. if salaryCode = 1 then…
A: The selection control mechanism used to change the flow of the program using a value of a variable…
Q: Write a multiple-alternative selection structure that determines the appropriate discount rate based…
A: FORM DESIGN:
Q: rite code else thumbs down! Prefer equation
A: MATLAB CODE: f=@(t,x)[-42.3729*x(1);x(3);-.7670*x(1)-.0012*x(2)];tspan=[0,100];%time…
Q: The following code finds if age is between 18 and 40 (both inclusive) or not. What will be the…
A: According to the Question below the Solution:
Q: fice of plane 1000$ by default, but discounts are applied to it based on different criteria. 1-…
A: As per the given question, Case 1: If the person is student, then the student gets 20%discount. Case…
Q: QUESTION 8 Write an if/else statement that compares the value of two variables, lastYrTaxes and…
A: Given:
Q: When the user clicks the Get Retail button, the program should do the following: Verify that the…
A: The solution is given below for the above given question:
Q: Assuming that total is a variable, how else could you express in code the: total=total+2 NOTE: Avoid…
A: Given statement: total=total+2
Q: Using the following chart, write if/elif statements that assigns .10, .15, or .20 to commission,…
A: A pictorial representation of steps used to solve a problem is called flowchart. Each symbol used in…
Q: 1. Use nested if multiple selection structure to write a program that determine the shipping cost…
A: As per our guidelines we are supposed to answer only one question. Kindly repost the remaining…
Q: 64. The following procedure is intended to return true if at least two of the three parameters are…
A: Answer: We have given one code and we need to understand which is the correct answer and which is…
Q: Capitalize initial keyword – This is a rule while writing a pseudo code. T/F
A: According to the rules of writing the pseudocode, it is important to Capitalize the initial keyword.…
Q: Prompt the user to enter the principal amount(p), the annual rate of interest in percentage(r), and…
A: Start Take the input values. Read P,R,T Compute Simple intrest. Print simple intrest. Stop
Q: Private Sub btnDisplay_Click (...) Handles btnDisplay.click "Triple a number Dim num As Double = 5…
A: Given that a visual basic program to find the corresponding output when button is clicked. Private…
Q: $51.00 |→ solution ./salesTax Enter the price: 54.30 $54.30 + $4.20 $58.50 solution So you'll print…
A: - We have to write a code for calculating the total price after adding tax.
Q: Rewrite the following expressions using the conditional operator. (Assume that all variables are…
A:
Q: QUESTION 8 Write an if/else statement that compares the value of two variables, lastYrTaxes and…
A: The question is on: writing the code in java with respect to the given question.
Q: (1)Using the switch, case, · · · , otherwise control structure, write a MATLAB program for…
A: IF-ELSEIF-ELSE is used as control structure in implementing this program
Q: Prompt the user to enter the principal amount(p), the annual rate of interest in percentage(r).…
A: As you have not mentioned the language to solve I tried it in java and here is the answer. import…
Q: Using the following chart, write a C++ statement that assigns .10, .15, or .20 to commission,…
A: PROGRAM CODE: #include <iostream> // include header file for input output stream…
Q: King room: $100/night| Suite room: $150/night The size of the hotel chains in different locations…
A: FLOWCHART:
Q: ercise Write a program using if graduation based on Cumulative Grade Point Average (CGPA) by…
A: Coded using Python 3 since the programming language is not mentioned.
Q: You are trying to write a conditional statement to check to see if a customer has a gold status. If…
A:
Q: Assignment or equal operator is used for comparing two values Select one: True False When you want…
A: 1) Answer: True Explanation: Assignment or equal operator like =,<,> is used for the 2 number…
Rewrite the following code segment using conditional operators (?/:)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- if s=15; t=-6; r=0; u=9; how will evaluate s > t && r < u9 = ; Y= 5 50 18 100 81 Cul culate, Loss,L= mse (7,9) Note: mse = mean squane ennoto 对5 经Rewrite the following code segment so that it does not cause an error. decimal pricePerFoot = 2.99m; double boardLength = 10.5; decimal totalCost = boardLength * pricePerFoot;
- Lab: switch Note: switch syntax is only applied for service selection. You can use if – else syntax for other comparison. Using switch syntax to write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of service: regular and premium. Its rates vary, depending on the type of service. The rates are computed as follows: Regular service: $10.00 plus first 50 minutes are free. Charges for over 50 minutes are $0.20 per minutes. Premium service: $25 plus For calls made from 6:00 a.m to 6:00 p.m., the first 75 minutes are free; charges for more than 75 minutes are $0.10 per minute. For, calls made from 6:00 p.m. to 6:00 a.m., the first 100 minutes are free; charges for more than 100 minutes are $0.05 per minute. Your program should prompt the user to enter an account number, a service code (type char), and the number of minutes the service was used. A service code for r or R means regular service; a service…Why would you use a VLOOKUP function as oppose to a Nested Ifs statement?Serendipity Booksellers has a book club that awards points to its customers based on the number of books purchased each month. The points are awareded as follows: If a customer purchases 0 books, he or she earns 0 points. If a customer purchases 1 book, he or she earns 5 points. If a customer purchases 2 books, he or she earns 15 points. If a customer purchases 3 books, he or she earns 30 points. If a customer purchases 4 or more books, he or she earns 60 points. Creat an application in C# that lets the user enter the number of books that he or she has purchased this month and displays the number of points awarded.
- Given the following code double discount; char code = 'b' ; switch ( code ) { case 'a': case 'A': discount = 0.0; break; case 'b': case 'B': discount = 0.1; break; case 'c': case 'C': discount = 0.2; break; default: discount = 0.3; } What value is assigned to discount! 1000$ by default, but discounts are applied to it based on different criteria. 1- Students get 20% discount. 2- People who purchase in 30 days in advance get 25% discount. 3- student purchasing 40 days in advance gets a 40% discount. This code segment calculates the final price. x = Text1.Text If x= "student" Then 1-... ElseIf x= "advance" Then price 1000 - 0.25 * 1000 ElseIf x= "stu_adv" Then price 1000 - 0.4 * 1000 2-...... price = 1000 3-..... 4-.. O = 1-price = 1000 - 0.2 * 1000 2-Else 3- End If 4-Print price 1-price 1000 - 0.2 * 1000 2-Else 3- Print price 4-End If 1-price = 3-End If 4-Print price = 1000 -0.2 * 1000 2-ElseifSerendipity Booksellers has a book club that awards points to its customers based on the number of books purchased each month. The points are awarded as follows: If a customer purchases no books, he or she earns 0 points If a customer purchases 1 through 5 books, he or she earns 5 points for each book. If a customer purchases 6 through 10 books, he or she earns 10 points for each book. If a customer purchases 11 or more books, he or she earns points equal to 20 points for each book. (Use Python) Use the Design Recipe to write the function customer_rewards which consumes the number of books purchased, and returns the total points. Include a docstring! Write 3 assert_equal statements to test your function.
- The company discounted used cars pays their employees according to this chart: 250$ per months plus 50$ per car sold. If the salesman sells more than 10 cars, the employee receives a bonus of 5% of the total of his sales, in addition to his regular salary.Each month, the owner sits in front of the computer, and enters the following information: The name of the employee, the number of cars sold, as well as the total of all the sales for the month. algorithm that will calculate the salary of an employee for the month, and then display on the screen, his name, total cars sold, base salary, bonus if applicable and entire salaryThe following code segment declares a C-string. char list[] = {'f', 'i', 'n', 'a', '1'}; 'l'}: True OFalse1. Look at the following partial code. function checker(x) { var got_an_A = true; if (x >= 90) { got_an_A = true; } else { got _an_A = false; if (got_an_A != true) { document.getElementById("tbx1").value = "Did not get the A"; } else { document.getElementByld("tbx1").value = "Got the A"; } a. What will be the value of the textbox with the id: thxl if we have the following function call: checker(95); b. What will be the value of the textbox with the id: thxl if we have the following function call: checker(85);