Given the following code and program output: int main() { int x=11, y=6; cout << x << "" <
Q: HI, I am having a bit of a problem with my intro to c++ homework and just need some explanation…
A: Required: Code a function definition for a function named shiftDiagonal which does the following:…
Q: (Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: (a) Given three positive numbers x, y and z, we can determine if these are the lengths of a triangle…
A: Note :- As per our guidelines we are supposed to answer only one question. Kindly next time repost…
Q: Assume on a planet called “Chocolatey”, 1 month = 20 days and 1 year = 240 days = 12 months. Write a…
A: I have created a function named days(). Inside the function, I have taken 2 arrays and used the…
Q: (Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: A bullet train slows from a speed of 200 mi/hr to 150 mi/hr in one minute. Write a computer program…
A: The answer is
Q: Given the following code and program output: int main() { double account = 53000; cout <<…
A: Code
Q: Please help me with my homework and needs to be submitted by today. Thank you very much, if you have…
A: Please help me with my homework and needs to be submitted by today. Thank you very much, if you have…
Q: Write a program that requests a weight number l function that converts the weight to pounds (lb) and…
A: GIVEN: Create a C++ program that converts weight from ounces to pounds and grams.
Q: Problem #1: Write a program that reads from the user the name of a student, the grades of two…
A: Simple output, Your name: Ali your midters 1 grade: 70 your midterm 2 grade: 65 your final year…
Q: Write a function that determines whether an exam score is valid. The function should return True if…
A: def is_valid_score(score): if (0<score<100): returnTrue else: returnFalse def scorecheck():…
Q: The least common multiple (lcm) of two positive integers u and v is the smallest positive integer…
A: Code: #include <stdio.h>//function returns the GCDint gcd (int u, int v){ int x; while ( v…
Q: Problem 1 Implement a function that checks if a number is within a given range. It should accept the…
A: The programs have been written in Java programming language for it is easy to read, it can be…
Q: In the following function the statement cout in line 16 v cause an error when the function is…
A: Error will come due to the only, r and t because r and t is declared inside the if and else…
Q: Suppose you are asked to convert temperature from Celsius to Fahrenheit, and Fahrenheit to Celsius.…
A: Note: we are only allowed to solve one question in one post. I am solving the first on here. To get…
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 function that takes one argument, an integer, and returns the value of the following…
A: For First Part- Code is- #include <iostream>#include<cmath>using namespace std; int…
Q: Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for…
A: #include<stdio.h> float round_money(float x) //function to round real number to 2 decimal…
Q: In Python, write a program that contains main and another custom function that generates a specified…
A: Given: In Python, write a program that contains main and another custom function that generates a…
Q: Q2/Write a program that reads from the user the value of x and apply the function below: * x+4 x-3+…
A: Code in c++ as you have not mentioned the coding language providing the code in c++: #include…
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: Given t
A: Since the programming language is not mentioned, I have done the coding using C.
Q: Complete the function definition to return the hours given minutes. Output for sample program:…
A: According to the below the Solution: Output:
Q: Problem 4: Write a function called startsWith. The function has two integer parameters that are both…
A: Please find the answer below :
Q: Write a non-void function named myletter that accepts two integers, x and y as parameters, and…
A: logic define a function myletter which takes two int parameter x and y. Inside function, check…
Q: Define a function named swap_values that takes four integers as parameters and swaps the first with…
A: The problem is based on the basics of functions in python programming language.
Q: Study the definition of function "Secret" and answer the question below. double Secret (double x,…
A:
Q: Write a function that displays all the numbers between two integers in n lines, that are divisible…
A: Program: A program is used to interact with computer systems and solve complex problems. The main…
Q: 1. Write a parameter and return program that will require the user to enter a temperature in Celsius…
A:
Q: Which correctly defines two integer parameters x and y for a function definition: void CalcVal(...)?…
A: Hello student. Greetings from my side. Hope you are doing great. I will try my best to answer your…
Q: Given the following code and program output: int main() { int x=11, y=6; cout << x << " "…
A:
Q: (Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for…
A: The complete code is given below .
Q: Write a function called pizza_cost that returns the cost per square inch of a circular pizza given…
A: Please find the answer below :
Q: A)Write a function that accepts a number(long) and return a boolean value, it will return true if…
A: Given: A set of rules to validate a number, The length of the number should range between 3 to 5.The…
Q: Write a parameter and return program that will require the user to enter a temperature in Celsius…
A: Since you have asked multiple questions, we will solve the first question for you. If you want any…
Q: (Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for…
A: #include <stdio.h>#include <string.h>#include <stdlib.h>#include…
Q: Define a function named swap_values that takes four integers as parameters and swaps the first with…
A:
Q: Objective: A program should be developed to read the value of x. It computes the value of f(x)…
A: Read a float type value x from the user. Using if/else statement checks whether the given input…
Q: a) You are asked to write a code for ATM machine. i) Write the function definition for the following…
A: i) void checkBalance(int *p){ CURRENTBALANCE -=*p; printf("Current Balance Available:…
Q: Write a function averageDigits that computes the average of the digits of a 3-digit positive number…
A: Here is the c++ program. see below steps.
Q: A Simple Function Write a function called tri_area that returns the area of a triangle with base b…
A: Please find the answer below :
Q: only python Your program should ask the user to input a number of family members. The program should…
A: Solution: Code: def ask_for_age(): age = int(input('Enter the age of a family member: '))…
Q: The least common multiple (lcm) of two positive integers u and v is the smallest positive integer…
A: Program: #include <stdio.h> int gcd (int u, int v){int temp;while (v != 0){temp = u % v;u =…
Q: Create a functional program that can calculate the displacement and velocity of a free-falling body…
A: Program code: #include <iostream> #include <cmath> using namespace std; //define a…
Q: Write a function that receives 5 integers and returns the sum, average and standard deviation of…
A: EXPLANATION - Take 5 number from user as input . Pass number as parameter in func and call func . In…
Q: Usin C++, write the definition of a function that takes as input the three numbers. The function…
A: A C++ program is as follows, File name: “main.cpp” //Header files #include <iostream>…
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: c++ prob. please paste indented code Given the following code and program output: int main() {…
A: #include <iostream> using namespace std; voiddecrement (int &val, int offset){ val = val…
Q: Question 4 The correct prototype for the following function heading is void F1(int x], int yO[10]),…
A: Given: A function is given which takes some arguments. Goal: We have to check whether the given…
I need help
Step by step
Solved in 2 steps with 2 images
- A sphere is characterized by a single dimensions; its radius (r). The surface area of the sphere is calculated as A=4πr2 While the volume is calculated as V=43πr3 Write a program that asks the user for r and when VALID proceeds to calculate both the surface area and the volume of the sphere by calling a single function. The function's prototype is as follows: void sphereCalc(float, float *, float *); All console input and output operations are in main(). Print the area and volyme with 3 decimal places. Follow best programming practices. Use r = 3 for the screenshot. Hint: Define PI using #define PI 3.1415927Driving 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,…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. python # Define your function here. if __name__ == '__main__': # Type your code here.
- 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. python use this in answer please # Define your function here. if __name__ == '__main__': # Type your code here.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) # Define your function here. if __name__ == '__main__': # Type your code here.4.20 LAB: Warm up: Automobile service cost (1) Prompt the user for an automobile service. Output the user's input. (1 pt)Ex: Enter desired auto service: Oil change You entered: Oil change (2) Output the price of the requested service. (4 pts)Ex: Enter desired auto service: Oil change You entered: Oil change Cost of oil change: $35 The program should support the following services (all integers): Oil change -- $35 Tire rotation -- $19 Car wash -- $7 If the user enters a service that is not listed above, then output the following error message: Error: Requested service is not recognized 344614.2153518.qx3zqy7 Use Python for this please.
- User Defined Function: Return Value Create a JAVA program compute the area of the following polygons and circle. Area of square given the side. Area of rectangle given the length and width. Area of triangle given the base and height. Area of circle given the radius. EXPECTED OUTPUT:An emirp (prime spelled backward) is a nonpalindromic prime number whose reversal is also a prime. For example, both 17 and 71 are prime numbers, so 17 and 71 are emirps. Write a program that displays the first 100 emirps. Display 10 numbers per line, as follows: please complete this problem by defining three functions: (1) def reverse(number) example: input: 13 output:31 (2) def isPrime(number) example: input: 13 output:True; input: 14 output:False (3) def main() define a main function to display 100 numbers which is emirp, 10 numbers per line(1) Prompt the user for an automobile service. Output the user's input. (1 pt)Ex: Enter desired auto service: Oil change You entered: Oil change (2) Output the price of the requested service. (4 pts)Ex: Enter desired auto service: Oil change You entered: Oil change Cost of oil change: $35 The program should support the following services (all integers): Oil change -- $35 Tire rotation -- $19 Car wash -- $7 If the user enters a service that is not listed above, then output the following error message: Error: Requested service is not recognized Python
- (1) Prompt the user for an automobile service. Output the user's input. (1 pt)Ex: Enter desired auto service: Oil change You entered: Oil change (2) Output the price of the requested service. (4 pts)Ex: Enter desired auto service: Oil change You entered: Oil change Cost of oil change: $35 The program should support the following services (all integers): Oil change -- $35 Tire rotation -- $19 Car wash -- $7 If the user enters a service that is not listed above, then output the following error message: Error: Requested service is not recognizedEvaluate these expressions, expressions should be in code C 1 + 2 / 5 1.0 + 2 / 5(up to 1 decimal digit) 1 + 2.0 / 5 1 + (float) 2 / 5 (float) 1 + 2 / 5(up to 1 decimal digit) int xa[5] = {1,2,3,4,5};Evaluate xa[3] float x = 2.3; x+=5.0; Evaluate x If a=2 and b=-3 , evaluate: (a<b) ? a : b 2 == 3An Auto Insurance Program Example - Write a program to determine the cost of an automobile insurance premium, based on driver's age and the number of accidents that the driver has had. The basic insurance charge is 500 Rs. There is a surcharge of 100 Rs if the driver is under 25 and there is an additional surcharge for accidents as can be seen below: No. of accidents Accident Surcharge 1 50 2 125 3 250 4 375 5 575 6 or more No insurance