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 (10th Edition)
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_forwardFox International sells pre-paid calling card with the following features: Calls to USo 1.2 cents per minute plus a 49 cent connection fee per call Calls to Europeo 2.3 cents per minute plus a 49 cent connection fee per call Calls to Australiao 6.4 cents per minutes plus a 49 cent connection fee per callWrite a program that work out the charges for the month. The program should accept the followinginformation: Account holders name Card number Starting Balance on card For US callso Total number of minutes of all callso Total number of calls made For European callso Total number of minutes of all callso Total number of calls made For Australian callso Total number of minutes of all callso Total number of calls madeYou are NOT expected to error check your inputs for this assignment. (e.g. checking for negative values,etc.). There is NO GST charged on the calls as the GST was paid when the card was purchased.Format of output:Review the test plan to see how the user would like the…arrow_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_forward
- Question: A country charges income tax as follows based on one's gross salary. No tax is charged on the first 20% of salary. The remaining 80% is called taxable income. Tax is paid as follows: 10% on the first $15,000 of taxable income; 20% on the next $20,000 of taxable income; 25% on all taxable income in excess of $35,000; Write a program to read a value for a person's salary and print the amount of tax to be paid in dollars. . ● . Additionalind.arrow_forwardusing 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.arrow_forwardcode for this in C: In college, a student may get a grade of 1.0 (as the highest) to 5.0(lowest). Anyone who gets a Final Grade of at most 3.0 is considered a passing grade. Create a program that will ask the user to input a student's midterm grade and tentative final grade. After calculating the student's final grade using the formula below, main() will then call on DisplayStatus() to display if the student passed the subject or not. FG= MG+TFG/2arrow_forward
- Body Mass Index (BMI) is a measure of health on weight. It can be calculated by taking your weight in kilograms and dividing by the square of your height in meters. Write a program which prompts the user to enter the weight in kgs (integer value) and height in feet and inches (both integers) and then calculates the BMI of the person. Your program first need to convert inches to meters (i.e. inches * 0.0254) and then use the following formula to calculate BMI: weight kilogram / (height_meter)^2 Your program displays the BMI value in two decimal places and the corresponding status as shown in the examples below. Note that one inch is 0.0254 meters and 1 foot is 12 inches. For example: Input Result 62 5 10 89 6 0 45 BMI BMI < 18.5 18.5 s BMI < 25.0 25.0 ≤ BMI < 30.0 30.0 ≤ BMI 7 82 5 Interpretation Underweight Normal Overweight Obese 2 Enter weight (kg): Enter height (feet): Enter height (inches): BMI is 19.61, Normal Enter weight (kg): Enter height (feet): Enter height (inches): BMI is…arrow_forwardMobile Service Provider Write a flowgorithm program that will calculate a person’s mobile phone bill based on plan chosen and the data used. The program should perform the following: Ask for customer’s mobile plan Ask for the number of gigabytes of data used Display an error message if the plan choice is invalid or the gigabytes used is less than zero (0) Mobile data plans are: Plan A 19.99/month, with 4 gigabytes data, additional data $10/gigabyte Plan B 29.99/month, with 8 gigabytes data, additional data $5/gigabyte Plan C 39.99/month, unlimited data Remember the following: use clear prompts for your input label each output number or name use comment box for your name, lab name and date at the top of the flowgorithm use other comments where appropriate use appropriate constantsarrow_forwardUsing c program Use Malaysian ringgitarrow_forward
- In C programming languagearrow_forwardi need the answer quicklyarrow_forward(Civil eng.) Write an assignment statement to calculate the linear expansion in a steel beam as a function of temperature increase. The formula for linear expansion, l, is as follows: l=l0(1+(TfT0)) l0isthelengthofthebeamattemperatureT0.isthecoefficientoflinearexpansion.Tfisthefinaltemperatureofthebeam.arrow_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
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning