View the step-by-step solution to:

// // // // // // // // // // // Example 3-9 This program shows the use of library function calls. Several libraries of functions ship with your...

n this assignment, you develop a program to produce a current ratio report. 

The current ratio is used in accounting to measure a company's financial condition. To compute the ratio, one divides the company's current assets by the current liabilities. Here is a sample set of data (2010 to 2012). The first line is the company name, appearing in column one (a maximum of 30 characters in length). In each subsequent line, the first number (starting in column 1) represents the current assets and the second number (starting in column 10) represents current liabilities. Here is some sample data to use (no blank line appears in the data file at the beginning)::

Hi-Tech Leisure Products
47900       31007
34500        9100
57984       14822

example is attached for data file.

// Example 3-9 // // This program shows the use of library function calls. // Several libraries of functions ship with your compiler, and most // companies have also generated their own set of custom functions. // The purpose of a function as used below is to take some information, // perform some calculations, and return a value to the expression where // the function is "invoked". The floor() function takes a numeric // value and returns the highest integer contained in the value. // For positive numbers, this essentially truncates the decimal portion. // This function is located in the math.h library. #include <stdio.h> #include <math.h> char name[15]; int empnum; float amount; float SalesTax; float total; int dollars; int cents; // This could be int, but read about the "quirk" in the lecture notes and below main() { printf("**Mini Register Program**\n\n"); printf("Please enter your name: "); gets(name); printf("%s, please enter your employee number: ", name); scanf("%d", &empnum); printf("Please enter amount of sale: $"); scanf("%f", &amount); SalesTax = amount * .09; total = amount + SalesTax; printf("\n"); printf("Cashier: %s\n", name); printf("Employee #%d\n\n", empnum); printf("Amount of sale: $%8.2f\n", amount); printf("CA Sales Tax: $%8.2f\n", SalesTax); printf("-------------------------\n"); printf("Total: $%8.2f\n", total); dollars = floor(total); cents = floor((total-dollars) * 100); printf("\n"); printf("Pay %d dollars and %d cents.\n", dollars, cents); return 0; } // Why doesn't cents = floor((total-dollars) * 100) and printf("Pay %d dollars and %d cents.\n", dollars, cents); // not work? See the lecture notes for a hint. You can also swap these two statements for their counterparts above and run a few tests // to see what happens. I wouldn't expect you to pay too much attention to this since you are first starting // but it's a good example that often complexities get the best of you in
Background image of page 1
Background image of page 2
Sign up to view the entire interaction

Top Answer

The way to answer this question is ... View the full answer


#include &lt;stdio.h&gt;
#include &lt;math.h&gt;
int main(){
FILE *inputFile;
char companyName[30];
int currentAssets;
int currentLiablity;
double currentRatio;
int avg_current_assets = 0;

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.


Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online