Concept explainers
Complete the following
// Define a named constant called CONVERSION, whose value is 1.467. double milesPerHour, feetPerSecond;
cout << "This program converts miles per hour to\n";
cout << "feet per second. \n";
cout << "Enter a speed in MPH: ";
cin >> milesPerHour;
// Insert a mathematical statement here to
// calculate feet per second and assign the result
// to the feetPerSecond variable.
cout << "That is"<< feetPerSecond <<" feet per second. \n";
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Starting Out with C++: Early Objects
Additional Engineering Textbook Solutions
C Programming Language
Starting Out With Visual Basic (7th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Web Development and Design Foundations with HTML5 (8th Edition)
- Switch Statement Problem 5. Electric Bill: Write a program that will calculate and show bills of the Manila Electric Company. The rates vary depending on whether the use is residential (R), commercial( C), or industrial (1). Any other code should be treated as an error. The program should accept the subscriber ID, Subscriber Name, his total electrical consumption in a month, and the code of the consumer type. The rates are computed as follows: R: 50 plus .50 per kwh used C: 100 for the first 1000 kwh and 0.45 for each additional kwh I: 180 for the first 1000 kwh and 0.75 for each additional kwharrow_forwardNeeds 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.arrow_forwardC++ program Vs Coding please!! General Crates, Inc. builds custom-designed wooden crates. With materials and labor, it costs GCI $0.23 per cubic foot to build a crate. In turn, they charge their customers $0.50 per cubic foot for the crate. You have been asked to write a program that calculates the volume (in cubic feet), cost, customer price, and profit of any crate GCI builds. Once calculated, display the volume, cost, customer price, and profit to the user. You will provide two tables as output for this program. The first table will echo length, width, and height, and will also show the volume. The values are to have three digits after the decimal, and be lined up by the decimal point in their table. The second table will show the money - our cost, our selling price, and our profit. These values are also aligned by the decimal point, and will have two digits after the decimal point (as is customary for currency). Submit your source code and a screen shot in which you run your…arrow_forward
- C++ program Vs Coding please!! General Crates, Inc. builds custom-designed wooden crates. With materials and labor, it costs GCI $0.23 per cubic foot to build a crate. In turn, they charge their customers $0.50 per cubic foot for the crate. You have been asked to write a program that calculates the volume (in cubic feet), cost, customer price, and profit of any crate GCI builds. Once calculated, display the volume, cost, customer price, and profit to the user.arrow_forwardIn the following code segment, y is a local variable of the function half(). void half(int& y) y /= 23; = 23; O True Falsearrow_forwardIn physics, an object that is in motion is said to have kinetic energy. The following formula can be used to determine a moving object's kinetic energy: KE = ½ m v2 The variables in the formula are as follows: KE is the kinetic energy, m is the object's mass in kilograms, and v is the object's velocity, in meters per second. Write a function named kineticEnergy that accepts an object's mass (in kilograms) and velocity (in meters per second) as arguments. The function should return the amount of kinetic energy that the object has. Demonstrate the function by calling it in a program that asks the user to enter values for mass and velocity.arrow_forward
- Complete the following program When a machine reads blood pressure from a human body it displays two numbers they are called Systolic and Diastolic pressures. The program will take systolic and diastolic reading as input from the user and displays a message whether the person's blood pressure is "Normal" or "Elevated" or "High Blood Pressure". Program consists of two functions as follows. vold input .: This function is with two pass by reference parameters, and it reads input from the user. string process( .): It receives two numbers(systolic and diastolic) and then it determines and returns a category according to the table below. Diastolic and 60 to 80 and 80 to 90 Category Systolic Normal 80 to 120 Elevated 120 to 139 High blood equal and pressure above 140 above 90 orarrow_forwardThe Problem__: Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: ⚫ void getScore() should ask the user for a test score, store it in a reference param- eter variable, and validate it. This function should be called by main once for each of the five scores to be entered. ⚫ void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores. ⚫int findLowest() should find and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop. Input Validation: Do not accept test scores lower than 0 or higher than 100. YOU MUST USE THE STATED FUNCTIONS AND COMPLETE Input VALIDATION. **DO NOT use an ARRAY OR GLOBAL VARIABLES!!. you MUST USE function prototyping TEST THE FUNCTION TWICE.…arrow_forwardFuture Investment Value = investment amount * (1 + monthly interest)^(number of years * 12) Using this formula, write a function in Python called futureValue that prompts the user to enter an investment amount, an annual percentage interest rate, and the amount of years. The function should accept the input as arguments. The interest rate should have a default value of 7%. You can add default values of your choice for the amount of years. This function should print out a table that displays the future values. Demonstrate this function in another function called main. Format your output by two decimal places. Output Example: Enter the amount you want to invest: 1000 [Enter] Enter the interest rate for your investment: [Enter] Enter the number of years you want to invest this money: 30 [Enter] Years Future Value 1 1093.81 2 1196.41 ........ 30 14730.58arrow_forward
- C# Programarrow_forwardWrite a main function that performs the following: • Prompts user to enter 2 integer values A and B. • if the first number A is greater than to B+5, the main function prints out the result of 6 multiplied with the every odd number from 1 to B... • If the first number A is less than or equal to B+5, the main function prompts the user A times to enter grades in a variable called grade and print their summation. • If not, it prints out "No output to be given".arrow_forwardQuestionarrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning