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
Write important of ICT in personal life?
mr Goodwill [35]

Answer:

ICT is a great impact for are daily lives. It can improve the quality of a human life. The reason why it can improve that, it’s because it can be used as a learning and education media, the mass communication media in promoting and campaigning practical and important issues, such as the health and social area.

Explanation:

4 0
3 years ago
When is it appropriate to use images in presentations?
Svetach [21]
The answer to the question is c
7 0
4 years ago
Read 2 more answers
100POINTS!!!!
Anettt [7]

Answer:

Is it a tool in the computer, pls make it clear

6 0
3 years ago
Read 2 more answers
Which of the following is an example of a Syntax Error?
quester [9]

Answer:

The correct answer is: "The program does not run at all."

Explanation:

The rules to write a program in any language are called syntax. The error in syntax of a language is called syntax error. Syntax errors are usually detected during the compilation of the program. The program cannot be run untill all syntax errors are removed.

So,

The correct answer is: "The program does not run at all."

7 0
3 years ago
Arrange the steps in a sequence that you would follow while sorting data in a spreadsheet.
ss7ja [257]

Answer:

  1. In the spreadsheet menu, click the Data option.
  2. Select the column to sort.
  3. In the submenu of Data, click the Sort… option.
  4. In the Sort dialog box, click the “ascending” option for the  first sort criteria.
  5. Click OK.

Explanation:

The correct sequence is as shown above.

3 0
3 years ago
Other questions:
  • You can tell when an image is selected, because its sizing handles will be visible. True or False
    15·2 answers
  • 7.
    6·1 answer
  • Trisha is looking for a new table style. What is the fastest way for her to preview how different styles in the gallery would lo
    13·1 answer
  • A palindrome number is a number that remains the same when its digits are reversed. Like 16461, for example, is a palindrome num
    13·1 answer
  • Double bar graphs compare multiple what
    11·1 answer
  • Will give brainliest!!<br> (Question 3)
    12·2 answers
  • D. DROP
    6·1 answer
  • What is the value of numX when this program is executed? if 3 &lt; 5 and 8 != 3: numX = 3 else: numX = 7
    13·2 answers
  • he attributes for an iframe are controlled by CSS. One of the iframe controls is "seamless." This means it _____. will blend the
    11·1 answer
  • Question 7 (1 point)
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!