Assume: double soldYesterday, soldToday; int salesTrend; Write an if/else 2 statemente that compares 2 the valuee of the variables e soldYesterday and soldToday, and based e upon that comparison assigns e salesTrend the value 2 -1 or 1. -1 represents the case where soldYesterday is greatere than e soldToday; 1 represents the case where soldYesterday is not greater e than e soldToday.
Q: 0 When you write an If-Then-Else statement, under what circumstances do the statementsthat appear…
A: The syntax of if then else statement is if(condition) { //statement to be executed } Then else {…
Q: Write an if-else statement that works like this: If the sales variable is greaterthan or equal-to…
A: Given: if-else statement where the sales variable is greater than or equal-to 50,000, the…
Q: Write an if statement that assigns 10,000 to the variable bonus if the value of the variable…
A: An if statement is a decision making that executes a specific code(s) if a specified condition is…
Q: Given the following variable declaration, choose the option that describes them…
A: A variable is an identifier that values can be changeable. It works like a container, that can store…
Q: b) Convert the following if statement to a single switch statement. Don't forget to employ the…
A: Here the switch case variable will be Year. Different switch case will have different possible value…
Q: Rewrite the following expressions using an if . . . else statement. (Assume that all variables…
A: “if…else” statement: In “if…else” statement, the “if” statement executes only when the condition is…
Q: Code 2.2 is for a program that demonstrates variable declarations and the use of literal and…
A: 1. What are the two symbolic constants used? 2. Show two methods of defining a symbolic constant…
Q: rite an if/else statement that compares the value of two variables, lastYrTaxes and estimatedTaxes,…
A: if (lastYrTaxes < estimatedTaxes) { oweMoney = true; } else { oweMoney = false; }
Q: Write C++ code for creating a menu driven calculator using if else as well as switch statement and…
A: Solution with detail explanation using cpp comments. // required header file#include…
Q: f(A, B, C, D, E) which specifies when the safe can be opened as a function of what (b) Find all the…
A: Question :- A safe has 5 locks v,w,x,y and z all of which must be unlocked for thesafe to open.The…
Q: Write if-else if statements that will compare "price" variable with below values and output…
A: NOTE: Programming language is not mentioned, so doing in C++ In this question, we are asked to write…
Q: c. Write aprogram using nested if statements that perform the following test: If the variable…
A: Write a program using nested if that will the following conditions and then display the result.…
Q: Vrite an it/else statement that compares the value of two varilables, lastYriaxes and estimated…
A: ANSWER:-
Q: Suppose that classStanding is a char variable, gpa and dues are double variables. Write a switch…
A: Program: //include the header file #include <iostream> using namespace std; //definition…
Q: With the statement, int option=1; switch(option){ int a=1; case 1: printf("1"); while(a<=10){ case…
A: Given code: int option = 1; switch (option) { case1: printf("1"); case2: printf("2"); case3:…
Q: What is the wrong in the following programming statement? A- if (age >= 65); cout <<"Age is greater…
A: Answer:
Q: Write a multiway if-else statement that classifies the value of an int variable ninto one of the…
A: Program concepts
Q: Clunker Motors Inc. is recalling all vehicles in its Extravagant line from model years 1999-2002. A…
A: Code for the above requirements is given in next step
Q: What is the wrong in the following programming statement? A if (age >=65); cout = 1, x++) cout <<x…
A: In question A wright program is as following if(age >=65) cout << "Age is greater than or…
Q: Rewrite each of the following statements in the form “If A, then B.”a. Candidate Lu winning the…
A: If…Then statement: It is the simplest form of control statement. It is mainly used for decision…
Q: score is an int variable, consider the following if statement: if (score >= 90), cout << "Discount =…
A: the code is here
Q: Question 2: Write a Multiway if-else statement that prints out one of three different messages,…
A: Syntax of multiway if else:- if(condition) { statements } else if(condition) { Statements } else {…
Q: Medication dosage by weight A machine administers medication dosage based on weight. Write an…
A: According to the question given:- we have to create program for Medication dosage by weight For that…
Q: A cashier distributes change using the maximum number of five dollar bills, followed by one dollar…
A: A cashier gives change by selecting as many five-dollar notes as possible, preceded through…
Q: Rewrite the following switch statement using a nested if-else structure (assume that n is a…
A: Above mentioned switch -case statement is converted to nested if-else statements. Equivalent Nested…
Q: #include xoid main(void) int J: soutee"t in the if statement"ce"ia sd and jeid \n", L): cout *…
A: Given i=0 j=1 If condition i==0(true) so i=5
Q: Suppose that sale and bonus are double variables. Write an if...else statement that assigns a value…
A: If...else if...else for most programming language: The if is followed by a condition enclosed in…
Q: Assume that grade is a variable whose value is a letter grade-- any one of the following letters:…
A: Given: Assume that grade is a variable whose value is a letter grade-- any one of the following…
Q: Use the Block IF statement to do the following where n has been declared as an integer and x as a…
A: Required:
Q: Write the complete statement needed to declare and initialize a new constant to represent the number…
A: Please find the answer below :
Q: Language is VB Write a selection statement (if .....then .... else .... end-if) that evaluates a…
A: if condition then statement else statement end if
Q: classified in one of the three categories (A,B,C). Write a Python program using chained conditional…
A: Given to write python code for updated balance below is the code for that
Q: Correct the following if statement below.#include <stdio.h>int main(void){int…
A: Syntax of “if” statement: //if the condition is true, then if(condition) { //statement inside the…
Q: A switch statement can evaluate the following variable types? A.) integer B.) string C.) char…
A: A switch statement can evaluate integer , string , char , enumerated type.
Q: Write a program that has variables to hold three test scores. The program should ask the user to…
A: import java.util.Scanner; public class Main{ public static void main(String args[]) {…
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: QUESTION 8 Kebabo Internet Services offers customers with 600 weekday minutes for a flat rate of…
A: ANSWER:-
Q: For each of the following questions, write ONLY what is requested. a. Write a statement(s) that…
A: For each of the following questions, write ONLY what is requested. The answer is given below:-
Q: Working overtime is defined as having worked more than 40 hours during the week. Given the…
A: As per the given question, we need to write an expression that evaluates to true if the employee…
Q: Write a conditional structure that will do the following: 1. Test whether the variable age is…
A: A conditional statement is a test statement that tests a condition or expression. If the condition…
Q: Rewrite the following expressions using the conditional operator. (Assume that all variables are…
A:
Q: Enter desired auto service: oil change You entered: Oil change (2) Output the price of the requested…
A: The answer is
Q: Write a single scanf statement that reads user-entered time (three integers) and discards the…
A: Program: //include the header file #include <stdio.h> //definition of main function int main…
Q: In conditional statements, the result of the condition is checked for _________________.
A: We need to fill the given statement such that the statement is complete and true. Given statement is…
Q: Write a logical expression which would evaluate true if an int variable x was divisible by 5 and 6.
A: if (x % 5 == 0 && x % 6 == 0) { System.out.print("True"); } else {…
Q: A-Correct the errors in each of the following statements: 1- if (age >= 65 ); cout=65) cout>i>>j;
A: The corrected statements are given below:
Q: Assume that grade is a variable whose value is a letter student_grade- 'A', 'B', 'C', 'D', 'F".…
A: the code is given below :
Q: In each of the following, assume -4 that m has the value 5 and n has the value 2 before the…
A: Required: program
I want the answer using c++, please
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Suppose that sale and bonus are double variables. Write an if...else statement that assigns a value to bonus as follows: If sale is greater than $20,000, the value assigned to bonus is 0.10, that is 10%; If sale is greater than $10,000 and less than or equal to $20,000, the value assigned to bonus is 0.05, that is 5%; otherwise the value assigned to bonus is 0, that is 0%.Write a multiway if-else statement that classifies the value of an int variable ninto one of the following categories and writes out an appropriate message:n < 0 or 0 ≤ n < 100 or n ≥ 100Hint: Remember that the Boolean expressions are checked in order.1. Prompt the user and read in the number of a team playing the current game, i.e. Team 1, Team 2, Team 3, etc. 2. Prompt the user and read in the number of the opponent team. It is probably helpful to think of the first team as the home team for this game, and the second team as the away team. 3. Prompt the user and read in a team’s score for the current game. Use the team’s number when asking for the score in your printf statement. 4. Prompt the user and read in the opponent’s score for that game. Again, use the opponent’s team number when asking for the score. 5. Notify the user and repeat steps 3 and 4 in the case that the user enters a negative value. 6. Calculate the points earned by each team and add it to a cumulative score. A win is worth 3 points, a draw is worth 1 point and a loss is zero points. Also update the amount of games played by each team and their goals for and against. 7. Print to the screen the following header and beneath it a line of data that corresponds to…
- Determine whether the following are valid switch statements. if not, explain why. Assume that n and digit are int variables. A. switch (n <= 2) { case 0: cout << "Draw." << endl; break; case 1: cout << "Win." << endl; break; case 2: cout << "Lose." << endl; break; } B. switch (digit / 4) { case 0, case 1: cout << "low." << endl; break; case 1, case 2: cout << "middle." << endl; break; case 3: cout << "high." << endl; } C. switch (n % 6) { case 1: case 2: case 3: case 4: case 5: cout << n; break; case 0: cout << endl; break; } D. switch (n % 10) case 2: { case 4: case 6: case 8: cout << "Even"; break; case 1: case 3: case 5: case 7: cout << "Odd"; break; }Fahrenheit to Celsius using multiple statements Given a Fahrenheit value temperatureFahrenheit, write a statement that assigns temperatureCelsius with the equivalent Celsius value. While the equation is C = 5/9 * (F - 32), as an exercise use two statements, the first of which is "fractionalMultiplier = 5/9:". Check if varlables temperatureFahrenheit, fractionalMultiplier, and temperatureCelsius exist Variable temperatureCelsius does not exist. From Matlab4.7: Time Machine Your time machine is capable of going forward in time up to 24 hours. The machine is configured to jump ahead in minutes. To enter the proper number of minutes into your machine, you would like a program that can take a start time (in hours, minutes, and a Boolean indicating AM or PM) and a future time (in hours, minutes, and a Boolean indicating AM or PM) and calculate the difference in minutes between the start and future time.A time is specified in your program with three variables:int hours, minutes;bool isAM;for example, to represent 11:50 PM, you would store:hours = 11,minutes = 50,isAM = false This means that you need six variables to store a start and future time. Write a program that allows the user to enter a start time and a future time. Include a function named computeDifference that takes the six variables as parameters that represent the start time and future time. Your function should return, as an int, the time difference in minutes. for example,…
- 4.7: Time Machine Your time machine is capable of going forward in time up to 24 hours. The machine is configured to jump ahead in minutes. To enter the proper number of minutes into your machine, you would like a program that can take a start time (in hours, minutes, and a Boolean indicating AM or PM) and a future time (in hours, minutes, and a Boolean indicating AM or PM) and calculate the difference in minutes between the start and future time. A time is specified in your program with three variables: int hours, minutes; bool isAM; // You can also use a char, i.e. A or P Write a program that allows the user to enter a start time and a future time. Include a function named computeDifference that takes the six variables as parameters that represent the start time and future time. Your function should return, as an int, the time difference in minutes. for example, given a start time of 11:59 AM and a future time of 12:01 PM, your program should compute 2 minutes as the time difference.…4.7: Time Machine Your time machine is capable of going forward in time up to 24 hours. The machine is configured to jump ahead in minutes. To enter the proper number of minutes into your machine, you would like a program that can take a start time (in hours, minutes, and a Boolean indicating AM or PM) and a future time (in hours, minutes, and a Boolean indicating AM or PM) and calculate the difference in minutes between the start and future time.A time is specified in your program with three variables:int hours, minutes;bool isAM;for example, to represent 11:50 PM, you would store:hours = 11,minutes = 50,isAM = false This means that you need six variables to store a start and future time. Write a program that allows the user to enter a start time and a future time. Include a function named computeDifference that takes the six variables as parameters that represent the start time and future time. Your function should return, as an int, the time difference in minutes. for example,…Language is VB Write a selection statement (if .....then .... else .... end-if) that evaluates a voter age to allow her/him to vote. If age is equal or greater than 18 then display the message 'you can vote.' ,otherwise display "you are too young to vote" on a label control or object . You pick the name for the integer variable whose content is the number indicating the age and pick a name for the label whose content indicating the appropriate message. if ........ then ............. else .......... end-if
- Correct the following if statement below.#include <stdio.h>int main(void){int volt_1=12;if(volt_1 < 10);{printf("This prints inside the if function \n");}printf("This prints outside the if function \n");}Write if-else if statements that will compare "price" variable with below values and output statements based on the conditions price>=500 : “Extremely Expensive” price>=300 : “Very Expensive” price>=100: “Reasonable price “Computer Fundamentals and Programming 2 Write a program that determines a student’s grade. The program will accept 3 scores and computes the average score. Determine the grade based on the following rules: - If the average score is equal or greater than 90, the grade is A. - If the average score is greater than or equal to 70 and less than 90, the grade is B. - If the average score is greater than or equal to 50 and less than 70, the grade is C. - If the average score is less than 50, the grade is F. Source Codes and Print Screen of the Output