Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will create a program which tracks the balance and number of transactions for a gift card. Display a prompt to the Terminal user and

You will create a program which tracks the balance and number of transactions for a gift card.

Display a prompt to the Terminal user and scan in (using the scanf( ) command) the initial value of the gift card. Scan this value as a float, into a variable called “size”.

Check to see if the user enters a gift card size greater or equal to $20.00. If they do not, display an error prompt which asks them to re-enter a value and then rescan. You must use a while-loop; you should keep prompting the user for a valid gift card value until one is obtained. Store the new value into “size”.

After your loop is finished (and “size” has a valid value), create another float variable called “bal”, which will be used to represent the current balance of the gift card. Initialize “bal” by setting it equal to “size”.

Create a custom function which will compute the new balance of the card, when given the previous balance and the charge amount. The new balance will simply be the difference of the two inputs.

The function should have two inputs (both floats) and should have a float output. Write your function prototype near the top of your C-file, above the “main” and write your function code below “main”.

Create two additional variables: “chrg” (a float) and “trans” (an int). These variables will be used to represent a charge amount to the card and count the number of transactions, respectively. Next, set up a while-loop to repeatedly do the following tasks:

Display, to the Terminal, the current balance on the gift card by printing out the “bal” variable. Print the value with a precision of 2 and place a dollar symbol ($) before it.

On a separate line, prompt the user to enter a value for next transaction charge value. Scan in the transaction charge dollar amount (as a float) and store it into the “chrg” variable.

The current transaction number (the value of “trans”) should be printed in the prompt and should start at 1 on the first loop pass. The value of “trans” is essentially a while-loop counter.

Update the balance of the card (the “bal” variable), using your function from part (c). Pass into the function the current balance and the charge amount from (ii) and use the returned function value to update the balance of the card (overwrite the value stored in “bal”).

Increment the transaction counter variable, “trans”, by one.

Your while-loop should stop when the balance of the card (“bal”) is less than or equal to zero. You do NOT need to check user input for the “chrg” value; assume the inputs are always valid and positive.

After the balance of your card reaches zero (and the loop above exits), print, to the Terminal, the remaining balance due (with a $ sign and a precision of 2). This should be the negative value of “bal” after the above while-loop exits. Do NOT use the absolute-value function, abs( ).

Open a text file for write-access, called “card.txt”. Verify the file opens correctly by checking for a NULL file pointer. Display an error message and return a value of -1 if unsuccessful.

Next, print the original size of the gift card (stored in variable “size”) to the text file with a “$” symbol and a precision of 2. On the second line of the text file, print the number of transactions which occurred on the gift card. You may use simple newline characters () when printing. Close the file when finished.

#include "stdio.h"

float updateCard(float, float);

int main(void)
{
//part a
printf("Enter the size of the gift card ($): ");
float size;
scanf("%f",&size);

// Code is not shown - Please complete it

return 0;
}

Wise Company began operations at the beginning of 2021. The Following information pertains to this company. 1. Pretax financial income for 2021 is $100,000. 2. The tax rate enacted for 2021 and future years is 20%. 3. Differences between the 2021 income statement and tax return are listed below: a. Warranty expense accrued for financial reporting purposes amounts to $7,000. Warranty deduc- tions per the tax return amount to $2,000. b. Gross profit on construction contracts using the percentage-of-completion method per books amounts to $92,000. Gross profit on construction contracts for tax purposes amounts to $67,000. c. Depreciation of property, plant, and equipment for financial reporting purposes amounts to $60,000. Depreciation of these assets amounts to $80,000 for the tax return. d. A $3,500 fine paid for violation of pollution laws was deducted in computing pretax financial income. e. Interest revenue recognized on an investment in tax-exempt municipal bonds amounts to $1,500. 4. Taxable income is expected for the next few years. (Assume (a) is short-term in nature; assume (b) and (c) are long-term in nature.) Instructions a. Compute taxable income for 2021. b. Compute the deferred taxes at December 31, 2021, that relate to the temporary differences described above. Clearly label them as deferred tax asset or liability. c. Prepare the journal entry to record income tax expense, deferred taxes, and income taxes payable for 2021. d. Draft the income tax expense section of the income statement, beginning with "Income before in- come taxes."

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Accounting

Authors: Donald E. Kieso, Jerry J. Weygandt, Terry D. Warfield

16th edition

1118742974, 978-1118743201, 1118743202, 978-1118742976

More Books

Students also viewed these Accounting questions