Examine the following C++ code and determine the output. int a = 5, c = 10; %3D if (a) if (c) if(a - a) cout<<"W"; else cout<<"X"; else cout<<"Y"; cout<<"Z"; а. XZ O b. XY
Q: Examine the following C++ code and determine the output. int s-0, d, x-42; while (x > 0) { d = x %…
A: In this question, we have to determine the output of the given C++ Code. We are using while loop…
Q: (2) What is the output of the following intermediate C++ codes? a) int n=8; if (!n>9) cout << "Yes";…
A:
Q: Let X and S denote any valid C++ expressions. Then, the below statement is equivalent to: do (X}…
A: The given requirement is to select one correct answer from the given options a,b,c,d and e . The…
Q: Q1/ Use the structure Time to write a C++ program that inputs a time in hours, minutes and seconds…
A: #include<iostream> using namespace std; //Time Structure struct Time { int h,m,s; };…
Q: Write a complete C program to prompt the user to enter the total chargeable income (RM), and then…
A: given: required: to create a c program to calculate income tax based on the given table
Q: Given: int g=10, h=3; Write a single C++ statement that will print the result of floating-point…
A: #include <iostream> using namespace std; int main() { int g=10; int h=3; //single…
Q: Q1/ Write C++ program to the following equations .(if- else statement). to compute the value of Y…
A: Algorithm: Start Read x value if x is 0, calculate y=2*x*x*x+5*x-4 else if x is 1, calculate…
Q: Write a C++ statement that uses the manipulator setfill to output a line containing 35 stars, as in…
A: Program: #include <iostream>#include <iomanip>using namespace std;int…
Q: Write C++ statements that accomplish the following. (6, 7) а. Declare int variables x and y.…
A: Please find the answer below
Q: Write a C code that given a date (year, month and day) finds and displays the next date. Consider…
A: PROGRAM: //header files #include<stdio.h> #include <stdlib.h> //prototype of the…
Q: 2. In this assignment, find the output of the C++ prog given below. #3include using namespace std;…
A: We are given a C++ code and we are going to find out its output.
Q: Q6 Answer the following question based on the given statement. "Calculation of electricity meter…
A: Answer: The meter reading code is given below : #include <stdio.h>#include <conio.h> int…
Q: C++ Have the user input a Float (ex: -15.750) and the output must display the following: Float…
A: c++ program to input the float value and print it into IEE 754 representation.
Q: Q1/ Write a C++ program to calculate the volume of a sphere V, where the volume can be found using…
A: Formula Used: Volume of sphere(V)=43(πR3) Algorithm: Define the value of PI to 3.14 Input the…
Q: 2. Determine the value of variables after executing each of the following C++ Statement. (all…
A: Note: For the programming purpose i have use the demo value x =5 ,y = 6 , z = 7. Program Code…
Q: Please use C++ Programming Write a program that inputs a number from the user (i.e. 0-99). The…
A: Write C++ program that inputs a number from the user (i.e. 0-99). The program should print a number…
Q: Examine the following C++ code and determine the output. int s=0, d, x-42; while (x > 0) { d = x 8…
A: Consider the given code: int s=0,d,x=42; while(x>0){ d=x%10; s=s*10+d;…
Q: Q1:- Write a C++ program to find the value of the following equation:y = v3x2 +x - 5 + sin %3D (r) *
A: Required: Required code with comments for explanation and screenshot of both code and output has…
Q: If money is left in a particular bank for more than 5 years, the bank pays interest at a rate of…
A: CODE:- #include <iostream>using namespace std;void check(int numYears){ if (numYears >…
Q: Declare all variables of double type and then translate the following equation to a C++ statement.…
A: The mathematical functions used in the given mathematical equation are sin, log, and the square root…
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: 3) Write a C++ program to implement the following expression: 3x? + sin(x² ) 5 * 7w - 2 Y = Velel -8…
A: C++ program to calculate a expression : #include <iostream> #include <cmath> using…
Q: A golf ball is dropped from an airplane. The distance, d, the ball falls in t seconds is given by…
A: totDistance = 0.5*Gravity*time*time; distance = totDistance - distance;
Q: Examine the following C+ code and determine the output. int a = 5, c = 10; if (a) if (c) %3D if (a -…
A: Answer:a. XZ
Q: A management firm has 100 employees in total. The management firm increases the salary of the…
A: I have provided C++ CODE along with SCREENSHOT OF CODE WITH OUTPUT---------
Q: Exercise 2: Write a C++ program that asks the user to enter the value for input variables, and…
A: The code for the above problem is as follows:
Q: C- Write C++ statement to accomplish each of the following. 7. Dečlare variables sum and x to be of…
A: //Importing library#include <iostream>using namespace std;//Main of the codeint main(){ //7th…
Q: Write the c code that finds the roots of the equations y = 2x ^2+ 3x + 2. The coefficients of the…
A: The nature of the roots depends on the Discriminant (D) where D is. If D > 0, the roots are real…
Q: Write a single C statement to accomplish each of the following:a) Define the variables c,…
A: The answer is...
Q: Q2) A store asks you to write a C program to make cash payment easier for cashiers. Write a C…
A: We have to write a code about payment system
Q: This link describes a simple gravity pendulum which consists of a point mass suspended from a string…
A: the answer is given below:
Q: If money is left in a particular bank for more than 5 years, the bank pays interest at a rate of…
A: PROGRAM CODE: #include <iostream> // include header file for input output streamusing…
Q: ii) Write a C program to calculate and display the acceleration due to gravity at the surface of the…
A: #include <stdio.h>#include <math.h> int main() { double g; /* declare variable to…
Q: Write the code (IN C++!!!) to have the user enter a number, then print out “BINGO" if the number is…
A: I have provided C++ CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT-------------------
Q: Q2. Write a C+ program that prompts the user to enter 3 number (x1,x2,x3) and compute and display…
A: The main objective of the program, avgstd.cpp to prompt the user to enter the three values and read…
Q: The spring force, Fs of a deformed spring is defined as follows: Fs = K|L2 - L1| where K is the…
A: fabs function is used to find the positive difference of 2 float numbers
Q: Assuming a frictionless environment, the velocity of an object, v, that is released from a…
A: Here I have created the function named velocity(). In this function, I have calculated the velocity…
Q: X is integer value based on your the last TWO(2) digit Matric Card number. If the value X is ODD,…
A: We have to write a C++ program in the above condition.
Q: Suppose x and y are int variables and symbol is a char variable. Assume the following input data:…
A: a) Consider the below given program code: //including necessary header files #include…
Q: Examine the following C++ code and determine the output. int s-0, d, x-45; while (x > 0) { d - x 10;…
A: Explanation) after the first loop- d will be 5; s=5 ,it will also be same as (s=10+s+d) and s is 0…
Q: 2. Write the equivalent C++ statement for the following Math formula: b In K 3. Write the equivalent…
A: Mathematical formulas contain the exponential and algorithms and power of variables. C++ programming…
Q: Modify the craps program to allow wagering inside of C#. Initialize variable Balance to 1000…
A: Solution:: package april.april16; import java.util.Random; import java.util.Scanner; public…
Q: Write a single C statement or line that accomplishes each of the following:b) Assign the product of…
A: We have to write a statement in C language. This statement should assign the product of variables b…
Q: Find the error in the following C code. main) { int i; for (i=o;i<3;i++) continue;
A: Below the which statement is right when run the program
Q: Y USING C++, SOLVE THE FOLLOWING QUESTION. Based on the coding attached, further modify the C++…
A: Q: Code the given problem.
Step by step
Solved in 6 steps with 2 images
- Q1) How to write a C program segment that prompts and accepts the age and number of hours the customer has spent in the “FUNNY Theme Park”. Then, displays the charges based on the rates shown in Figure 2 below : Age Range Rate ( per hour) (RM)0-20 1.0021-50 3.50Above 50 2.00 In your program, you have to make use of THREE(3) different defined constants for the value of rate per hour and declare the necessary variables.Modify the craps program to allow wagering inside of C#, and explain each step (reject if you can't). Initialize variable Balance to 1000 dollars. Prompt the player to enter a wager. Check whether the wager is less than or equal to Balance and, if not, have the user reenter the wager until a valid wager is entered. After a valid wager is entered, run one game of craps. If the player wins, increase Balance by wager, and print the new Balance. If the player loses, decrease Balance by wager, print the new Balance, check whether Balance has become zero and, if so, print the message “Sorry. You busted!” (explain steps as much as possible so I can understand plz).The program to modify has the code listed below:// Craps class simulates the dice game craps.using System; class Craps{// create random-number generator for use in method RollDiceprivate static Random randomNumbers = new Random(); // enumeration with constants that represent the game statusprivate enum Status {Continue, Won, Lost}…In C++ Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved by executingcout << fixed << setprecision(2); once before all other cout statements. Ex: If the input is: 20.0 3.1599 the output is: 3.16 11.85 79.00 Note: Real per-mile cost would also include maintenance and depreciation.
- Modify the following C code to get the given output: #include <pthread.h> #include <semaphore.h> #include <stdio.h> /* This program provides a possible solution using mutex and semaphore. use 5 Fsrmers and 5 ShopOwner to demonstrate the solution. */ #define MaxCrops 5 // Maximum crops a Farmer can produce or a Shpoowner can take #define warehouseSize 5 // Size of the warehouse sem_t empty; sem_t full; int in = 0; int out = 0; char crops[warehouseSize]={'R','W','P','S','M'};//indicatig room for different crops char warehouse[warehouseSize]={'N','N','N','N','N'};//initially all the room is empty pthread_mutex_t mutex; void *Farmer(void *far) { /* 1.Farmer harvest crops and put them in perticular room. For example, room 0 for Rice(R). 2.use mutex and semaphore for critical section. 3.print which farmer is keeping which crops in which room inside the critical section. 4.print the whole warehouse buffer outside of the critical section */ }…C++ Programming: Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output the average calories burned for a person. Output each floating-point value with two digits after the decimal point, which can be achieved by executingcout << fixed << setprecision(2); once before all other cout statements.Write C++ statements that accomplish the following. Declare int variables x and y. Initialize x to 25 and y to 18. Declare and initialize an int variable temp to 10 and a char variable ch to 'A'. Declare and initialize a double variable payRate to 12.50 Copy the value of an int variable firstNum into an int variable tempNum Declare int variables to store four integers.
- In C++, write a program that calculates and prints a monthly paycheck for an employee. The net pay is calculated after taking the following deductions from the employee's gross salary: Federal Income Tax: 17.5% State Tax: 9.1% Social Security Tax: 6.2% Medicare Tax: 1.45% Retirement Plan: 9.29% Health Insurance: $51.48 Life Insurance: $3.71 Your program will prompt the user to input the employee ID, the employee name, and the employee's monthly gross salary. The program will calculate the deductions listed above, along with the percentage of take home pay (defined as the net pay divided by the gross salary). After calculating each deduction and percentage, the output will be printed to the screen (see example output below). Requirements All decimal numbers must be formatted to 2 decimal places. Ask for the employee's ID first, then full name (can include spaces), then the salary. The prompt to enter the salary must include the employee name. The employee ID MUST be…Write an application that inputs three integers from the user and displays the sum, average, product, smallest, and largest of the numbers. [Note: The calculation of the average should result in an integer representation of the average. So, if the sum of the values is 7, the average should be 2, not 2.3333….] For C# programming(Numerical) a. Write a C++ program that accepts an integer argument and determines whether the passed integer is even or odd. (Hint: Use the % operator.) b. Enter, compile, and run the program written for Exercise 8a.
- (Data processing) Years that are evenly divisible by 400 or are evenly divisible by 4 but not by 100 are leap years. For example, because 1600 is evenly divisible by 400, 1600 was a leap year. Similarly, because 1988 is evenly divisible by 4 but not by 100, it was also a leap year. Using this information, write a C++ program that accepts the year as user input, determines whether the year is a leap year, and displays a message telling the user whether the entered year is or is not a leap year.Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('%0.2f' % your_value) Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles. Ex: If the function is called with: 50 20.0 3.1599 the function returns: 7.89975 def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon) Your program should call the function three times to determine the gas cost for 10 miles, 50 miles, and 400 miles. Note: This is a lab from a previous chapter that now requires the use of a function.Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('{:.2f}'.format(your_value)) Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call the following driving_cost() function. Given input parameters driven_miles, miles_per_gallon, and dollars_per_gallon, the function returns the dollar cost to drive those miles. Ex: If the function is called with: 50 20.0 3.1599 the function returns: 7.89975 def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon) Your program should call the function three times to determine the gas cost for 10 miles, 50 miles, and 400 miles. Note: This is a lab from a previous chapter that now requires the use of a function. def driving_cost(driven_miles, miles_per_gallon,…