Correct the errors in each of the following statements: 1- if ( age >= 65) cout<> i>>j; **** *****
Q: 1. Write a single if statement that examines two integer variables and changes the larger to the…
A: 1. Let a and b be the two integer variables which contains some values. Now in the if statement we…
Q: Pakistan online Daraz company has four agent (1 to 4) who sell 5 different products ( 1 to 5). Once…
A: Write the program as follows: Create a 2D array of size 4*5. Input the sales of product for each…
Q: Q#1 (a). Write a program that inputs radius and user choice. It calculates volume of a sphere using…
A: Program Approach: Including necessary header files and defining the value of pi. Using namespace…
Q: Factorial) The factorial of a nonnegative integer n is written n! (pronounced “n factorial”) and is…
A: C++ code: #include <iostream>using namespace std; int factorial( int n){ int i = 1, final = 1;…
Q: Re-write the following program by changing ternary / conditional operator to if-else statement.
A: The ternary operator is used with the following syntax in C++; (condition) ? expression1 :…
Q: Write a C++ . In this program, we want to find the total cost that company X will pay for the…
A: since you have not provided the cost of normal hours(40 hours) so I have written the code only to…
Q: Write an if statement that increases pay by 3% if score is greater than 90, otherwise increases pay…
A: if(condition){ statement; ...}else{ statements; ...}
Q: Re-write the following program by changing ternary / conditional operator to if-else statement.…
A: Conditional or Ternary Operator: The basic syntax of conditional operator is as following: variable…
Q: Chapter 5 Selection Statement ASSIGNMENT3 1. Using the switch statement, write a program that…
A: As per our policy, "Since you have asked multiple questions, we will solve the first question for…
Q: Suppose p: 'You get a speeding ticket' and q: 'Your insurance rate goes up.' Select the correct…
A: p: 'You get a speeding ticket' q: 'Your insurance rate goes up.' 'If your insurance rate doesn't…
Q: Activity 20 Electric Bill: Using C Language and Using Switch Statement, Make a program that will…
A: Please find the code and output below:
Q: Re-write the following program by changing ternary operator to conditional if-else statement.…
A: Conditional statements, are also referred as selection statements, are used to make decisions based…
Q: S = 2 s == /2wz(v3 + 1)
A: Given statement:
Q: SHORT ANSWER] Assume a variable testScore that has already been initialized, write one if/elif/else…
A: if (testScore == 100){ cout<<"PERFECT SCORE"; } else if(testScore==0){ cout<<"TEST NOT…
Q: Problem Solving 1 – Shipping Charges The currier express company charge the following rates within…
A: I give the code in C++ along with output and code screenshot
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: 2 Operator precedence. Given the following expressions, re-write them by writing some parenthesis…
A: Note: Answering the first question as per the guidelines. Given : Expressions are : a / b ^c ^ d -…
Q: Re-write the following program by changing ternary / conditional operator to if-else statement.…
A: The given code is: #include<iostream>using namespace std;int main(){int Var1, Var2,…
Q: Write a multiway if-else statement that classifies the value of an int variable ninto one of the…
A: Program concepts
Q: Germany has minimum marrying law in which if any person has age greater than 18 , they can marry.…
A: Requirements:- Germany has minimum marrying law in which if any person has an age greater than 18,…
Q: 3. Write a single C++ statement to accomplish each of the following: Compute the sum of three…
A: Write a single C++ statement to accomplish each of the following: a. compute the sum of the three…
Q: Show that the output carry in a full-adder circuit can be expressed in the AND–OR–INVERT form C i +…
A: Consider the following Boolean expression, Simplify the RHS expression of equation (1), Further…
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: Q1. Write a C++ program which initializes the earning of an employee. The program should calculate…
A: NOTE: As per the guidelines, we are allowed to answer only one independent question per post. Kindly…
Q: The body of if statement that contains multiple statements is placed within O{}
A: According to the Question below the Solution:
Q: Rewrite the following expressions as C++ assignment statements that use the conditional operator.…
A: The syntax of the conditional operator is as follows: Expression1 ? Expression2 : Expression3 If…
Q: Question 3: Code conversions (a) Re-write the following program by changing ternary / conditional…
A: According to the asked question, the solution is given below with a proper explanation.
Q: ne following ray ns are alld If a declaration is valid, write VALID. If it is invalid, you can make…
A: Given : (a)int[50] list;
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: (a) Re-write the following program by changing ternary / conditional operator to if-else statement.…
A: The ternary or conditional operator syntax is given by: x ? y : z ; Here x is a expression that is…
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: Convert the following program by changing conditional operator to if-else statement. #include…
A: Conditional statements are required when some decisions need to be taken during program execution.…
Q: Write an if statement that assigns 0.2 to commission if sales is greater than or equal to 10000. In…
A: Step 1: Prompt and accept the sale amount from the user. Step 2: Check whether the sale amount is…
Q: QUESTION 1 Any statement may be placed.within an if statement, including other if statements. When…
A:
Q: Asif buys four products detergent, ghee, milk and soap from Punjab Cash & Carry. You have to write a…
A: Please find the answer below :
Q: In C++ please write the code for this problem: A bag of cookies holds 30 cookies. The calorie…
A: According to the information given:- We have to create calories calculator.
Q: Malcolm Movers charges a base rate of $200 per move plus $150 per hour and $2 per mile. Write a…
A: using System;using System.Collections;using System.Globalization; using static System.Console;…
Q: Convert the following program by changing conditional operator to if-else statement
A: The conditional operator is also known as a ternary operator. The conditional statements are the…
Q: Assuming X1,X2, Y1 are integer type variables, A,B,C are Bool type variables and Z as real type…
A: Required: Assuming X1,X2, Y1 are integer type variables, A,B,C are Bool type variables and Z as real…
Q: Ajax Manufacturing needs a program for employees to calculate gross pay themselves in order to have…
A: Working of the flowchart Prompt user to enter hours worked Read hours Prompt user to enter pay rate…
Q: Find the output or error #include using namespace std; int N = 11; int main() { static int x = 1; if…
A: Recursion in any programming language is a function calling itself with different parameter values.…
Q: (a) Re-write the following program by changing ternary / conditional operator to if-else statement.…
A: Given: Question 3 (a) Re-write the following program by changing ternary / conditionaloperator…
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: 2. Determine and correct the errors in the following C++ statements Assume all variables have been…
A: In this problem we are going to write corrected statements. There is some error in all the…
Q: T/F Assume finished is wrong, int x = 10, int y = 11, String s = "Help," and String t = "Goodbye."…
A: We are given few initialisation of integer variables and string and we are going to see if…
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
Q: c. Refer to the C++ program in Figure 1.1Gad answer Question 1e (1) - (xi). Otinclude tinclude…
A: input radius1 and radius2 it basically calculates the volume of two sphere volume of sphere is =…
Q: Write aprogram using nestedif statements that perform the following test: If the variable employed…
A: #include <iostream>using namespace std; int main(){ char employeed; int workLength;…
c++
Trending now
This is a popular solution!
Step by step
Solved in 9 steps
- NB: USE IF ELSE STATEMENTS FOR THIS CODING IN C++ • Calculate each student's grade - 10 students in a class; each student has taken five tests; each test is worth 100 points • Design algorithms to: - Calculate the grade for each student and class average - Find the average test score - Determine the grade • Data: students' names; test scoresQ1)What are the final values of x and y? int x=1, y=6; if(x>1) if(y<5){ x=x+2; y=y+2; } else{ x=x-1; y=y-1; } x=x+1; y=y+1; Ans: a. x=1, y=4. b. x=3, y=6. c. x=2, y=7. d. x=3, y=7. e. x=2, y=5.why are the following statements NOT considered to be disjunctive normal form? A * (B + ~C) ~(A + B)
- 8. Determine the value of variable num1, num2 and num3 at the end of the following code. int product(int A, int *B){ *B += 1; A *= *B; return A; } int main(){ int num1 = 2, num2 = 3, num3; num3 = product(num2, &num1); O A. num1 = 3, num2 = 3, num3 = 9 num1 = 2, num2 = 3, num3 = 9 num1 = 2, num2 = 3, num3 = 6 %3D D. num1 = 3, num2 = 2, num3 = 6 B.Change Return Program: PYTHON( Just need a description for the **USER** of how it works and how to use it) The user enters a cost and then the amount of money given. The program will figure out the change and the number of twenty-dollar bills, ten-dollar bills, five-dollar bills, single-dollar bills, quarters, dimes, nickels, pennies needed for the change. You must have the maximum amount of higher denominations possible before allowing for lower denominations. For example, If your change is $18.88, You must have One Ten-dollar bill, One Five-dollar bill, Three singles, Three quarters, One dime and three pennies. There should be no nickels; Not three Five-dollar bills etc.Compute the weakest precondition for each of the following statements based on their postconditions. 1. b= 2*a + 3*b 1; a = 2*b {a >= 2}
- Please circle True or False for each of the following statements. C++ The return type void indicates that a function will perform a task but will not return any information upon completion of that task. TRUE FALSEComplete C++ statements to carry out the following tasks. Assume the following variable has been declared. 1) Make x to be the reverse of all the odd digits of original x (ie, x is 23451 originally, x then becomes 153. tempRev temperately store the reverse number). Assume x is a positive number, if x is negative it may do anything. int x, tempRev = 0; ){ tempRev 7 tempRev;1-Compute the weakest precondition for the following statements A. x = 2 * (y + 2*x); y=3*x-6 {y > 9} B. if (x >y) y=6*x+ 2 else y= 3 *x+9; {y > 2}
- Given the declaration:int num1, num2;int *p1;int *p2;double *p3;Mark the following statements as valid or invalid. If a statement is invalid, explain why. a. p1 = &num1;b. num2 = num1 - *p2;c. p3 = p2;d. *p3 = num1;e. *p3 = *p1;f. num1 5 p2;g. p1 = &p2;h. p3 = &num1;i. num1 = *p3;j. num2 = &p1;C++ Exercise 6-14 During the tax season, every Friday, the J&J accounting firm provides assistance to people who prepare their own tax returns. Their charges are as follows: If a person has low income (<= 25,000) and the consulting time is less than or equal to 30 minutes, there are no charges; otherwise, the service charges are 40% of the regular hourly rate for the time over 30 minutes. For others, if the consulting time is less than or equal to 20 minutes, there are no service charges; otherwise, service charges are 70% of the regular hourly rate for the time over 20 minutes. (For example, suppose that a person has low income and spent 1 hour and 15 minutes, and the hourly rate is $70.00. Then the billing amount is 70.00 X.40 X (45/60) = $21.00.) Instructions Write a program that prompts the user to enter yearly income, the hourly rate, the total consulting time. The program should output the billing amount. Your program must contain a function that takes as input the…Find the error in the following code and explain how to fix it: #include int main(void) { int *ptr; int m 1003; ptr = m; printf("%d",*ptr); } %3D