Thread: Student Question3

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    25

    Question Student Question3

    Ok Guy's,
    I am having a major brain freeze here. Here is my code:

    Code:
    #include<stdio.h>
    #include <stdlib.h>
    int main (void)
    
    {
    	//declaring variables 
    		float Purchase_Amount = 0.0; //Variable for the purchase amount initialized at 0
    		float DelMar_TaxRate = 7.25; //Del Mar Tax Rate
    		float Encinitas_TaxRate = 7.50; //Encinitas Tax Rate
    		float LaJolla_TaxRate = 7.75; //La Jolla Tax Rate
    	
    	//Welcome Screen
    		printf("Kudler Fine Foods Tax Calculation Program\n");
    		printf("\nPlease Enter Your Purchase Amount: ");
    		if(scanf_s("%f", &Purchase_Amount) !=1) //Error Check and Message
    		{
    			printf(" That was an Invalid Purchase Amount. Please try again. Example 99.99, enter Zero to exit\n");
    		}
    
    		//Calculations For each location//
    		//TotalAmount  = PurchaseAmount * DelMarTaxRate / 100.00 + PurchaseAmount
    		printf("\nThe Del Mar Tax Rate of 7.25%% adds $%2.2f", DelMar_TaxRate * Purchase_Amount);
    		printf(" for a \ntotal of ---------> $%.2f.\n", (DelMar_TaxRate * Purchase_Amount)+Purchase_Amount/100.00);
    		printf("\nThe Encinitas Tax Rate of 7.50%% adds $%2.2f", Encinitas_TaxRate * Purchase_Amount);
    		printf(" for a \ntotal of ---------> $%.2f.\n", (Encinitas_TaxRate * Purchase_Amount)+Purchase_Amount/100.00);
    		printf("\nThe La Jolla Tax Rate of 7.75%% adds $%2.2f", LaJolla_TaxRate * Purchase_Amount);
    		printf(" for a \ntotal of ---------> $%.2f.\n", (LaJolla_TaxRate * Purchase_Amount)+Purchase_Amount/100.00);
    		printf("\n\n\tThank you and have a nice day!\n\n");
    		return 0;
    }
    Everything but the math is right. If I input $100.00, I get $725.00 when I should be recieving back $107.25.

    Can someone please help me?

    Thanks...

  2. #2
    Registered User
    Join Date
    Oct 2008
    Posts
    3
    it's supposed to be 7.25% tax plus the 100 you spent

    so
    (DelMar_TaxRate * Purchase_Amount)+Purchase_Amount/100.00)

    supposed to be

    ((DelMar_TaxRate / 100) * Purchase_Amount) + Purchase_Amount)

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    25

    Cool

    Quote Originally Posted by jh0720 View Post
    it's supposed to be 7.25% tax plus the 100 you spent

    so
    (DelMar_TaxRate * Purchase_Amount)+Purchase_Amount/100.00)

    supposed to be

    ((DelMar_TaxRate / 100) * Purchase_Amount) + Purchase_Amount)
    Awesome!!! I should have seen this but thank you!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Updating in a sequential file?
    By Ronnyv1 in forum C Programming
    Replies: 1
    Last Post: 03-24-2009, 04:41 PM
  2. Student Question3
    By Nezmin2 in forum C Programming
    Replies: 10
    Last Post: 12-23-2008, 10:16 AM
  3. Database assignment is Killing me!
    By Boltrig in forum C Programming
    Replies: 2
    Last Post: 11-29-2007, 03:56 AM
  4. LinkList Sorting in C
    By simly01 in forum C Programming
    Replies: 3
    Last Post: 11-25-2002, 01:21 PM
  5. Creating a student grade book-how?
    By Hopelessly confused in forum C Programming
    Replies: 5
    Last Post: 10-03-2002, 08:43 PM