Question: Write a program that prints a data report in a specific format. Note that the purpose of this assignment is to test your skills using

Write a program that prints a data report in a specific format. Note that the purpose of this assignment is to test your skills using string and number formatting commands.

Algorithm:

Copy and paste the lines below directly into your program to set up your initial data. Do not edit or change any of the values or variable names.

 # input data companyName = "Lone Star Corporation" date = "October 1, 2018" cash = 7505.54 acctsRec = 502.21 supplies = 313.89 land = 6456.23 buildings = 81598.00 machAndEquip = 8329.99 patents = 2000.00 acctsPay = 93569.23 stock = 88100.00 

Calculate the Total Assets as the sum of the seven items "Cash", "Accounts Receivable", "Supplies", "Land", "Buildings", "Machines and Equipment", and "Patents". Similarly, calculate the Total Liabilities and Stockholders' Equity as the sum of "Accounts Payable" and "Stock".

That's all! The math is easy on this one. :-)

Expected output:

Your output should look exactly like the following (except for the two rows with 1234567890 repeated, which are ONLY added below to make it easier for you to visualize the column layout):

 LONE STAR CORPORATION Balance Sheet October 1, 2018 12345678901234567890123456789012345678901234567890123456789012345678901234567890 Liabilities and Assets Stockholders' Equity -------------------------------------------------------------------------------- Cash 7505.54 Liabilities: Accounts Receivable 502.21 Accounts Payable 93569.23 Supplies 313.89 Land 6456.23 Buildings 81598.00 Stockholders' Equity: Machines and Equipment 8329.99 Capital Stock 88100.00 Patents 2000.00 Total Assets 106705.86 Total Liabilities and Stockholders' Equity 181669.23 12345678901234567890123456789012345678901234567890123456789012345678901234567890 

Important Notes on Formatting:

The width of the report should be exactly 80 characters. (The "1234567890" x 8 lines are there to help you line up your output, but should not appear in your final results.)

Print one blank line at the top of the report.

The name of the company must be converted to all upper case, and then centered in the middle of the 80 characters.

The words "Balance Sheet" should be centered.

Use "October 1, 2018" as the date. Center it.

Leave one blank line.

Do not print the "1234567890" line.

In the main part of the report, note that:

"Assets" and "Total Assets" line up in the first column.

The seven items under "Assets" line up in the fourth column (indented by three spaces).

"Liabilities and", "Liabilities:", and "Total Liabilities and" line up in column 44.

Stockholders' Equity", "Accounts Payable", and "Stockholders' Equity" line up in column 47 (indented by three spaces).

"Capital Stock" starts in column 50 (indented by six spaces).

Assume that all of the numbers given to you as data will be positive floating-point numbers less than $100,000. That means you should choose a field width and format appropriate for numbers in that range.

Assume that Total Assets and Total Liabilities and Stockholders' Equity will always be less than $1,000,000. Choose an appropriate field width and format for those.

You can pad strings with blank spaces at the start to indent them by 3 or 6 spaces, but do not use long strings of spaces between fields. If there are more than 6 spaces between two items (such as between "Cash" and 7505.54), print the string with a fixed field size to ensure it takes up enough columns to force the second item to line up neatly.

Print one blank line at the end.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!