Concept explainers
The following
#include <iostream>
using namespace std;
// You must write definitions for the two functions qualify
// and noQualify.
int main()
{
double salary;
int years;
cout ≪ "This program will determine if you qualify\n";
cout ≪ "for our credit card.\n";
cout ≪ "What is your annual salary? ";
cin ≫ salary;
cout ≪ "How many years have you worked at your ";
cout ≪ "current job? ";
cin ≫ years;
if (salary >= 17000.0 && years >= 2)
qualify();
else
noQualify();
return 0;
}
Learn your wayIncludes step-by-step video
Chapter 6 Solutions
Starting Out with C++ from Control Structures to Objects (8th Edition)
Additional Engineering Textbook Solutions
C Programming Language
Starting out with Visual C# (4th Edition)
Programming in C
Concepts of Programming Languages (11th Edition)
Artificial Intelligence: A Modern Approach
Software Engineering (10th Edition)
- (Physics) Buoyancy is the upward force a liquid exerts on a submerged object, as shown in Figure 6.9. The buoyancy force is given by this formula: B=pgV Bisthebuoyancyforce( lbforN).isthefluiddensity( slug/f t 3 orkg/ m 3 ).gistheaccelerationcausedbygravity( 32.2ft/se c 2 or9.8m/ s 2 ).Vistheobjectsvolume( f t 3 or m 3 ). a. Using this formula, write a function named buoyantForce(double ro, double vol, int units) that accepts a fluid density, the volume of an object placed in the fluid, and the units to be used(1=U.S.Customaryunits,2=metricunits), and returns the buoyancy force exerted on the object. b. Include the function written for Exercise 6a in a working C++ program, and use your program to complete the following chart:arrow_forwardUse functional decomposition to write a C+ program that asks the user to enter his or her weight and the name of a planet. Use an enumerated type called planetType to represent the planets and use a switch statement that takes as its condition a planetType variable. The program, via the switch statement, then outputs how much the user would weigh on that planet. The following table gives the factor by which the weight must be multiplied for each planet. Your program must have the following functions in it: GetUserInput(), ConvertInputToPlanetType(), and OutputWeight() (your switch statement must be in OutputWeight(). I will let you determine what each function's parameters and return types should be. The program will output an error message if the user does not type a correct planet name. The prompt and the error message will make it clear to the user how a planet name must be entered. Use proper formatting and appropriate comments in your code. The output must be labeled clearly and…arrow_forwardWrite a complete C++ program that asks the user to input information for at least 10 students. Use structure for the information below: Name of the student, Matric No, Course No, Obtained Marks rogr The program should then display the information based upon marks in ascending and descending order. To solve ascending and descending order the program should have two functions that have an array of structure as a parameter and the functions should be called from the main function.arrow_forward
- Need as Important.arrow_forwardWrite a complete C++ program, to determine whether or not a person is eligible for MalaysianFamily Assistance. The program should be able to do the following tasks: Task 1: Write a "getInput" function.a) This is a function that does not return any values.b) It accepts as input parameters the identity card (IC) number, gross monthlyincome, eligibility status, and number of children.c) The function should prompt the user to enter their IC number, gross monthlyincome, and the number of children they have if they are eligible. A person iseligible for this assistance if their gross monthly income does not exceedRM5000.d) The function returns to the calling module all of the values entered by the user in(c), as well as the eligibility status using reference parameters. Task 2: Write a "deterAmountAssist" function. a) It accepts as input parameters the gross monthly income and the number ofchildren.b) The function should determine the amount of assistance received by those whoare eligible…arrow_forwardA Rent a car company is charging the customers as follows: you have to do the following tasks. a). Create a void function to display the name of the company "Saad Rent a Car". b). Create a function with parameters and return values. The parameters to be accepted are no. of days the car was rented and no. of Km the car was driven. The charge for renting the car for one day is 10 OMR additionally driving per km is 0.100 OMR. [Total rental charge = No. of days * 10 + 0.100 * No. of Kms] c). Create another function to calculate if the rental charge exceeds 30 OMR then an additional 0.100 per km will be charged for maintenance. d). Display all the output in the main program.arrow_forward
- Which statement of the following is the most appropriate? Group of answer choices One good method for specifying what a function is supposed to do is to provide a precondition and postcondition for the function. One good method for specifying what a function is supposed to do is to provide a precondition and postcondition for the function. These form a contract between the programmer who uses the function and the programmer who writes the function. Using the assert function to check preconditions can significantly reduce debugging time, and the assertion-checking can later be turned off if program speed is a consideration. One good method for specifying what a function is supposed to do is to provide a precondition and postcondition for the function. These form a contract between the programmer who uses the function and the programmer who writes the function. Using the assert function to check preconditions can significantly reduce debugging time, and the…arrow_forwardWrite a program for Fillowing cases beldi---7.arrow_forwardWAP in c programarrow_forward
- Directly downvote Answer correctly asap else Directly Downvotearrow_forward1. Noor wants to order food using Talabat and she wants to know how much she has to pay. Write a program to solve the above problem using functions without parameters. Your program must have a function to do the following. In function, Read three food item prices Calculate the total price which is an total of three prices. If total price is more than 5 Rials, Talabat will give 25% discount otherwise no discount. Display the price to pay after discount. Sample Output: In function: Enter Food Item 1 price: 4.5 Enter Food Item 2 price: 3 Enter Food Item 3 price: 0.900 Price to pay: 6.3arrow_forwardAnsvered: The results from x Blendeo Assessment Answered: Wrte a progran Aniveredi Write a progran my msu college Blended Assessment System (BEZ) Question 5 Write the complete C++ program for the following Case 2. ML marketing is a registered company that sells various house hold items. Their members will be given commission based on the sales they did for every months. The table for the commission is provided as follows: Sales Amount (RM) Rate (%) Amount 10000 12 The system reads the member's ID (int value), the month of the sales and sales amount. It then displays ALL the details during the input process together with the commission rate and the total commission the member gets. You are required to write a program for the above problem. Your program must use the following function prototypes (you need to determine the formal parameter (if any)): double RateCommission (); // to determine the rate based on the given sales amount and return the rate to main (). void Totalcommission ();…arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning