Answered step by step
Verified Expert Solution
Question
1 Approved Answer
can you please this coding / #include using namespace std; / / Global Constants const double HIGH _ SCHOOL _ DISCOUNT = 0 . 2
can you please this coding #include
using namespace std;
Global Constants
const double HIGHSCHOOLDISCOUNT ;
const double SIXORMOREMONTHSMEMBERSHIPDISCOUNT ;
const double FIVEORMOREINDIVIDUALLESSONSDISCOUNT ;
Function Prototypes
void displayinformation;
void getinformationdouble& costpermonth, double& costperlesson, bool& ishighschoolstudent, int& nummonths, int& numlessons;
double calculatemembershipcostdouble costpermonth, double costperlesson, bool ishighschoolstudent, int nummonths, int numlessons;
Main Program
int main
Declare variables
double costpermonth, costperlesson, membershipcost;
bool ishighschoolstudent;
int nummonths, numlessons;
Call functions
displayinformation;
getinformationcostpermonth, costperlesson, ishighschoolstudent, nummonths, numlessons;
membershipcost calculatemembershipcostcostpermonth, costperlesson, ishighschoolstudent, nummonths, numlessons;
Display membership cost
cout "Membership cost: membershipcost endl;
return ;
Function Definitions
void displayinformation
Display general information about LearnIt and its discounts
cout "Welcome to LearnIt! We offer discounts for high school students, longterm memberships, and bulk lesson purchases." endl;
void getinformationdouble& costpermonth, double& costperlesson, bool& ishighschoolstudent, int& nummonths, int& numlessons
Prompt the user and input: cost per month, cost per lesson, whether the student is in high school, number of months being purchased, number of lessons being purchased
cout "Enter cost per month: ;
cin costpermonth;
cout "Enter cost per lesson: ;
cin costperlesson;
cout "Are you a high school student? for yes, for no: ;
cin ishighschoolstudent;
cout "Enter number of months being purchased: ;
cin nummonths;
cout "Enter number of lessons being purchased: ;
cin numlessons;
double calculatemembershipcostdouble costpermonth, double costperlesson, bool ishighschoolstudent, int nummonths, int numlessons
Calculate and return the final membership cost
double totalcost costpermonth nummonthscostperlesson numlessons;
if ishighschoolstudent
totalcost HIGHSCHOOLDISCOUNT;
if nummonths
totalcost SIXORMOREMONTHSMEMBERSHIPDISCOUNT;
if numlessons
totalcost FIVEORMOREINDIVIDUALLESSONSDISCOUNT;
return totalcost;
Added #include to include the necessary header for inputoutput operations.
Added using namespace std; to avoid needing to prepend std::to standard library functions like cout and cin.
Changed print to cout for outputting the membership cost.
Added const keyword before the global constant declarations.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started