I'll work on it more tomorrow, after a good night's sleep. I just submitted what I had. I'm thinking that a partial assignment is better than no assignment at all.
#include <stdio.h>
#define TAX_RATE 8.50
//Function Declarations
void getData(int*, float*, float*);
void calculate(float, int, float, float, float, float, float, float);
void outputData(int quantity, float unitPrice, float subTotal, float discountAm, float subTaxable, float taxAm, float total);
int main (void)
{
// Local Declarations
int quantity;
float discountRate;
float discountAm;
float unitPrice;
float subTotal;
float subTaxable;
float taxAm;
float total;
// Statements
getData(&quantity, &unitPrice, &discountRate);
calculate(&subTotal, &quantity, &unitPrice, &discountAm, &discountRate, &subTaxable, &taxAm, &total);
outputData(quantity, unitPrice, subTotal, discountAm, subTaxable, taxAm, total);
return 0;
} // main
void getData(int *quantity, float *unitPrice, float *discountRate)
{
//Statements
printf("\nEnter number of items sold: ");
scanf("%d", quantity);
printf("Enter the unit price: ");
scanf("%f", unitPrice);
printf("Enter the discount rate (per cent): ");
scanf("%f", discountRate);
return;
}
void calculate(float subTotal, int quantity, float unitPrice, float discountAm, float discountRate, float subTaxable, float taxAm, float total)
{
//Calculations
subTotal = quantity * unitPrice;
discountAm = subTotal * discountRate / 100.0;
subTaxable = subTotal - discountAm;
taxAm = subTaxable * TAX_RATE/ 100.00;
total = subTaxable + taxAm;
return;
}
void outputData(int quantity, float unitPrice, float subTotal, float discountAm, float subTaxable, float taxAm, float total)
{
//Statements
printf("\nQuantity sold: %6d\n", quantity);
printf("Unit Price of items: %9.2f\n", unitPrice);
printf(" ------------\n");
printf("Subtotal : %9.2f\n", subTotal);
printf("Discount: -%9.2f\n", discountAm);
printf("Discounted total: %9.2f\n", subTaxable);
printf("Sales tax: +%9.2f\n", taxAm);
printf("Total sale: %9.2f\n", total);
}
And now, I think I will go to bed. Maybe inspiration will strike while I sleep; it's happened before.