Assuming a frictionless environment, the velocity of an object, v, that is released from a compressed spring can be determined by the following equation: kx2 17%3= m Where k, x and m is the spring constant, spring displacement and mass of the object respectively. Write a complete C program to read in k, x and m. The program then displays v which is computed using a programmer-defined function named velocity. Note: Use the sqrt() and the pow() function from the math.hlibrary to calculate the square root and the power of a number. Write your C Program here:
Q: PROBLEM: Write a program that computes for the Electric Field and Electric Potential at a given…
A: PROGRAM EXPLANATION Include the header file. Define the main function. Create three variables to…
Q: Write a program in C to print a diamond using *. Ask the use to input the height of the pyramid.…
A: Please find the answer below :
Q: A computer company pays its employees salaries based on amount of monthly sales made by each…
A: In questions with many questions, we must solve the first one.
Q: 3. The body surface area (BSA) in m? of a person can be calculated by the formula: BSA =…
A: Given : BSA:0.007184W0.425H0.75 here w is the mass in kg anf h is the height in cms. the input…
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: One lap around a standard high-school running track is exactly 0.25 miles. Write a program that…
A: Programming instruction: Declaring variable. Take input from the user. Call the function which…
Q: NOTE: in mathematics, the square root of a negative number is not real; in C++ therefore, passing…
A: A C++ program is to be created that will read the value for area of square and will print the…
Q: rite a C++ program to calculate a person’s pay stub assuming paid on a monthly basis.
A: #include<iostream>#include<iomanip>using namespace std;void input(char *name, double…
Q: i am having problems making my program works. the following is what I have to do and underneath it…
A: Ans is given in following steps:
Q: The volume of oil stored in an underground 200-foot deep cylindrical tank is determined by measuring…
A: float filled(int r,int h){ float pi=3.141; return (float)pi*r*r*(200-h);}
Q: In the U.S. fuel efficiency of cars is specified in miles per gallon (mpg). In Europe it is often…
A: function Lkm = mpgToLpkm(mpg) % multipy by 0.425144 to get % get kmpl then divide 100 % by kmpl to…
Q: The maximum allowable deflection of a beam depends on its function. For a floor, the typical maximum…
A: The maximum deflection of a beam can be calculated by the length of the beam and type of the beam as…
Q: a. Declare variables to store three sides of a triangle. The variable should be able to be accessed…
A: #include <stdio.h>#include<math.h> float AreaOfTraingle(float,float,float);…
Q: This question is supposed to be a C++ program: Complete the following function which takes as input…
A: As given, I need to write a C++ program having a function called calculateAge that takes two…
Q: The distance between two points pA (XA,YA) and pB (XB,YB) is calculated as follows V(XA-XB)+(YA–YB)…
A: Find the required code in C++ given as below and sample output :
Q: Write a C++ program to calculate net pay of an employee. Input basic pay from user, and pass it to a…
A: #include <iostream> using namespace std;int CalculatePay (); int CalculatePay (){ int hra,…
Q: Write a program to calculate the position of a projectile at a given time t. For an initial velocity…
A: - We need to highlight the code to find the x and y coordinates using functions. - We are using C++…
Q: PROBLEM: Write a program that computes for the Electric Field and Electric Potential at a given…
A: PROGRAM EXPLANATION Include the header file. Define the main function. Ask the user to enter the…
Q: (a) ask the item price from the user (b) ask how many items to purchase for a specific item price…
A: As we are not sure about the number of items, to be added we can make use of loops to accept input…
Q: Write a function that prints your name as the last two digits of your number (with a Do-While loop).…
A: To take the input of whole name fgets function is used. fegts function takes input irrespecive of…
Q: DO IT WITH C++ PROGRAM 1. Write a parameter and return program that will require the user to enter…
A:
Q: Write a function that accepts weight in pounds and returns the equivalent weight in kilograms where…
A: Algorithm: Start Read weight in pounds Implement method convert() which takes weight in pounds as…
Q: Write a C++ Program to calculate Perimeter of Isosceles Trapezoid and Area of Isosceles Trapezoid
A: Input h,b1,b2 Calculate Perimeter and perimeter formula is wrong in given hint it should be…
Q: Hi A game is played in which a single dice is tossed. If the result is 4 or 6, the player wins. If…
A: Above function game re-written in switch-case statement: void game(int roll) { switch (roll)…
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: Implement a C function, named triangle, that outputs Pascal's triangle. An example is provided…
A: #include < stdio.h > long factorial(int); int main() { int i, n, c;…
Q: Write a C++ program to calculate net pay of an employee. Input basic pay from user, and pass it to a…
A: Using C++ program, net pay has to be calculated based on the basic pay input from the user . The…
Q: The code should be in C++ language Write a C++ program that takes as input five numbers and outputs…
A: Code: #include <iostream>#include <cmath>using namespace std;int mean_sd(int x1,int…
Q: Using functions write a C++ program to print the following figure: show return value, parameters…
A: C++ programming is an object-oriented programming language, It will also be supported by procedural,…
Q: Given the projectile's velocity (u), the projectile's angle (0), and the acceleration due to gravity…
A: - We need to solve the projectile problem in C.
Q: C++
A: Pseudocode: Program starts calculate_energy(argument m) Read c=299792458 calculate e=m*(c*c) return…
Q: Write a complete C program to calculate the perimeter and area of a triangle with 3 sides namely a,…
A: PROGRAM: //Header files #include <stdio.h> #include <string.h> #include <math.h>…
Q: PROBLEM: Write a program that computes for the Electric Field and Electric Potential at a given…
A: Your C++ program is given below as you required with an output. We are going to calculate the…
Q: user-defined function and appropriate conditional and looping statements, create a program using C++…
A: Explanation: Detail Code #include <bits/stdc++.h>using namespace std; int main(){ int…
Q: The following formula gives the distance between two points (x1, y1) and (x2, y2) in the Cartesian…
A: Required: Consider the main function for this program to be an application. Provide comments at the…
Q: Write a C program to take a depth (in kilometers) inside the earth as input data; compute and…
A: Required: Write a C program to take a depth (in kilometers) inside the earth as input data; compute…
Q: (Use Python) Use the Design Recipe to write a function called compute_commission that returns the…
A: ALGORITHM:- 1. Take input for model and extra features sold from user. 2. Pass both the values to…
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: Write a C++ program that prompts the user to enter two integer numbers and the program should print…
A: The code and the output has been given in step 2.
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: The mass (mo) and half-life (dt) and elapsed time (t) of the radioactive element in grams will be…
A: Input : mass (mo) half-life (dt) elapsed time (t) of the radioactive element in grams Output :…
Q: Write a C++ program that calculates the Diagonal of a Square. The main function asks the user to…
A: Diagonal of a Square=side* square root of 2 Algorithm 1. In main take side length of square from…
Q: Write a complete C program to calculate the perimeter and area of a triangle with 3 sides namely a,…
A: The following C code has five functions. They are: void menu() - This function is to print the…
Q: A farmer is asking to tell him how many legs can be counted among all his animals.The farmer breeds…
A: - The question is to find the total number of animals after having the number of legs for chicken…
Q: Question: The polar coordinates r and 0 of a point (x, y) in the plane can be computed as follows:…
A: #include<stdio.h> #include<math.h> void polar(float,float); int main(void) {…
Q: In mathematics, a factorial of a number is calculated by multiplying that number by all of the…
A: We are authorized to answer one question at a time since you have not mentioned which question you…
Q: PROBLEM: write a program that computes for the Electric Field and Electric Potential at a given…
A: C++ calculate the Electric Field and Electric Potential at different point of the spherical surface.
Q: Please use C++. Write the following function declarations as they would appear on single lines above…
A: Function declarations in C++ a. bool doTheLogic(bool a) b. bool doTheLogic(bool a, bool b) c. bool…
Q: Write a program in C++ to input two integer numbers (X and Y), the program should contain two…
A: Here we will have 3 function Main() Function1() Function 2() The syntax of function1() will be…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Write a function days_in_month() that returns the number of days in a month. The function has the following prototype: int days_in_month(int month, int is_leap); Month should be an integer value between 1 and 12. The function should return (-1) if an invalid month is input. The variable ‘is_leap’ is 1 for leap years, 0 otherwise.write a program in cWrite a C++ program to compute the surface-area of a cylinder, given the radius (R) and the height (H). The program must ask the user to enter R and H. It then prints the surface-area with a proper message in the main program. Define a function to compute the surface-area and let main() call it. Clearly show the function prototype. This function takes the radius R and height H as parameters and returns the surface area. The formula for computing the surface-area of a cylinder is 2πR(H + R), where ? = 3.141 Write a function called isValidLength that takes an integer number and returns true if the number has a valid length and false otherwise. Valid- length is determined by finding number length. If the length is at least 3 digits and at most 5 digits, then the number has a valid length. For example, the number 324 is valid because it's 3 digits long and the number 22 is invalid because it’s 2 digits long. Write a function called isValidDigits that takes an integer…Write a complete C program to calculate the perimeter and area of a triangle with 3 sides namely a, b, and c. The sides will be given as inputs by the user. The program will be executed at least once, and repeat as long as user wish to calculate again. There are a total of 5 functions: • Function 1: - This function will display the menu options that the user can choose (to calculate perimeter or area of a triangle). • Function 2: - This function will calculate the perimeter of a triangle - Accepts the sides of triangle as parameter - Formula: perimeter = a + b + c - Return the result back to the caller. • Function 3: - This function will calculate the area of a triangle - Accepts the sides of triangle as parameter - Formula: area = Vs (s — a)(s — b)(s — c), where s = (a + b + c)/2 - Return the result back to the caller. • Function 4: - This function will get the sides of triangle from user. - Ask user for option on what s/he would like to calculate. - Based on the option (Use switch…
- Employees in a company receives net salary after the deductions for tax, Staff Provident Fund (SPF), and Global Insurance (GI): Basic Salary Range ($) Tax Rate SPF GI 0 – 1999 0 % 11 % 1 % 2000 – 2999 5 % 12 % 2 % 3000 – 4999 8 % 13 % 5 % Above 5000 10 % 17 % 8 % Based on the table given, you are required to write a C programming for a system that accepts the employee’s basic salary, and generates the net salary after the respective deductions as described aboveWrite a program to model a simple calculator which should be able to do +,-,*,/,%. All these operations must be developed as separate functions. The program should ask the user to enter two operands and the operator. The function to be called should be selected on the basis of the operator selected. Once the result has been computed another function is called to print the result. The program should continue until the user entered ‘q’ in c++Engineers often measure the ratio of two power measurements in decibels, or dB, which can be calculated as follows:dB= log10P2/P1Where P2 is the power level being measured, and P1 is some reference power level. Write a c++ programe contain function that calculates the level. The function’s prototype is as follows:double dBCalculator (double P1, double P2);Then, call dBCalculator from the main function to find the power ratio for the measurements from 1 to 20 Watts, in 2 Watt steps. You can assume that the reference power P1 is 1 Watt.
- Write a C++ Program to calculate Perimeter of Isosceles Trapezoid andArea of Isosceles Trapezoida) Accept the inputs: h, b1 and b2 through main programb) Call the two function in the main programc) Write a function for calculating Perimeter of IsoscelesTrapezoidd) Write a function for calculating Area of Isosceles Trapezoide) Display the result of Perimeter of Isosceles Trapezoid byreturning the values to the main program.f) Display the result of Area of Isosceles Trapezoid by returningthe values to the main programHint:Perimeter= 2*h*b1+b2;Area = h*((b1+b2)/2);i am having problems making my program works. the following is what I have to do and underneath it is my program which I cant get it to work. i am not sure what my problem is. if you can figure it out that would be great thanks!! Write a C++ program that takes a date in the following format: December 24th, 2021 and extracts the day, month, and year as 3 integers. Your program should have and use at least the following functions: (a) Write a function getDate that prompts a user to enter a date as a string and returns it. (b) Write a function extract that takes as its parameter a date and returns the day, month, and year as 3 integers. (Hint: you can use the function isdigit(c) that returns true if c is a digit character and false otherwise.) (c) Write a function convertDigits that takes as its parameter a string of digits and converts it to an int. (Hint: to convert a digit character to a digit number use static cast (’d’) - static cast(’0’) where d is 0, 1, ..., 9) (d) Write a…Write a menu driven C program (not java or python) with the following choice of submenu items:Enter 1 to convert from Celsius to FahrenheitEnter 2 to convert from Fahrenheit to CelsiusSelect 1 or 2:Use a function Celsius which returns Celsius equivalent of a Fahrenheit temperature.C = (5/9)*(F-32)Use a function Fahrenheit which returns Fahrenheit equivalent of a Celsius temperature.F = (9/5)*C + 32Use the functions above to write a program which converts from Celsius to Fahrenheit or fromFahrenheit to Celsius and displays the result. Your program should repeat as long as the user enters 1 or 2 as the choice. Sample run 1: Enter 1 to convert from Celsius to FahrenheitEnter 2 to convert from Fahrenheit to CelsiusSelect 1 or 2: 1Enter temperature in Celsius: 55.00 Celsius = 41.00 FahrenheitEnter 1 to convert from Celsius to FahrenheitEnter 2 to convert from Fahrenheit to CelsiusSelect 1 or 2: 2Enter temperature in Fahrenheit: 3333.00 Fahrenheit = 0.56 CelsiusEnter 1 to convert from…
- Write a C++ program that calculates the Volume of a Triangular Prism. The main function asks the user to input a (i.e., length of the triangular prism), b(i.e., base length of the triangular prism), and h(i.e., the height of the triangular prism. Then the main function calls another function to calculate the volume of that triangle prism. Finally, the main function displays the volume of the triangle prism. Recall that Volume of a Triangular Prism =1/2 abhWrite a c++ program that contains a “main” and 4 functions: In the main function declare 4 integer variables x, y, z and m and call the following functions: The first function is to initialize the 4 variables using the last 4 digits of your university ID number. For example, if your ID number is 43956789 then you x=6, y=7, z=8, and m =9. The second function should calculate and print the average of the 4 variables. The third function is to find the largest number of the 3 variables. The last function should double the values of the 4 variables. For example if x = 6 then x will become 12.Implement in C Programming 7.6.1: LAB: Simple car Given two integers that represent the miles to drive forward and the miles to drive in reverse as user inputs, create a SimpleCar variable that performs the following operations: Drives input number of miles forward Drives input number of miles in reverse Honks the horn Reports car status SimpleCar.h contains the struct definition and related function declarations. SimpleCar.c contains related function definitions. Ex: If the input is: 100 4 the output is: beep beep Car has driven: 96 miles main.c #include <stdio.h> #include "SimpleCar.h" int main() { /* Type your code here. */ return 0;} SimpleCar.h #ifndef SIMPLE_CAR_H#define SIMPLE_CAR_H typedef struct SimpleCar_struct { int miles;} SimpleCar; SimpleCar InitCar();SimpleCar Drive(int dist, SimpleCar car);SimpleCar Reverse(int dist, SimpleCar car);int GetOdometer(SimpleCar car);void HonkHorn(SimpleCar car);void Report(SimpleCar car); #endif SimpleCar.c #include…