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 (9th 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_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_forwardin C++ program please: According to Wikipedia: “The International Collegiate Programming Contest, known as the ICPC, is an annual multi-tiered competitive programming competition among the universities of the world.” Moreover, the participants of the contest should be no older than 24. Complete the following function which takes as input two parameters: the current year and the birth year of a student. The function should return the age of the person given the parameters. int calculateAge(int current_year, int birth_year) {arrow_forward
- Use 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, 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_forwardin C++ program please: part a) According to Wikipedia: “The International Collegiate Programming Contest, known as the ICPC, is an annual multi-tiered competitive programming competition among the universities of the world.” Moreover, the participants of the contest should be no older than 24. Complete the following function which takes as input two parameters: the current year and the birth year of a student. The function should return the age of the person given the parameters. int calculateAge(int current_year, int birth_year) { part b) The teacher wants to determine if a group of students is eligible for this competition. Complete the following piece of code considering that the age of these students are stored in the studentsAge array and use the calculateAge function to determine the eligibility. Note: solution should use calculateAge ! int main() { int studentsAge[10]; #your answer for (int i = 0; i < 10; i++) { cin >> studentsAge[i]; # your answer Your program…arrow_forwardin C++ program please: part a) According to Wikipedia: “The International Collegiate Programming Contest, known as the ICPC, is an annual multi-tiered competitive programming competition among the universities of the world.” Moreover, the participants of the contest should be no older than 24. Complete the following function which takes as input two parameters: the current year and the birth year of a student. The function should return the age of the person given the parameters. int calculateAge(int current_year, int birth_year) { part b) The teacher wants to determine if a group of students is eligible for this competition. Complete the following piece of code considering that the age of these students are stored in the studentsAge array and use the calculateAge function to determine the eligibility. Note: solution should use calculateAge ! int main() { int studentsAge[10]; #your answer for (int i = 0; i < 10; i++) { cin >> studentsAge[i]; # your answer Your program…arrow_forward
- The "problem 1 " and its function just the supplement to the "problem 3", you only need to solve the "problem 3".The title of "question 3" requires modification of the previous function ( "first function" in problem 1)arrow_forwardComplete the function blood_donor, which determines whether a person is able to donate blood. A person is eligible to donate blood if his/her age is 18 or over and his/her mass ("weight") is greater than 48 kilograms. The function takes four arguments: • age, which gives the prospective donor's age mass, which gives the prospective donor's mass in kilograms requested_blood_type, which gives the requested blood type • donor_blood_type, which gives the prospective donor's blood type The function returns one of several strings, depending on the inputs. If the donor's eligibility is satisfied and his/her blood type matches the requested blood type, return 'match' . Otherwise, check for ineligibility in the following order and return the first reason for ineligibility, if any: 'too young, too light' (both the age and the mass are too low) 'too young' (age is too low) 'too light' (mass is too low) 'mismatch' (requested_blood_type and donor_blood_type don't match) Examples: Function Call…arrow_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