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
To join a social network you create an avatar true or false
svp [43]
False because not all social media webstites provide avatars
7 0
3 years ago
Read 2 more answers
Help me plssssss which rule should be followed to stay safe online
max2010maxim [7]

Answer:

B: Avoid Sharing Photos

Explanation:

If you send a photo to a person, you need to be very careful not to send something that can give your information away, this includes but it not limited to Pictures of your town, Pictures of You, Pictures of Friends, Pictures of Family, etc.

Hope I could help!!

7 0
3 years ago
Read 2 more answers
Sharing a workbook enables multiple users to access the workbook. What are the benefits of using a shared workbook?
damaskus [11]

Answer:

Some of the benefits of sharing a workbook include:

A. Shared information between students (ie: Mary writes a note about (blank) in the workbook and John reads said note and receives addition information about (blank)).

B. ^adding onto this, discussion on interpretations of a passage (ie: John thinks (blank) means this and Mary thinks (blank) means other thing, through notes they can discuss the meaning of the text.

Hope this helps. =)

8 0
3 years ago
The purpose of a switch______link is to be able to carry the traffic for all local VLANs.
alekssr [168]

Answer:

Inter switch link

Explanation:

It is the inter switch link( ISL) that enables to carry the traffic for all local VLANs. Functions of VLANs are firstly, a VLAN allows us to take one physical switch, and break it up into smaller mini-switches. Secondly, every virtual switch, called VLAN, is simply a number assigned to each switch port.

6 0
3 years ago
Insurance can help you:
Blababa [14]
No it can not .............
3 0
3 years ago
Other questions:
  • How many bits do you need to count up to 30 help please
    14·1 answer
  • Which member of the restaurant and food/beverage service career is mostly likely to plan menus and direct worker
    6·2 answers
  • A user has been given Full Control permission to a shared folder. The user has been given Modify permission at the NTFS level to
    11·1 answer
  • In the ______ stage of the systems development life cycle, the design specifications are translated into computer code.
    11·1 answer
  • Is a router on the local network that is used to deliver packets to a remote network?
    15·1 answer
  • Two DHCP servers, Server1 and Server2, are running Windows Server 2016. As the administrator, you create a scope called Scope1.
    8·1 answer
  • Jorge is looking for information about the life of his favorite music artist, Ray Charles. Which type of resource(s) would provi
    13·1 answer
  • In Windows 7's Jump List, what can we do?
    6·1 answer
  • PLEASE HELP I HAVE A TEST RIGHT NOW!!!
    13·1 answer
  • What approach do you prefer to take when creating presentations for class projects? Would you rather use software or create pres
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!