1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Eddi Din [679]
3 years ago
5

A manager keeps a record of daily each transaction in input.txt. Each line contains three items: The invoice number, the cash am

ount, and the letter P refers to the amount that has been paid or R if it was received. Items are separated by spaces. Write a program that prompts the manager to provide the opening cash balance, the closing cash balance, and the file name (i.e., input.txt) that the manager wants to read. Then, your program should check whether the closing cash balance equals the expected value after processing input.txt.

Computers and Technology
1 answer:
Scilla [17]3 years ago
3 0

Answer:

See explaination for code

Explanation:

# Take user input

opening_balance = float(input('Enter the opening cash balance: '))

closing_balance = float(input('Enter the closing cash balance: '))

filename = input('Enter the file name: ')

# Open file to read

fileread = open(filename, 'r')

# Set file_balance to opening balance

file_balance = opening_balance

# Iterate over file

# Split line to get data from it

for line in fileread.readlines():

data = line.rstrip().split()

# Add payment is R means Received else subtract

if data[2] == "R":

file_balance += float(data[1])

else:

file_balance -= float(data[1])

# Check if equal and print message accordingly

if file_balance == closing_balance:

print('The closing balance is correct')

else:

print('The closing balance didn\'t match.\nAccording to the file, it should be', file_balance)

Please kindly check attachment for screenshot and output.

You might be interested in
Which of the following is true of the 529 plan
sesenic [268]

A 529 Plan is an education savings plan operated by a state or educational institution designed to help families set aside funds for future college costs.

your answer will be: It is a tax-advantaged college savings plan.

5 0
3 years ago
Read 2 more answers
Write the interface (.h file) of a class Counter containing: A data member counter of type int. A data member named counterID of
OlgaM077 [116]

Explanation:

See the attached image for The interface (.h file) of a class Counter

8 0
3 years ago
True or False? At any point in time, an open file has a current file pointer indicating the place where the next read or write o
mr_godi [17]

Answer:

True is the correct answer for the above question.

Explanation:

  • When any document file is opened then every point has some particular address. so there is a pointer which states that where the read operation and the write operation is going on.
  • When any person writes any program to read a file or write a file then there is a need for some variable that is pointed for the reading and the write operation.
  • The document which is used for the write data or read data is also designed and maintained by some software.
  • Hence we can say that there are needs of some variable that point the operation of the file and it is also stated from the above question. Hence the above question statement is a true statement.
5 0
3 years ago
The _____ is an information and communication-based electronic exchange environment mostly occupied by sophisticated computer an
Airida [17]

Answer:

The correct answer to the following question will be "Marketspace".

Explanation:

  • A relatively new marketing term which seems to be a simulated market place. It's an area for the electronic exchange of ideas and information in which external boundary restrictions are removed, termed as Marketspace.
  • The electronic trading world focused on connectivity often filled by advanced computer and telecommunications technology and digitized deals.

Therefore, Marketspace is the right answer.

5 0
3 years ago
I need help please and thank you
Evgen [1.6K]

Answer:

Explanation: For "BEST way to handle the situation," try Option 1, because it would possibly help them or make the Technical Support Representative do less work.

For "WORST way to handle the situation," Option 4 would be the best because you're basically just hanging up on the person.

5 0
3 years ago
Other questions:
  • Principles of defensive driving include:
    15·1 answer
  • 2. Add a _______ to manually force text from one page to the next page. A. footer B. page break C. blank page D. header
    11·2 answers
  • A(n) ________ converts your voice's sound waves into digital signals.
    9·1 answer
  • There are several reasons it’s important to use the right tool and the right size tool for the job, but the most important reaso
    8·1 answer
  • The part of the computer that contains the brain or the Central Park nursing unit is also known as
    10·1 answer
  • Which of the following is true about driving on "bald" tires?
    5·1 answer
  • What is the name of the newer communication protocol that is supported by Window 10's version of TCP/IP?
    11·1 answer
  • Many companies use telephone numbers like 555-GET-Food so the number is easier for their customers to remember. On a standard te
    6·2 answers
  • Which online article citation is correctly formatted according to MLA standards?
    15·2 answers
  • Who addicted to fnaf
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!