Preview

C Programming Worksheet2

Good Essays
Open Document
Open Document
1009 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
C Programming Worksheet2
Worksheet 2
Intro. To C Programming

by
Yanique Campbell

An assignment submitted in partial fulfillment of the requirements for the course Intro. To C Programming

Instructor: Mr. Rohan Simpson

Date: March 18, 2014

Department of Communication and Information Technology
Bethlehem Moravian College.
Question 1
A program is required to read a customer’s name, a purchase amount and a tax code. The tax code has been validated and will be one of the following:
• 0 tax exempt (0%)
• 1 state sales tax only (3%)
• 2 federal and state sales tax (5%)
• 3 special sales tax (7%)
The program must then compute the sales tax and the total amount due, and print the customer’s name, purchase amount, sales tax and total amount due.
Solution
#include <stdio.h>
#include <conio.h> int main ()
/*Nestes if statements*/
{
int taxcode; float pamount; float stax; float tamount; char name [30]; printf ("Enter name\n"); scanf ("%s", &name); printf ("Enter pamount\n"); scanf ("%f", &pamount); printf ("Enter a taxcode from(0-3)\n"); scanf ("%d", &taxcode); if (taxcode==0) { stax=pamount*0; tamount=pamount+stax; } else if (taxcode==1) { stax=pamount*0.03; tamount=pamount+stax; } else if (taxcode==2) { stax=pamount*0.05; tamount=pamount+stax; } else if (taxcode==3) { stax=pamount*0.07; tamount=pamount+stax; } printf ("Name is:%s\n", name); printf ("Total amount is:%f\n", tamount);

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Nt1310 Unit 5 Lab 8

    • 551 Words
    • 3 Pages

    The team also noticed some inconsistencies in the graph that they feel could be fixed by changing their code. One of these issues being that cutting off power completely from the AEV’s resulted in the motors having to do extra work in order to get started again. Possibly changing the code so the amount of power supplied to the motors gradually decreased over time instead of stopping the power completely, could make for a more efficient AEV. Theoretically speaking, when a plane begins to near its destination the pilot begins to lower the amount of thrust given to the engines, not cease thrust completely, so if the team were able to find a way to mimic this, they feel that their AEV could save energy overall, and become more productive.…

    • 551 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Lab10 worksheet

    • 1151 Words
    • 5 Pages

    Will the Group Policy settings you configure in your new GPO have an immediate effect on your network? Why?…

    • 1151 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    2. The program will display a series of screens prompting the user to enter the item name or number, price and quantity.…

    • 498 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    ops335 lab 2 firewall

    • 695 Words
    • 4 Pages

    6. Display the tax payable and total purchase price for the book to the customer.(tax + list price = purchase price)- data type decimal…

    • 695 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    It210-Appendix G

    • 436 Words
    • 2 Pages

    Write “The purpose of this program is to calculate tax for a given salary range”…

    • 436 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    #include #include float avg_wt,avg_tt; int i = 0,ttl_wt=0,ttl_tt=0,qt; struct process { int prn; char type; int bt; int wt; int tt; struct process *nxt; }*stfor,*stbck,*np,*endfor,*endbck,*temp; void ins_node(struct process *np) { if(np->type == 'f') { if(stfor == NULL) stfor = endfor = np; else { endfor->nxt = np;…

    • 401 Words
    • 2 Pages
    Better Essays
  • Good Essays

    Sales and Cell

    • 445 Words
    • 2 Pages

    | In cell G24, enter an IF function that will calculate a bonus for the part-time sales…

    • 445 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    unit 3

    • 313 Words
    • 2 Pages

    Design a program that calculates the total amount of meal purchased at a restaurant. The program should ask the user to enter the charge for the food, and then calculate the amount of a 15% tip and 7% sales tax. Display each of these amounts and the total.…

    • 313 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    The individual customer who has prepared their own taxes, but prefers verification from a tax professional and would like their taxes filed electronically to minimize the amount of time it takes to receive their refund.…

    • 4326 Words
    • 18 Pages
    Powerful Essays
  • Satisfactory Essays

    Math Worksheet 1

    • 370 Words
    • 2 Pages

    Answer the following questions using the data you have found. Show your work on all questions as indicated.…

    • 370 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    4. Use the candy, toothpicks, and/or twist ties to construct a three- dimensional model of each of the aforementioned molecules.…

    • 329 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    COS wa 10

    • 297 Words
    • 2 Pages

    Create a set/list of enumerated constants called week that contains the days of the week. Have a variable called today that is of type week. Assign a value to today. If the day is Monday through Friday, print "Go to work!" If the day is Saturday or Sunday, print "You can rest today!"…

    • 297 Words
    • 2 Pages
    Good Essays
  • Good Essays

    maths worksheet

    • 7081 Words
    • 29 Pages

    and an extreme bound analysis implying that it is unlikely that these results are driven…

    • 7081 Words
    • 29 Pages
    Good Essays
  • Satisfactory Essays

    Context Diagram

    • 320 Words
    • 2 Pages

    Process description : This process takes input from bills memory and then generates bill and sends to the customer…

    • 320 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Electric Bill Extimation

    • 1326 Words
    • 6 Pages

    The computerized tax management information system is organized in modules in line with its basic functions. These include:…

    • 1326 Words
    • 6 Pages
    Powerful Essays