What does the following code output? int x = 7, y = 10; X -= 32; y *= 4; cout « "y = " « y « " and x = " « x « "; " « endl; %3D x += 32; y /= 3; x *= 3; y -= 4; cout << "x = " << x << %3D and y = " << y « ";" <« endl;
Q: What's wrong in my code?? #include using namespace std; int main () { int basicSalary, bonus =…
A: 1: First error is that you missed to input gender, after asking to input gender 2: To check for…
Q: Q2/ Write new code have the same effect .for the following by using IF q2 int main() { int score;…
A: We will write the new code which will have the same effect but it will use if.
Q: please do its main part. #include using namespace std; int calc( int x, int &three, int &five ) {…
A: Program with its main part is as follows, #include <iostream> using namespace std; int calc(…
Q: The date June 10, 1960, is special because when it is written in the following format, the month…
A: <!DOCTYPE html> <html> <head> <title>Special Date…
Q: Write code that takes the size of their foot from user and prints out suggested sandal size. Shoe…
A: To give a problem, we have to take value from the user and then checks a condition and show the…
Q: The output of this program when i= 3 and j=4 is ;int i.j ;cin >> i>>j ;cout << (i < 5 || i < j) <<…
A: Find Your Answer Below
Q: What does the following code display: int value = 41; System.out.printın ( "Incrementing value: " +…
A: Here, we have given the java code. We need to complete the whole code in order to extract the output…
Q: // Currently, this program displays data for all students. Modify it to display only those who have…
A: To display the data for the students who have more than 60 credits and have a GPA of at least 3.5,…
Q: int main() { int i, salary[10], range[9]={0, 0, 0, 0, 0, 0, 0, 0, 0}; double gross[10], total[10];…
A: The regular expression (RE) contains the symbol 0 and 1 only. The expression is:…
Q: int x = 2; int y = 8; Ilprint x and y values at this point while (x+y < 20)}{ x = x + 2; y = y - 1;…
A: a)Trace of the given program:initially x and y : 2,8now x=2,y=8x+y<20 : 10<20 is…
Q: How many times the statement "Statement" is printed in the following code? void fun(int R)…
A: the answer is as follows
Q: The result of the #include following program is void main( ) { int x, y, z; x=10; y=5; z=0;…
A: Answer: Option (D), 0 60 1250 Given Code(running equivalent): #include <iostream> using…
Q: Bob takes medication three times a day. In the morning at 8:00, in the afternoon at 13:00, and in…
A: The Enum in C is a data type which contains a fixed set of constants. The enum constants are…
Q: An employee is paid at a rate of $16.78 per hour for regular hours worked in a week. Any hours that…
A: Program Explanation: 1) Here are input and output methods that are to be used. 2) Use the access…
Q: Tuary. deposit is then made of £1000 at the end of every month for the next 12 months. Interest is…
A: a. Code: amount=zeros(1,12);amount(1)=100000;interest=zeros(1,12);fprintf('Month\tInterest…
Q: Complete the code that returns the value of ?(?)f(x), which has the value 1 inside the range…
A: Given that, given function f(x), which has the value 1 inside the range -1≤x≤1 otherwise it is the…
Q: The following program is used in a bookstore to determine how many discount coupons a customer gets.…
A: #include <iostream> using namespace std; int main(){int numBooks, numCoupons;cout <<…
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: The great circle distance is the distance betweentwo points on the surface of a sphere. Let (x1, y1)…
A: Note: Programming language is missing in the question. So we will answer this program in Java…
Q: 2- What will the following code do? j=0; i=5; while(j<0) j=j-1; i=i+5;j=i; end
A: Given Code: j= 0;i= 5;while(j<0) j = j-1; i = i+5; j = i;endRequired:Explain what the…
Q: int main() { if(var1>50) { num = 20.0 } else { if(var1>35) ---- Line 7 { num= 35.0; }…
A: Given: In order for the value of num to equal 60.0, what should the result of the condition in line…
Q: Assume there is a variable, h that has already been assigned a positive integer value. Write the…
A: In step 2, you will get python code. In step 3, you can see the sample output.
Q: A. If you have the following code: int a = 2, b = -3, c 2; %3D bool vall = false, val2 true; char ch…
A: There are many expression given with one code as per mentioned below, int a=2,b=-3,c=2; bool…
Q: Mad Libs are activities that have a person provide various words, which are then used to complete a…
A: Output Screenshot:
Q: Write a pseudo code that calculates the total point earned by a football team over a series of games…
A: Pseudocode: Start the program Declare score, i = 0, counter = 0, sum = 0 Get the input scores from…
Q: (b) specify the location of the errors. If you find no error at all, write "No Errors." Find all 5…
A: The given code is below with some errors- 1 #include 2 3 4 class X { 5 public: 6 X(double x): x(x)…
Q: * What will be the contents of the variable x after the following statement is executed? x =…
A: Answer in step 2
Q: 3- How many the number of erTors in the following sub_ program? Hinclude void main( ) intnum, sum -…
A: the answer is option d 7
Q: customer's credit limit is now RM250. UTM M4000. If a customer had a credit limit of RM500, this Due…
A: #include<iostream>using namespace std;int main(){ float c_score, limit, balance; int ac;…
Q: Assume that an int variable age has been declared and already given a value. Assume further that the…
A: Given:
Q: The result of the program is #include void main( ) { int x, y, z; x=10; y=5; z-0;…
A: Here, I have to choose an option for the given question.
Q: What will be displayed by the following statement? (Hint: Indent the statement correctly first.) int…
A: Output of the code for if else if loop is detailed in step 2
Q: Houl 4O Part E Question 1 Part E Question 2 Part E Question 3 Part E Question 4 Part E Question 5…
A: The correct code for the perimeter is:-
Q: QUESTION 8 Kebabo Internet Services offers customers with 600 weekday minutes for a flat rate of…
A: ANSWER:-
Q: ii. int x 55, y = 5; switch (x % 7) { case 0: case 1: y++; case 2: case 3: yy + 2; case 4: break;…
A: Dear Student, It is given that x = 55 and y = 5 , And x divided by 7 gives an remainder 6 thus x%7 =…
Q: Create a change-counting game that gets the user to enter the number of coins required to make…
A: Since you are not mentioning the programming language, here we are using C++ to complete the…
Q: 10 % discount. If the user purchases butter and flour he will get 15% discount. Otherwise, there is…
A: import java.util.Scanner;public class MyClass { public static void main(String args[]) {…
Q: Assume that M is declared as int, and a value is stored in it. How would you check *? whether N is…
A: N is between 3 and 9 So it will be 4,5,6,7,8 Ans is if(M>3 && M<9) This means M is…
Q: If the number of items bought is less than 5, then the shipping charges are $7.00 for each item…
A: Correct code Here shipping charges are $7.00 for each item, if the number of items is less than 5.…
Q: What would be displayed as the daily dosage of medicine to be administered to a dog weighing 4…
A: The above algorithm is used to get the daily dosage of medicine for a dog based on its weight. Dog's…
Q: Mad Libs are activities that have a person provide various words, which are then used to complete a…
A: Introduction: The program simply prompts user to enter firstname, some location, and some number…
Q: What will be displayed by test(3); ? void test( int n) if (n1) cout << "**". else test( n - 1); cout…
A: Recursive call: test(n-1); It perform calling repeatedly until base case is executed. Here…
Q: The price of a plane ticket is 1000$ by default, but discounts are applied to it based on different…
A: If-else block is a part of the conditional statements.
Q: The result of the following program is: #include void Sfintxint &yint &z) [y-y%x-1: z-ax+1) void…
A: let's see the correct answer of the question
Q: Q2/ Write new code have the same effect .for the following by using IF q2 int main() { int score;…
A: - We have to do the following code in c++ with if statements.
Q: Q4. Write a program that calculate the person's Body Mass Index (BMI). The BMI is often used to…
A: Given: Write a program that calculates and displays a person’s body mass index (BMI). The…
Q: What should be printed on screen? int main() int x = 5; if(x++ == 5) cout<<"Five"<<endl; else if(++x…
A: The output of the given C++ code is: Five Therefore, the correct option is D. Five.
Q: int a = 5, b = 12; double x = 3.4, z = 9.1; What are the values of the following expressions? A) b/…
A: Here is the program which execute these statements #include<iostream>using namespace std;int…
Q: "Meadowdale Dairy Farm sells organic brown eggs to local customers. It charges $3.25 for a dozen…
A: Take egg quantity input from the user. As dozen = 12, Calculate dozen by dividing total eggs by 12.…
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- What will be the value of ans after the following code has been executed? int x = 90, y = 55, ans = 10; if ( x == y); ans *= 2; 1. 10 2. 145 3. 20 4. None of these* consider the following code * #include <iostream>using namespace std;int main(){ double wages, hours, OThours, OTamount, totalWages; double rate = 20.00; double OTrate = rate * 1.5; cout << "how many hours did you work this week?" << endl; cin >> hours; if (hours > 0 && hours <= 40) { wages = (rate * hours); totalWages = wages; } else if (hours > 40 && hours <= 60) { wages = (rate * 40); OThours = (hours - 40); cout << "OTHours = " << OThours << endl; OTamount = (OThours * OTrate); cout << "OTamount = " << OTamount << endl; totalWages = (wages + OTamount); } cout << "totalWages = " << totalWages << endl;} What is the OTamount if 50 hours were worked?First, write code that uses cin to read in a value for numTomatoes from input. Then, write code that uses cout to output "She sold me ", the variable numTomatoes, and " tomatoes." End with a newline. Ex: If the input is 8, then the output is: She sold me 8 tomatoes. Ex: If the input is 9, then the output is: She sold me 9 tomatoes #include <iostream>using namespace std; int main() { int numTomatoes; /* Your code goes here */ return 0;}
- Mortgage bond L, interest rate r =15%. The fixed payments P to pay off the loan over N years is given by P= rL(1+r/12)^12N/12(1+r/12)^12N -1) a)Write a code to compute and print P if N = 20 and the bond is $50,000 b) how P changes with N . Can you find a value for which the payment is less than $625? c) go back to N =20 and examine for different interest rate . Raising the interest rate increase the payment by $37?8. Write a program that allows the user to enter two integers and a character If the character is A, add the two integers If it is S, subtract the second integer from the first if it is M, multiply the integers Display the results of the arithmetic The following problems requires nested if-statements9. Write a console-based application that asks a user to enter an IQ score. If the score is a number less than 0 or greater than 200, issue an error message; otherwise, issue an “above average”, “average”, or “below average” message for scores over, at, or under 100, respectively.10. Write a console-based program that prompts a user for an hourly pay rate. If the user enters values less than $7.50 or greater than $49.99, prompt the user again. If the user enters an invalid value again, display an appropriate error message. If the user enters a valid value on either the first or second attempt, display the pay rate as well as the weekly rate, which is calculated as 40 times the hourly rate.…What does the following code segment display? for(f=0; f<3; ++f); write ("{0} ", f); a. 0 b. nothing c. 3 d. 0 1 2
- 3. B) What is the value of num when the following code snippet runs successfully? int num = 100; if (num < 100) { if (num < 50) { num -= 5; } else { num -= 10; } } else { if (num > 150) { num += 5; } else { num += 10; } } C) A store provides 10 percent discount on all items with a price of at least $100. No discount is otherwise applicable. Assume that two variables are declared, discount and price. Write the code segment that does the job.What's wrong in my code?? #include <iostream> using namespace std; int main (){int basicSalary, bonus = 0, years, newsalary;char gender;cout << "Enter the basic salary amount: ";cin >> basicSalary;cout << "Enter the number of years: ";cin >> years;cout << "Enter if the employee is F for Female or M for Male: ";if(years > 5 && gender == 'F')bonus = years * 20;else (years < 5 && gender == 'F')bonus = years * 10;else(years > 5 && gender == 'M')bonus = years * 40;else(years < 5 && gender == 'M')bonus = years * 20;newsalary = basicSalary + bonus cout << "Bonus amount is: " << bonus;cout << "The new salary is " << newsalary; return 0;}Determine the distance between point (x1, y1) and point (x2, y2), and assign the result to pointsDistance. The calculation is:Distance = SquareRootOf( (x2 - x1)2 + (y2 - y1)2 ) #include <stdio.h>#include <math.h> int main(void) { double x1; double y1; double x2; double y2; double xDist; double yDist; double pointsDistance; xDist = 0.0; yDist = 0.0; pointsDistance = 0.0; scanf("%lf", &x1); scanf("%lf", &y1); scanf("%lf", &x2); scanf("%lf", &y2); /* Your solution goes here */ printf("%lf\n", pointsDistance); return 0;
- 4.4 Arithmetic Operator #include <iostream>using namespace std;main (){ int a, b, c, sum; cout <<"An arithmetic operator program\n"; cout <<"\nenter first integer, a:"; cin >>a; cout <<"\nenter second integer, b:"; cin >> b; cout <<"\nenter thrid integer, c:"; cin >> c; sum = a * b - c % 3; cout << "\nthe sum of (a * b - c % 3) is " << sum << endl; return 0;} Can you predict what is the output will be before run the code?First, write code that uses cin to read in a value for numLimes from input. Then, write code that uses cout to output "I bought ", the variable numLimes, and " limes." End with a newline. Ex: If the input is 6, then the output is: I bought 6 limes. Ex: If the input is 8, then the output is: I bought 8 limes. #include <iostream>using namespace std; int main() { int numLimes; /* Your code goes here */ return 0;}Nice Number Programming: Nice program ask user to enter three integers from keyboard (java console), the three integers represent left bound, right bound and arbitrary digit 'm', where left bound is less than right bound. Program should print all nice numbers in the given range that doesn't contain digit 'm'. The number is nice if its every digit is larger than the sum of digits which are on the right side of that digit. For example 741 is a nice number since 4> 1, and 7> 4+1. with digit m=2. Write a complete program in Java that Call only One method (niceNumbers method) that will print all nice numbers excluding a given digit 'm' that also entered by user?