{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Homework3-1

# Homework3-1 - Homework#3 Program Hw3_1.c Written by Justin...

This preview shows pages 1–3. Sign up to view the full content.

Homework #3 /* * Program Hw3_1.c * Written by Justin Waters * Inputs: user status, purchase amount * Outputs: detailed receipt in seperate file * Description: User states if he is/isn't a teacher, tells how much he spent, and he gets a detailed receiipt of his purchase * */ #include <stdio.h> //printf, scanf defined #include <math.h> //math functions defined #define discount1 0.10 //defines 10 % tax value #define discount2 0.12 //defines 12 % tax value #define taxx 0.05 //defines 5 % sales tax int main (void) { int identify; //tells if user is a teacher or not int stax; //sales tax int t1tax; //10 % tax discount for teachers int t2tax; //12 % tax discount for teachers double pchs_amt, teach_dis, tax, ttl, dis_total; //used for calculations FILE *fpout; //lets program print to outside files fpout = fopen("receipt.txt", "w"); //opens/creates out file //tax values used stax = 5; t1tax = 10; t2tax = 12; //finds out if user is a teacher or not printf("If you are a teacher, enter '1'.\n If you aren't a teacher, enter '2'."); scanf("%d", &identify); if (identify == 1) //loop done for a teacher { //gets amount of purchase

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
printf("Enter total amount of purchase.> \$ ");
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}