Question:Write a program that requests a weight number in pounds (lb). Write a function that converts the weight to grams (g) and ounces (oz).
Q: c++ Write a function that returns a float value. The function will check the users entry. It will…
A: The code is given below.
Q: Q3: Write a complete C++ program that contains the integer functions (main, funx and funy). The main…
A: Given: Write a complete C++ program that contains the integer functions (main, funx and funy).
Q: Q3: Write a complete C++ program that contains the integer functions (main, funx and funy). The main…
A: Input to the program : Input integer : k Output of the program : Output value from fun(k) which…
Q: In C++ Language (please use hint) : Write a function which will swap its arguments if the first…
A: Call by reference: In this approach, passing the arguments to a method copies the address or…
Q: Create a code in C++ to calculate the zero or root of a particular equation using the "bisection…
A: Bisection Method can be defined as the the technique of root finding method which applies to any…
Q: The return type void indicates that a function will perform a task but will not return any…
A: A function is a block of statements that can be reusable in a program whenever we want the same…
Q: Write a flowchart and C code for a program that does the following: Within main(), it asks for the…
A: logic used if else syntax:- if(condition) statement else statement
Q: Language: C++ Consider the abs function, which determines the absolute values of a real number. The…
A: #include<iostream> using namespace std; int abs(int a) { if (a<0) return…
Q: Write a C++ function named greater_10. This function returns an int and has two integer arguments,…
A: ⦁ In the function greater_10() two argument has been passed from main function where the user will…
Q: A particular talent competition has 5 judges, each of whom awards as score between 0 and 10 to each…
A: def getJudgeData(): var = -1 while 1: var = int(input()) if(var>=0 and…
Q: Write a program whose inputs are three integers, and whose outputs are the largest of the three…
A: A Corel is a simple high level programming language. It is also used for making flowchart. We type…
Q: gram in Fortran Programming language. Please write a function that will return the maximum number…
A: The answer is below:
Q: In C++, a function can be overloaded. Select one: O True O False What will be the output when the…
A: Find the required answer with explanation given as below :
Q: LAB: Miles to track laps. (PLEASE CODE IN PYTHON) Note: This is a zyBooks assignment is on functions…
A: use mathematics here. given 1 lap=0.25 miles therefore, 1 mile=1/0.25 laps read…
Q: Write exactly these 3 functions: power(x,y), print(text, number) function and the main() function.…
A: The given c++ program will return integer result that is calculated by raising a number x
Q: Write a program containing a function that will convert a given measure in kilometers to meters…
A: Declare a function accepting an integer value which is kilometers and then return the value…
Q: LeakageDeduction.py Write a python program that calculates the salary deduction of an employee who…
A: SOURCE CODE: n=int(input("Enter number of employees:")) #read number of employees l=[] price=0.180…
Q: Write a C++ program that converts Omani Riyals to United States Dollars. The main function asks the…
A: #include <iostream> using namespace std; //Function prototype double OMRtoUSD(double OMR); int…
Q: Code in C please. for this question you will write a function definition and a main function.…
A: In this C program , the main function makes a call to runmenu() function. runmenu() function will…
Q: PLease make this program work in C++ // This program has three functions: main, beep, and beeper…
A: Answer in step2
Q: Exercise #2: Write a C++ program that computes a ride you took in taxi. The bill computed based on…
A: Step 1 : Start Step 2 : In the main function , declare the variables to store the input distance ,…
Q: in c++ void check_palindrome() - to check whether the given number by user is palindrome or not.…
A: Program Approach - Use the header files as per requirement. Define the function named…
Q: C++ code 1 year = 15 months 1 month = 30 days write a function that takes an int parameter that…
A: C++ Code: #include <iostream> #include <stdlib.h> using namespace std; // required…
Q: Write a C++ program to calculate a rectangle's area. The program consists of the following function:…
A: C++ program to calculate a rectangle's area. The program consists of the following function: ⚫…
Q: 5. Conversion Language: Python 3 G Autocomplete Ready O 1 > #Assume there are 30 days in each month…
A: First, we will call the main function. Then in the main function, we will input the no. of days.…
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: Language: Python A particular talent competition has 5 judges, each of whom awards as score between…
A: please upvote for my efforts thanks! answer: code def getJudgeData(): res = int(input())…
Q: Write a program in c++ that asks the user to input two numbers. If the first number entered is…
A: CODE:- #include <iostream>using namespace std;void check(int n1, int n2);int main(){ int…
Q: Write a function that will display the reverse of the number.
A: In this question, we are asked to write a function reverse() which reverse a number Algorithm: 1)…
Q: (Guess the Number) Write a C program that plays the game of “guess the number" as fol- lows: Your…
A: Hey, since there are multiple questions posted, we will answer first question. If you want any…
Q: LeakageDeduction.py Write a python program that calculates the salary deduction of an employee who…
A: First we will calculate the leakage using the formula: Leakage = Quantity - (CR - PR) Then, we will…
Q: write a c++ program as following Create a class named Random Program and add a static function…
A: GIVEN : write a c++ program as following Create a class named Random Program and add a static…
Q: 5.32 (Guess the Number) Write a C program that plays the game of "guess the number" as fol- lows:…
A: EXPLANATION: - Integer variables for user guess and random number generation are defined. The char…
Q: ssume that there is no data-type float or double in the C implementation on your computer. You…
A: ALGORITHM:- 1. Use a character array to take input for the numbers. 2. Use strcmp to compare their…
Q: Write a declaration for a function called test( ) that takes 2 arguments and returns type char. The…
A: Function declaration header contains the below-given details: Name of function, Parameters used by…
Q: Define the function: int power (int base, int exp) {/*It accepts the arguments for base and exponent…
A: I give the code in C as per your requirement along with output and code screenshot
Q: Write a C program using void function to print your name and student ID. (void function does not…
A: In C or any other language like Cpp, void functions don't return anything. Here, the problem…
Q: A particular talent competition has five judges, each of whom awards a score between 0 and 10 to…
A: To find the average we can find the total sum and then decrease the maximum and minimum and we apply…
Q: Programming Language: Python 5. Write a Python function that will take a positive integer n from…
A: Start take number n call function prime_number return 1 if prime else return 0 stop
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 three functions, float getNum(), float add(float, float), void outSum(float); that asks user…
A: #include <iostream>using namespace std; float getNum() { float n; cout << "Enter a…
Q: Programming Language: Python 3. Write a Python function that will take a real number from the user…
A: 1) The absolute value or modulus of a real number x, denoted |x|, is the non-negative value of x…
Q: (C PROGRAMMING ONLY) 6. Deal or No Deal? by CodeChum Admin When I was a kid, I used to watch this…
A: I give the code in C along with output and code screenshot Note I have used my own set of values…
Q: 7. Write a C++ program that calculates and prints the bill for a car rental company. The company…
A: #include<iostream>using namespace std;int main(){ char type;…
Q: Write a program containing a function that will return the largest of 3 floating-point numbers.
A: Here I have created a function named largeOfNumber(). In this function, I have used a nested if-else…
Q: Programming Language: Python 5. Write a Python function that takes a positive integer n as an…
A: 1) Below is python program that defines function that takes a positive integer n as an argument and…
Q: Python Help Write a python function named zeroCheck that is given three integers, and returns true…
A: PROGRAM CODE: def zeroCheck(x, y, z): // start definition of function…
Q: Write a C program that reads the values of x (integer) and y (integer) and then calculates and…
A: Code: #include<stdio.h> int main() { int x,y,z; float res; printf("\nEnter the two…
Q: Write a c++ program to display a calendar for a given year. Type of Branches such as switch…
A: PROGRAM STRUCTURE: Include all the required header files. Write a function that gives out the index…
Q: 3) The factorial n! of a positive integer n is defined as n!=1*2*3... *n Where 0!=1.Write a function…
A: Question
C++ Coding: Functions
Question:Write a
Output:
Enter the weight of your item in pounds (lb) or enter zero to end the program: -1
Please enter a positive value. Try again.
Enter the weight of your item in pounds (lb) or enter zero to end the program: 32.32
32.32 lb = 14660.1054 g
32.32 lb = 517.12 oz
Enter the weight of your item in pounds (lb) or enter zero to end the program: 0
Exit program. Goodbye!
Step by step
Solved in 3 steps with 1 images
- 4. During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly. // Logic errors. #include #include using namespace std; int main() { double costs double area; double bagsize; cout > bagsize; cout > cost; cout > area; cout << endl; cout << "The cost of the fertilizer per pound is: $" << bagsize / cost << endl; cout << "The cost of fertilizing per square foot is: $" << area / cost << endl; return 0; }Using c++ Write a program that computes and displays the charges for a patient’s hospital stay. First, the program should ask if the patient was admitted as an inpatient or an outpatient. If the patient was an inpatient, the following data should be entered: The number of days spent in the hospital The daily rate Charges for hospital services (lab tests, etc.) Hospital medication charges If the patient was an outpatient, the following data should be entered: Charges for hospital services (lab tests, etc.) Hospital medication charges Use a single, separate function to validate that no input is less than zero. If it is, it should be reentered before being returned. Once the required data has been input and validated, the program should use two overloaded functions to calculate the total charges. One of the functions should accept arguments for the inpatient data, while the other function accepts arguments for outpatient data. Both functions should return the total chargesuse C++ programming language Write a program that computes and displays the charges for a patient’s hospital stay. First, the program should ask if the patient was admitted as an inpatient or an outpatient. If the patient was an inpatient, the following data should be entered: The number of days spent in the hospital The daily rate Charges for hospital services (lab tests, etc.) Hospital medication charges If the patient was an outpatient, the following data should be entered: Charges for hospital services (lab tests, etc.) Hospital medication charges Use a single, separate function to validate that no input is less than zero. If it is, it should be reentered before being returned. Once the required data has been input and validated, the program should use two overloaded functions to calculate the total charges. One of the functions should accept arguments for the inpatient data, while the other function accepts arguments for outpatient data. Both functions should return the…
- using c++ Write a program that computes and displays the charges for a patient's hospital stay. First, the program should ask if the patient was admitted as an in-patient or an out-patient. If the patient was an in-patient, the following data should be entered: The number of days spent in the hospital The daily rate Hospital medication charges Charges for hospital services (lab test, etc.) The program should ask for the following data if the patient was an out-patient: Charges for the hospital services (lab test, etc.) Hospital medication charges The program should use two functions to calculate the total charges. One of the functions should accept arguments for the in-patient data, while the other function accepts arguments for out-patient information. Both functions should return the total charges.Q9/Write a program that inputs a three-digit integer, separates the integer into its individual digits and prints the digits separated from one another by three spaces each by using functions. For example, if the user types in 429, the program should print: 4 2 9c++ Total Purchase A customer in a store is purchasing five items. The prices of the five items are: price of item 1 = $15.95 price of item 2 = $24.95 price of item 3 = $6.95 price of item 4 = $12.95 price of item 5 = $3.95 Write a program that holds the prices of the five items in five variables. Display each item’s price, the subtotal of the sale (total price of five items without tax), the amount of sales tax, the total. Assume the sales tax is 7%, define it as a named constant in your program.
- C++ CODE ONLY: Write a program that takes as input five numbers and outputs the mean (average) and standard deviation of the numbers. If the numbers are X₁, X2, X3, X4, and x5, then the mean is X = (X1 + X2 + X3 + x4 + x5 ) / 5 and the standard deviation is: (x₁−x)²+ (x₂-x)²+ (x¸¯x)²+(x¸−x)²+(x¸¯x)² S = 5 Your program must contain at least the following functions: 1. a function that calculates and returns the mean; and, 2. a function that calculates the print standard deviation. Input 1.5 integers Output Enter five numbers: 2 3 9 10 11 The mean is 7.00. The standard deviation is 3.742. Enter five numbers: 7 7 8 9 11 The mean is 8.40. The standard deviation is 1.497.Use C++ Programing language. Write a program that computes and displays the charges for a patient’s hospital stay. First, the program should ask if the patient was admitted as an inpatient or an outpatient. If the patient was an inpatient, the following data should be entered: The number of days spent in the hospital The daily rate Charges for hospital services (lab tests, etc.) Hospital medication charges If the patient was an outpatient, the following data should be entered: Charges for hospital services (lab tests, etc.) Hospital medication charges Use a single, separate function to validate that no input is less than zero. If it is, it should be reentered before being returned. Once the required data has been input and validated, the program should use two overloaded functions to calculate the total charges. One of the functions should accept arguments for the inpatient data, while the other function accepts arguments for outpatient data. Both functions should return the…C ++ Demonstration: Write a program that prompts the user to input three positive angle values in degrees to determine which type of triangle it is (acute, right, obtuse). TEST CASES: If a user inputs three valid angle values: Enter the first angle in degrees: 60 Enter the second angle in degrees: 30 Enter the third angle in degrees: 90 Result: You have a right triangle! If a user inputs any negative angle values: Enter the first angle in degrees: 45 Enter the second angle in degrees: 55 Enter the third angle in degrees: -80 Result: Error! Please input a positive angle value. If a user inputs values whose sum exceeds 180: Enter the first angle in degrees: 20 Enter the second angle in degrees: 70 Enter the third angle in degrees: 100 Result: Error! It is not a triangle.
- Language: Python Write a program that computes and displays the charges for a patient's hospital stay. First, the program should ask if the patient was admitted as an in-patient or an out-patient. If the patient was an in-patient the following data should be entered: - The number of days spent in the hospital - The daily rate -Charges for hospital services (lab tests, etc.) -Hospital medication charges If the patient was an out-patient the following data should be entered: -Charges for hospital services (lab tests, etx.) -Hospital medication charges Use a single, seperate function to validate that no input is less than zero. If it is, it should be re-entered before being returned. Once the required data has been input and validated, the program should use two seperate functions to calculate the total charges. One of the functions should accept arguments for the in-patient data, which the other function accepts arguments for out-patient data. Both functions should return the total…Write a C++ program to calculate a rectangle's area. The program consists of the following function: getLength - This function should ask the user to enter the rectangle's length. and then returns that value as a double • getWidth - This function should ask the user to enter the rectangle's width. and then returns that value as a double. • get Area - This function should accept the rectangle's length and width as arguments and return the rectangle's area. • displayData - This function should accept the rectangle's length, width and area as arguments, and display them in an appropriate message on the screen. main - This function consists of calls to the above functions.In C++ Programming, write a program that calculates and prints the monthly paycheck for an employee. The net pay is calculated after taking the following deductions: Federal Income Tax: 15% State Tax: 3.5% Social Security Tax: 5.75% Medicare/Medicaid Tax: 2.75% Pension Plan: 5% Health Insurance: $75.00 Your program should prompt the user to input the gross amount and the employee name. The output will be stored in a file. Format your output to have two decimal places. A sample output follows: Bill Robinson Gross Amount: .......................... $3575.00 Federal Tax: ................................ $ 536.25 State Tax: .....................................$ 125.13 Social Security Tax: ................... $ 205.56 Medicare/Medicaid Tax: ......... $ 98.31 Pension Plan: .............................. $ 178.75 Health Insurance: .......................$ 75.00 Net Pay: ....................................... $2356.00 NOTE: The first column is left-justified, and the right column is…