Write a c++ code to print out these requirements, and put a comment and brief description of the code. ask the user for the tank's capacity in gallons. ( he/she answer) : 27 ask the user for miles_per_gallon • (he/she answers) : 25.9 ask the user to enter the gas price per gallon. (he/she answer) : 4.56 Cost = 100 / miles_per_gallon * gas_price• (he/she answer) : 6.78 Distance = capacity * miles_per_gallon• (he/she answer) : 654.87 miles Print cost and efficiency
Q: write test programs in c++ ,java,and c# to determine the scope of a variable declared in a for…
A: PROGRAM CODE: #include<iostream> using namespace std; int main() { int i; int x; for(i=0;…
Q: 2. Write a C+ program to calculate the net salary for an employee of a company that manufactures…
A: Here is the approach : Create the function for three cases one for the fixed salary , contract…
Q: write a program in c++. You work for a box company, and have been asked to write a program to…
A: PROGRAM INSTRUCTIONS: The C++ program has the following algorithm: Declare and initialize the…
Q: Write a program in C++ to calculate and print the Electricity bill of a given customer. The customer…
A: Please find the answer below :
Q: For the program below, assume that a point on a Cartesian plane comprises values representing x and…
A: Declare a class to represent the coordinates of point and we have instance variables to represent…
Q: In C++, please write a program according to the instructions and all the criteria. Thank you.…
A: Solution:-- 1)As given in the question is to provide the code for required specifications in…
Q: Write a C++ program that calculates the Perimeter of a circle. The main function asks the user to…
A: C++ code: #include <iostream>#define PI 3.14159 // take value of PI as constantusing namespace…
Q: PROBLEM: Write a C++ program that will allow the user to input the First Name, Last name, Middle…
A: #include <iostream>using namespace std; int main(){ string FirstName, LastName,…
Q: Write a program (in C++) which acts as a four-function calculator (addition, subtraction,…
A: #include <iostream>using namespace std; int main(){ int ch; float n1, n2, res;…
Q: In C programming language, if the first and the second operands of operator + are of types int and…
A: Question Given:- In C programming language, if the first and the second operands of operator + are…
Q: Write a C++ program that calculates and displays the avarage mark in (%) of 3 subjects e,g…
A: Provided below is the C++ program that calculates and displays the average mark in (%) of 3…
Q: A temperature reading in degrees Fahrenheit can be converted to degrees Celsius using Write a…
A: #include <stdio.h>float convertCelFahrenheit(float f){ return ((f-32)*5)/9;}int main(){…
Q: write a C++ program. Write a program that calculates and displays the average of a group of test…
A: Solution: Given: • void get score should ask the user for a test score, store it in a…
Q: Project 3: You have to create a program in C language in which the user enters the mass M an radius…
A: I give the code in C along with the output screenshot and code screenshot.
Q: In C++, if the statement ( int a-5, b=2: ) is written at the beginning of the program, then the…
A: I HAVE PROVIDED THE ANSWERS FOR ALL 10 QUESTION 1.ElectricalEng2.4.53.char h='all';4.unsigned5.5…
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: in C++, the definition of any variable (e.g. int x;) tells the compiler about ________. all of…
A: int x; Here int x means data type is integer and variable name is x. If it is int x=5; This means…
Q: Write a C++ program that: Define a void function named Max() with two parameters. The function…
A: C++ Code to find the larger one from two double numbers is as given below.
Q: write a program in c++. You work for a box company, and have been asked to write a program to…
A: Below is the required C++ program. Program Approach: Include necessary header files and using the…
Q: 2). Jane Walker, the manager of a construction company in a commercial city has his team working on…
A: Take a variable to store the number of days. Take a variable to store the size of the team. Take a…
Q: 1. Use a functional decomposition to write a C++ program that asks the user to enter his or her…
A: Below i have given program:
Q: Create a function, declare and define a static variable in it! Increase the value of the variable…
A: Given Question: Make a function, define a static variable in it, then declare it! Increase the…
Q: Write a C Program SOLVE THE EQUATION using user- defined functions and if-else statement. Choice…
A: - We need to highlight the c code for the operation needed.
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: Using C++ Language Now, you will modify the above program to group the four parameters (i.e., name,…
A: - We have to show the use of struct in the code.
Q: PROBLEM: Write a C++ program that will allow the user to input the First Name, Last name, Middle…
A: 1)Read the input from the user first name, last name, middle initial and Grade 2)Display the first…
Q: Write a program in C++ to calculate and print the Electricity bill of a given customer. The customer…
A: The below given C++ program will obey the following rubrics: Including necessary header files. In…
Q: What is a function? Give the Importance of functions in c-programming, types of functions in c.…
A: A function is a group of statements that are written within one block and can be executed multiple…
Q: Please help, this question was rejected for complexity but I really don't have any one else to ask!…
A: SUMMARY: -Hence, we got the result.
Q: In C++, write declarations to declare each variable to have the specified type and initial value:…
A: The declarations and initializations of the given variables are done as follows:…
Q: / write a program in C ++ using the syntax (registry), in which the user enters the names, ages and…
A: A program in C ++ using the in which the user enters the names, ages, and numbers of a number of…
Q: 7. Write a C++ program that calculates and prints the bill for a car rental company. The company…
A: Code: #include <iostream> using namespace std; int main() { // Declaring arrays with…
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: To use a predefined function in your C++ program, you have to include its prototype? True or false
A: Question. To use a predefined function in your C++ program, you have to include its prototype? True…
Q: Pass the marks of 3 tests (Test1, Test2 and Test3) to the function with header high (float, float,…
A: EXPLANATION - Declare three variable named with Test1 , Test2, Test3 of type float . Take marks as…
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: Write a program in C++ to print the college name, location and area code (Higher College of…
A: A required C++ program to print the college name, location, and area code using symbolic constants…
Q: You are required to write a complete C++ program for a simple grading system. You need to input…
A: Use a do-while loop to check whether to continue inside loop or not
Q: Illustrate your knowledge of C-Programming by implementing following programs : (a). Write a…
A: C program to use the function to determine whether the user-entered number is a prime number or not.…
Q: Write a program in C++ to calculate and print the Electricity bill of a given customer. The customer…
A: to do: Write a program in C++ to calculate and print the Electricity bill of a given customer.…
Q: Q2: An electricity board charges the following rates to domestic users:- Units consumed Tariff Rs. 5…
A:
Q: Write a program in C++ that asks the user to enter two numbers and prints the sum, product and…
A: C++ code: #include<iostream>using namespace std; // function declarationdouble…
Q: Write the code of C++ which is used to take factorial of any number. you may pass the value to…
A: PROGRAM CODE: #include<iostream> // include header file for input output…
Q: Design a C++ program to do the administration for a fun run competition. Participants can run a…
A: Registration fees for club members are as follows:5km = R 65.0010km = R 100.0015km = R 150.00…
Q: An electricity board charges the following rates to domestic users:- Units consumed Tariff For the…
A:
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: write a C++ program. Write a program that calculates and displays the average of a group of test…
A: Given data is shown below: write a C++ program. Write a program that calculates and displays the…
Q: 2). Jane Walker, the manager of a construction company in a commercial city has his team working on…
A: //include the required header file #include <iostream> using namespace std; //definition of…
// The language is c++
Write a c++ code to print out these requirements, and put a comment and brief description of the code.
ask the user for the tank's capacity in gallons. ( he/she answer) : 27
ask the user for miles_per_gallon • (he/she answers) : 25.9
ask the user to enter the gas price per gallon. (he/she answer) : 4.56
Cost = 100 / miles_per_gallon * gas_price• (he/she answer) : 6.78
Distance = capacity * miles_per_gallon• (he/she answer) : 654.87 miles
Print cost and efficiency
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
double capacity, miles_per_gallon, gas_price, cost, Distance; //declaring variables
cout << "Please Enter the tank's capacity in gallons: ";
cin >> capacity; //storing value
cout << "Miles travelled per gallon: ";
cin >> miles_per_gallon;
cout << "Gas Price: ";
cin >> gas_price;
cost = 100 / miles_per_gallon * gas_price; //Calculating Total Cost
Distance = capacity * miles_per_gallon; //Calculating efficiency
cout << "Total cost: " << cost;
cout << "\nEfficiency: " << Distance <<" miles" <<endl;
return 0;
}
Step by step
Solved in 2 steps with 1 images
- Needs to be done in C# language. Problem 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 tests, etc.) The program should ask for the following data if the patient was an out-patient: • Charges for hospital services (lab tests, etc.)• Hospital medication charges The program should use two overloaded 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. Input Validation: Do not accept negative numbers for any data.write a program c++ A General: Service company hired you to write a program to compute the total charge for the services rendered to their client. The program will ask first if there is a material needed or not. If there is, the program will ask if what material is needed. The program will then ask for the cost of that materials entered and the number of hours of the services rendered. Finally, the program will compute for the labour cost and the total charge. Assumption: Rate Computation: Labour : Total Charge Materials: 1.) Electricals 2.) Electronics 3.) Construction 4.) Sanitary $45.00 per hour Rate * hours work : Labour + Cost of MaterialsWrite a C++ program that helps calculate how long it would take a user to pay off a loan with compound interest. You should prompt the user for the principle amount, how much interest is being charged, and how much they are able to pay back each month. You should assume that all amounts are in dollars and cents, that interest is charged monthly, and that payments are also made monthly. The program should display a table with the following columns: the month number, the amount remaining on the loan, and the total amount already paid. For *each* row, you should: 1. *FIRST* subtract the payment from the amount remaining on the loan.2. *THEN* add interest based on this new total amount. You should continue to print out rows in the table until either the amount remaining is <= $0 or if 100 months have passed. Then, print out a summary showing the number of months that will elapse and how much total has been paid. If the table stops at 100 months, print out a message telling the user that…
- 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,…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…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: Federal Tax: State Tax: Pension Plan: . Health Insurance: $3575.00 Social Security Tax: Medicare/Medicaid Tax:.........$ 98.31 Net Pay:...... $ 536.25 $ 125.13 $ 205.56 $ 178.75 $ 75.00 $2356.00
- Question: USING C# Write a program to calculate electricity charges for a customer. The program requests a name, previous meter reading and current meter reading. The difference in the two readings gives the number of units of electricity used. The customer pays a fixed charge of $25. In addition to the fixed charge, 20 cents is charged for each unit used. Print all the data, the number of units used and the amount the customer must pay, appropriately labelled. Additional information: You may assume that the current meter reading is larger than or equat to the previous meter reading. You may assume all data entered into your program is correctUsing 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 chargesPlease do in C++ coding please Nrite a program to fulfill the following requirements: You need a program to help you plan a garden. The user will enter - The square footage of their garden plot - Their needs for each of several types of plants (you won't know ahead of time how many types). For each plant they will specify the length of the rows, their width, and the number of rows. After each plant is entered, the program is to calculate the square footage used for that plant and display the remaining square footage left in the garden. The program should then ask them if they want to plant something else. If the user tries to enter too much for a plant compared to what is left, the program should tell them of their error and tell them the square footage that will actually be used for that plant. The user is not required to fill their garden space. When the user is done entering plants, the program should display the total square footage used, the number of plant types and the amount of…
- Ineed help programming this C++ program: Write a C++ console application that calculates and displays the charges for using a parking garage. The parking garage charges a $3.00 minimum fee to park for up to three hours. The garage charges an additional $0.85 per hour or fraction of an hour in excess of three hours. The maximum charge for any given 24-hour period is $20.00. You may assume that no car parks for longer than 24 hours at a time. Your program will use a function named calculateCharges to determine the charges based on the amount of time the car was parked. Your program will prompt the user for the number of hours parked in the garage. It will then display the parking charges for that transaction. Keep track of the number of transactions as well as accumulating the number of hours parked and the parking charges. Your program will execute repeatedly until the user enters a value for the number of hours parked that is less than or equal to zero. Your program will then display…Programing in c This program will calculate how pricy two products will be in 2030. It will begin by asking the user for the current price of the products. Then, it will print these values out, so the user knows the values were saved correctly. Next, it will ask the user for the inflation rate. After this, the program should multiply the current prices by the inflation rate. When done, it should print out the estimated-inflated values. For this task, you will need to define a structure with two members. These two members will be the products whose inflated price will be calculated. In the example I chose salt and soap. You will also need a local variable in main that holds the value of the inflated rate. Lastly, this process should be ran twice, each time for a different country. Therefore, you will need to declare two variables of the same structure type. One declaration for country1 and one for country2. The example is running estimated values for Mexico and Canada. You may implement…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.