This commit is contained in:
2023-02-08 20:01:59 +00:00
parent cc2bac6311
commit 8b75ef1b88
3 changed files with 30 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
{
"files.associations": {
"stdio.h": "c"
}
}
+25
View File
@@ -0,0 +1,25 @@
// COS135-HW3
// Nicholas Pease
// 8 FEB 2023
// All Work Below Is My Own
#include <stdio.h>
int main() {
float prices[] = {21.45,10.00,14.90,33.50};
float totalPrice;
char storeName[18] = "Aubuchon Hardware\0";
printf("Welcome to %s\n",storeName);
printf("------------------------------\n");
for (int i=0; i < 4; i++) {
// Item, item num (i), tab, '$', float with 2 digit precision, tab, 'x2', tab, '$', float with .2 precision, newline
printf("Item %i\t$%.2f\tx2\t$%.2f\n",i+1,prices[i],prices[i]*2);
totalPrice = totalPrice + 2*prices[i];
}
printf("------------------------------\n");
printf("\nItem total: $%.2f\n",totalPrice);
float GST = totalPrice * 0.1;
printf("\nGST:\t$%.2f\n",GST);
printf("Total:\t$%.2f\n",totalPrice+GST);
return 0;
}
Executable
BIN
View File
Binary file not shown.