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 the purchase is 1000, what would be the value of the discount rate after the following pseudo code statements are executed. The code below is not a syntax error. Set discountRate = 0.0 Set purchase = 1250 if purchase > 1000 Set discountRate = 0.05 if purchase > 750 Set discountRate = 0.03 if purchase > 500 Set discountRate = 0.01 else Set discountRate = 0QUESTION 8 Re-write below JavaScript statement by utilize the arrow function abandon the usage of braces return the resulting value without using the return keyword product = function (x, y) { return x * y;} product = function (x, y) { return x * y;}With a combined assignment operator, you can re-write the following statement to __.amount = amount * 5;
- Upload the pseudocode AND Flowchart for a program that determines the shipping cost for an order based on weight from the following table: FROM TO Price 0 lbs 19.99 lbs $2.95 20 lbs 49.99 lbs $3.95 50 lbs 74.99 lbs $4.95 75 lbs + $5.00 *BE SURE TO USE A SINGLE BOOLEAN EXPRESSION IN YOUR SELECTION STRUCTURE DESIGNQuestion: For the following code: for ( a = 1, b = 5, c = 3; a < 4; a++, b++ ) { c = a * b + c; } Indicate what values for the following variable will be when the code endsPlease check work for A = B = C =Write a statement to print the data members of InventoryTag. End with newline. Ex: if itemID is 314 and quantityRemaining is 500, print:Inventory ID: 314, Qty: 500 #include <iostream>using namespace std; struct InventoryTag { int itemID; int quantityRemaining;}; int main() { InventoryTag redSweater; cin >> redSweater.itemID; cin >> redSweater.quantityRemaining; /* Your solution goes here */ return 0;}
- issignment Portion - hand in your wo nce completed "4.2 (Geometry: gneat circle distance) The great circle distance is the distance between two points on the surface of a sphere. Let(x1,y1)and(x2,y2)be the geographical latitude and longitude of two points. The great circle distance between the two points can be computed using the following formula: \[ d=\operatorname{radius} \times \arccos \left(\sin \left(x_{1}\right) \times \sin \left(x_{2}\right)+\cos \left(x_{1}\right) \times \cos \left(x_{2}\right) \times \cos \left(y_{1}-y_{2}\right)\right) \] Write a program that prompts the user to enter the latitude and longitode of two points on the earth in degrees and displays its great circle distance. The average radius of the earth is6,371.01 km. Note you need to convert the degrees into radians using the Math, toRadi ans method since the Java trigonometric methods use radians. The latitude and longitude degrees in the formula are for north and west. Use negative to indicate south and…Taxable income (NAD*) Tax on column 1 (NAD) Tax on excess (%) Over (column 1) Not over 0 50,000 0 0 50,000 100,000 0 18 100,000 300,000 9,000 25 300,000 500,000 59,000 28 500,000 800,000 115,000 30 800,000 1,500,000 205,000 32 1,500,000 429,000 37 (1)Using the switch, case, · · · , otherwise control structure, write a MATLAB programfor calculating individual taxesRewrite the following switch statement using a nested if-else structure (assume that n is a previously declared int variable): switch (n) { case 1: cout << "ONE"; break; case 2: cout << "TWO"; case 3: cout << "THREE"; break; default: cout << "PASS"; }
- Using the IF/Else Statement Use the IF/Else statement in cell C71-C77 to display whether a student passed or failed their exam based on their scores in the table below. The passing test score for this table is 60 and above. Enter a formula in column C that will display either "PASS" or "FAIL" based on scores received on test. Last Name Scores Pass/Fail Grant 55 Adams 65 Sully 95 Bain 75 Turner 83 Williams 49.99 Harper 81Taxable income (NAD*) Tax on column 1 (NAD) Tax on excess (%) Over (column 1) Not over 0 50,000 0 0 50,000 100,000 0 18 100,000 300,000 9,000 25 300,000 500,000 59,000 28 500,000 800,000 115,000 30 800,000 1,500,000 205,000 32 1,500,000 429,000 37 Q Using the switch, case, · · · , otherwise control structure, write a MATLAB program for calculating individual taxesWrite a statement to print the data members of InventoryTag. End with newline. Ex: if itemID is 314 and quantityRemaining is 500, print:Inventory ID: 314, Qty: 500