assigment no 1 final.docx

download assigment no 1 final.docx

of 2

description

bgbgbgbfgfgfgggggggggggggggggggggggggg

Transcript of assigment no 1 final.docx

3.17 (Gas Mileage) Drivers are concerned with the mileage obtained by their automobiles. Onedriver has kept track of several tankfuls of gasoline by recording miles driven and gallons used foreach tankful. Develop a program that will input the miles driven and gallons used for each tankful.The program should calculate and display the miles per gallon obtained for each tankful. After processingall input information, the program should calculate and print the combined miles per gallonobtained for all tankfuls. Here is a sample input/output dialog:3.18 (Credit Limit Calculator) Develop a C program that will determine if a department storecustomer has exceeded the credit limit on a charge account. For each customer, the following factsare available:a) Account numberb) Balance at the beginning of the monthc) Total of all items charged by this customer this monthd) Total of all credits applied to this customer's account this monthe) Allowed credit limitThe program should input each of these facts, calculate the new balance (= beginning balance+ charges credits), and determine if the new balance exceeds the customer's credit limit. For thosecustomers whose credit limit is exceeded, the program should display the customer's account number,credit limit, new balance and the message Credit limit exceeded. Here is a sample input/outputdialog:3.19 (Sales Commission Calculator) One large chemical company pays its salespeople on a commissionbasis. The salespeople receive $200 per week plus 9% of their gross sales for that week. Forexample, a salesperson who sells $5000 worth of chemicals in a week receives $200 plus 9% of$5000, or a total of $650. Develop a program that will input each salespersons gross sales for lastweek and will calculate and display that salesperson's earnings. Process one salesperson's figures at atime. Here is a sample input/output dialog:3.20 (Interest Calculator) The simple interest on a loan is calculated by the formulainterest = principal * rate * days / 365; The preceding formula assumes that rate is the annual interest rate, and therefore includes thedivision by 365 (days). Develop a program that will input principal, rate and days for severalloans, and will calculate and display the simple interest for each loan, using the preceding formula.Here is a sample input/output dialog:3.21 (Salary Calculator) Develop a program that will determine the gross pay for each of severalemployees. The company pays straight time for the first 40 hours worked by each employee andpays time-and-a-half for all hours worked in excess of 40 hours. Youre given a list of the employeesof the company, the number of hours each employee worked last week and the hourly rate ofeach employee. Your program should input this information for each employee, and should determineand display the employee's gross pay. Here is a sample input/output dialog:3.23 (Printing Numbers from a Loop) Write a program that utilizes looping to print the numbersfrom 1 to 10 side by side on the same line with three spaces between numbers.3.29 What does the following program print?N 10*N 100*N 1000*N1 10 100 10002 20 200 20003 30 300 30004 40 400 40005 50 500 50006 60 600 60007 70 700 70008 80 800 80009 90 900 900010 100 1000 10000A A+2 A+4 A+63 5 7 96 8 10 129 11 13 1512 14 16 1815 17 19 211 #include 23 int main( void )4 {5 int count = 1; /* initialize count */67 while ( count