2) int a-49, b-7, c; if (a>5 && b<5) c=a*2%b;
Q: A small code that returns the average earning of all employees
A: In the program, a function named average is created to return the average earning of all employees.…
Q: 5.18 LAB: Count characters - functions Write a program whose input is a character and a string, and…
A: Create a 2 variable of type character and string Then take user input in main method After that…
Q: 2.2 what is the value of S1, S2 and S3 where S1, S2 and S3 type is float and each one is equal the…
A: Given: x=4, y=10, w=-10 ceil() = returns the nearest integer greater than the argument passed sqrt()…
Q: Q4, a mechanical pump whose rated speed is (Sm=15 cfm) is connected by a pipe and valve to a vacuum…
A: Please refer to the following steps for the complete solution to the problem above.
Q: C++ Code Only: One day, Fred and his N friends were playing a card game in which each player throws…
A: We have to write a code to maximize the sum which we get on the front cards, keeping in mind that we…
Q: 1- int a = 1, b = 0; %3D if (a -1) {a = b = 23 ;} cout << x << " "<y< endl; 2- int x; for (x = 1;…
A: I think the x and y in the first program may be a and b. If so, here is the output and the correct…
Q: Assume that a, b, c are numbers. Return 'increasing' if they are in increasing order, 'decreasing'…
A: We have to write a program that can enter a number a,b,c and Return 'increasing' if they are in…
Q: 4. If myAge, a, and b are all int variables, what are their values after myAge = 39; a = myAge++; b…
A: ++myAge returns the worth of an after it has been increased. It is a pre-increase administrator…
Q: Srikanth is a school student. He studies in class 8th. One day his Math’s teacher came to the class…
A: Please find the answer below :
Q: c++ You are implementing a function that checks the value of the following variable of type char…
A: Function to implement bitwise operator without IFs sand switches
Q: The nuclear powerplant at Threeyedfish will automatically run a program to print a warning message…
A: #function to print message def reactorUnstableMessage(): #printing message three times using for…
Q: 24 / A mechanical pump whose speed is (Sm = 15 cfm) is connected by a pipe and valve to a vacuum…
A: C++ CODE #include <iostream>using namespace std; int main() { // your code goes here float…
Q: 5) int x; x=10,20,30; cout<<x<<endl;
A: Coded using C++.
Q: A bag or cookies holds 50 cookies. The calorie information on the bag claims that there are 10…
A: Answering first question as per the guidelines. The problem is based on the basics of functions in…
Q: n C++ 1. Declare, define, and test the following function to check for order by name: bool…
A: a) Declare, define, and test the following function to check for order by name:bool…
Q: Each function should accept two integer parameters indicating the minimum and maximum X value to be…
A: Since I am not supposed to use loops, i am using recursive functions to print the given pattern.…
Q: C++ PROBLEM. PASTE INDENTED CODE HERE void e(int x, int y) { if(y<2) { cout << x << " "; return; }…
A: PROGRAM CODE: #include <iostream> using namespace std;void e(int x, int y) {if(y<2) {cout…
Q: 4. In the following enum enum E { CO=0, C1=1, C2=2}; Overload the + operator to do the following…
A: #include<iostream>using namespace std; //Enum declarationenum E {C0=0 , C1=1 , C2=2};…
Q: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to…
A: def is_leap_year(user_year): if user_year % 100 == 0: #First check if its a century or not…
Q: Consider the statement int val[2] [4] = { 1, 2, 3, 4, 5, 6, 7, 8} ; 4 will be the value of A.…
A: We are given a 2-d array and we are going to find out how an element 4 which is present in the array…
Q: Qno. 1 () Construct a program where implicit conversion would have been done. ii) Construct a…
A: i) #include <iostream> using namespace std; int main() { //declaring int variable int…
Q: 10.9 (Using Unions) Create union floatingPoint with members float f, double d and long double x.…
A: The program is written in c
Q: 8: PGandE.cpp) Consider a gas and electric bill that sets two levels of use as follows: Gas Electric…
A: Coded using C++.
Q: # Define your function here name user values, upper threshold get user_values()…
A: The main logic to print all numbers less than upper_threshold, for i in user_values: if…
Q: This error occurs when a value is not available to a .function or formula #REF!. O #NULL!. O #N/A O
A: Given, This error occurs when a value is not available to a function or formula #REF! #NULL! #N/A
Q: y = floor( x + 0.5 ); rounds the number x to the nearest integer and assigns the result to y. use…
A: C++ code for above : #include <iostream>#include <math.h>using namespace std; int…
Q: Use C++: Develop a Tic Tac Toe game that will match a player against the computer. Do’s: Use a…
A: As per question we use only Program must use: functions loops branching string functions
Q: Write a code im c++ to overload area() function that can find the area of circle, rectangle ,…
A: Formula to calculate the area of the circle of radius, r: area=3.0×π×radius×radius Formula to…
Q: Write a program that takes in a year and determines whether that year is a leap year. Ex: If the…
A: Program description: C program that prompt user to enter the year value. Then pass the year value to…
Q: 7. [10] (Display Pattern) Write a C++ function called pattern that displays a pattern of stars and…
A: In this program, you need to write C++ function called pattern and also need to write main function…
Q: Write a program that takes in a year and determines whether that year is a leap year.
A: /******************************************************************************…
Q: d. Assume i, j and k are integer variables with i=3 and j=4. Determine the value of k for each of…
A: first lets understand operators used in given statements:j++ : post increment operator:means value…
Q: Write a function that returns the number of days in a year using the following header:def…
A: //********C++ class Calendar program to calculate *******////****************number of years, months…
Q: c++ PLEASE TRACE THE FUNCTION Given the code: void d(int n) { if(n<2) { cout << n << "…
A: Function: When we first time called d(12) it will print 12 and then call d(12/3) i.e d(4) when…
Q: Create union floatingPoint with members float f, double dand long double x. Write a program that…
A: First we create the union with three members. Then we will input the values of these members. Then…
Q: 21. The five line bellow are used to determine the profit or loss of a sale based on the buying cost…
A: Given:
Q: Write a function that returns the sum of all the integer numbers dividable by 3 that are smaller…
A: #defined Sum3 function for calculating sum of numbers which are divisible by 3. def Sum3(limit):…
Q: int x=22, y=17; if((x>30 || y<2)) cout<<"BAHRAIN"; else cout<<"MANAMA"; A MANAMA B BAHRAINMANAMA C.…
A: The given code is: int x=22, y=17 here x is not greater than 30 so first condition is false. y…
Q: Assignment Write a program in C that converts temperatures between Fahrenheit, Celsius, and Kelvin.…
A: Below is the required code in C language. Program Approach: Including necessary header files for…
Q: Write C++ statement(s) to allocate space for 10 doubles (using dynamic memory allocation).
A: new is used to allocate space dynamically. syntax: new data-type; statement to allocate space for…
Q: 10-define the function aa(int x,int y) int aa(int x,int y) int aa() void (int x,int y)
A: Function syntax is Return_type function_name (parameter)
Q: Develop a Tic Tac Toe game that will match a player against the computer.
A: #include <iostream>#include <string>#include <time.h>#include <random>using…
Q: 8: PGandE.cpp) Consider a gas and electric bill that sets two levels of use as follows: Gas 10.1…
A: The main object of the program is to read the starting reading gas consumption and ending reading…
Q: int a=4, b=9,x; //Type the ternary condition here cout<<"x="<<x<<endl;
A: 1- The conditional-ternary operator is the simplest programming language operator that takes 3…
Q: VBA EXCEL PROBLEM: Create a function that receives two positive integers a and b and returns ab.
A: The below program uses loop to count ab. In loop we will multiply a to itself, b times. Exit.
Q: Part 1– Substance Test Table 1 below shows the normal boiling points of several substances. Write a…
A: C program to find the whether substance belong to the list
Q: Sub: Data structure Consider the following 'C' routine int DO ( int a[ ], int /b, int ub) { int…
A: The program has two parts: Calling function: It generally pass the value(s) to the called function…
Q: If, A = {3, 5, 7, 9} B = {2, 4, 6, 8, 10} C = {12, 14, 18, 20, 24} D = {21, 26, 31, 36} A.…
A: Given sets are: A = {3, 5, 7, 9} B = {2, 4, 6, 8, 10} C = {12, 14, 18, 20, 24} D = {21, 26, 31, 36}…
Q: Refer to the code segment in Program (A), Identify the value of temp. Program (A) int a[6] =…
A: Below is the complete C++ program to implement the given block of code also the code is well…
Step by step
Solved in 2 steps
- Problem Statement: The mathematician Conway imagined a game, called game of life, which considered cells that are susceptible to reproduce, disappear, or survive when they obey certain rules. These cells are represented by elements on a grid of squares, where a grid has an arbitrary size. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squares that contain other cells. The rules are stated as follows: 1. Survival: Each cell that has two or three adjacent cells survives until the next generation.2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation. Also, each cell that has at most one adjacent cell dies by isolation.3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation.It is worth noting that all births and deaths occur at the same time during a generation. Write a program that simulates this game and displays all successive…In C++ QUESTION 14 class rectangleType { public: void setLengthWidth(double x, double y); //Sets the length = x; width = y; void print() const; //Output length and width double area(); //Calculate and return the area of the rectangle (length*width) double perimeter(); //Calculate and return the perimeter (length of outside boundary of the rectangle) private: double length; double width; }; Write the function definition for the function perimeterIn C++ or python Design and code a class as described in the following diagram Point x:double y:double Point(double, double) Point() getX():double getY():double setX(double):void setY(double):void distance(Point):double
- Python Programming Problem: The first line consist a number X i.e., the number of test cases. The first line consists three space-separated integers N, Q1, and Q1. Then Q1 lines follow, each containing a description of a road proposed0. Each of these lines contains three space-separated integers p, q, and r, where p and q denote the end points of the road and r denotes the associated cost. Then Q1 lines follow, each containing a description of a road proposed by Brian's company in the same format. Output a single line for each test case. If it is impossible to choose a subset of the roads in such a way that for each pair of cities, there is exactly one path of roads connecting them, output a single line containing "No way" for that test case. Otherwise, output a single line containing two space-separated integers: the maximum profit Brian can gain and the minimum total cost of the chosen roads that yields the maximum profit. Input: 1 3 1 1 0 1 1 0 1 3 Output: No waywrite a C++ program. Write a program that calculates and displays the average of a group of test scores, allintegers, after the lowest score in the group has been dropped. There are six testscores in the group. The program must contain only the following functions in additionto the main:• void getScore should ask the user for a test score, store it in a referenceparameter variable, and validate it. This function should be called by the mainfunction once for of the six scores to be entered by the user.• double calcAverage should calculate and return the average of the five highestscores. This function should be called just once by the main function, and shouldbe passed the six scores. Use pass by reference to receive the lowest test score.• int findLowest should find and return the lowest of the six scores passed to it. Itmust be called by the calcAverage function, which uses it to determine which ofthe six scores to drop.• void displayResults should be called by the main function to…Deal or No Deal game using JAVA as per game rules and with atleast more than 3 functions .
- Module/Week 7 ASSIGNMENT (ARRAYS)Use functional decomposition to write a C++ program that asks the user to enter his or her weight and the name of a planet. Use an enumerated type called planetType to represent the planets and use a switch statement that takes as its condition a planetType variable. The program, via the switch statement, then outputs how much the user would weigh on that planet. The following table gives the factor by which the weight must be multiplied for each planet. Your program must have the following functions in it: GetUserInput(), ConvertInputToPlanetType(), and OutputWeight() (your switch statement must be in OutputWeight()). I will let you determine what each function’s parameters and return types should be. The program will output an error message if the user does not type a correct planet name. The prompt and the error message will make it clear to the user how a planet name must be entered. Use proper formatting and appropriate comments in your code. The…Module/Week 7 ASSIGNMENT (ARRAYS)Use functional decomposition to write a C++ program that asks the user to enter his or her weight and the name of a planet. Use an enumerated type called planetType to represent the planets and use a switch statement that takes as its condition a planetType variable. The program, via the switch statement, then outputs how much the user would weigh on that planet. The following table gives the factor by which the weight must be multiplied for each planet.Your program must have the following functions in it: GetUserInput(),ConvertInputToPlanetType(), and OutputWeight() (your switch statement must be in OutputWeight()). I will let you determine what each function’s parameters and return types should be. The program will output an error message if the user does not type a correct planet name. The prompt and the error message will make it clear to the user how a planet name mustbe entered.Use proper formatting and appropriate comments in your code. The utput…Athematic Weight calculator (4 operations)Create a class Weight which contains:• Kilograms (kgs)• Grams (g)Write a C++ program using operator overloading for the following:• >>: To accept the weight.• <<: To display the weight.• +: To add weight• –: To subtract weight
- C++ Programming Exercise: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first month's interest on $1,000 is 1000 X 0.006 = 6. Becuase the payment is $25 and the interest of the first month is $6, the payment toward the principal amount is 25-6 = 19. This means after making the first payment, the loan amount is 1,000-19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 X 0.006 = 5.886,…Computer Science XYZ Corporation wants to develop an application for managing its employees. Employees have their name, salary, department, and date of hire. The department has a name and manager whereas date of date of hiring has day, month, and year attributes. Using C#, write an application for XYZ Corporation so that they can manage their employees.C++ PROBLEM: PASTE INDENTED CODE PLZZ Given the following functions:void increment(int x, int y) {x+=y;} int main() {int n=10, amount = 5;increment(n,amount);cout << n << "\n";return 0;} 1. Explain the problem with the increment function.2. Explain how to fix the problem without changing the main function.