Question: //Checkpoint 4a - Advanced Branching //Calculate discount rate based on purchase amount and customer status #include int main( ) { double purchase = 0.0; double

//Checkpoint 4a - Advanced Branching
//Calculate discount rate based on purchase amount and customer status
#include
int main( )
{
double purchase = 0.0;
double discount = 0.0;
char special_customer = 'n';
printf( "Enter purchase amount: " );
scanf( "%lf", &purchase );
printf( " Special customer? (y): " );
scanf( " %c", &special_customer );
printf( " " );
/* Calculate discount amount using if..else if..else */
/* Add 2% to special customer with discount of 20% or greater using logical operator */
if ( /* fill in expression here */ )
{
/* add 2% discount */
}
printf( "Discount is: %.0lf%% ", 100 * discount ); //multiply by 100 for whole number percentage display
return 0;
}

Problem assignment. Complete the program to compute discount rate based on purchase amount and customer status, according to the following table Eurchase Amount Discount Rate Less than 50 10% 159 208 25% 500 or more, less chan 1000 1000 or more Any customer who is a special customer, and is receiving a discount of 20% or more gets an additional 2% discount For example, a special customer who makes a S300 purchase receives a 1 5% discount. A special customer who makes a S700 purchase gets 20% plus the additional 2%, for a total discount of 22%. n your program first use if.else if. else method to calculate the discount based on purchase amount. Then follow that with a single if statement with a logical operator to assign the 2% extra, if valid. Additional information: Dealing with percentages is usually done with the fractional value ( 0.05 for 5%, for example) so that calculations can be easily done. Note how the provided code multiplies the fraction by 100 in the printf) to get a displayable percentage value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
