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]
4 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]4 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
Stateful packet inspection firewalls ________. always do application content filtering have the slow speed of relay operation Bo
Evgesh-ka [11]

Answer:

Neither always do application content filtering nor have the slow speed of relay operation.

Explanation:Stateful packet inspection is a dynamic firewall filtering which filters the inflow and outflow of packets of Information from time to time. It is also known to act as monitor for the state of a connection in a Network system. The filtering decisions of a stateful inspection firewall is based on two facts

(1) The rules defined by the administrator

(2) The previous context developed based on the filtering that taken place before.

6 0
3 years ago
Which of the following IS an operating system? *<br> Reddit<br> Ubuntu<br> Office 365<br> Mac Pro
Lorico [155]

Answer:

Ubuntu

Explanation:

Ubuntu is built on the Linux shell and is an operating system. Mac pro is a laptop model, the rest are software / websites

7 0
3 years ago
Please help me answer this question
goblinko [34]
Ram:
"The more RAM your CPU has access to, the easier its job becomes, which enables a faster computer"
rom:
"ROM is a special kind of memory which stores the instructions which the computer uses when it 'boots up'"
backingstorage:
"Without some type of backing storage, the computer would not have access to its data after the computer is turned off. "- its like a hard drive
5 0
3 years ago
Need help with 4.7 lesson practice edhesive
alexandr402 [8]

Answer:

Question 4 => 4th answer: The first line should be for x in range (7, 10):

Question 5 => 2nd answer: 14 16 18 20 22 24 26 28 30 32

Explanation:

<u>Question 4</u>

"for" loops always need a variable (like "x") defined to iterate with different values.  <em>for x in range (7, 10):</em> makes x to take values 7, 8, 9 and 10 successively  and execute <em>print(x)</em> each time.

<u>Question 5</u>

The expression <em>x in range (7, 16)</em> makes x to take values from 7 up to 16 inclusive. So for each iteration it will execute <em>print x*2</em> which prints the double of the actual value for x. Starting with x=7, it will print 14, then with x=8 will print 16, and so on. All values are shown on the table below:

X       Prints

7        14

8        16

9        18

10       20

11       22

12       24

13       26

14       28

15       30

16       32

5 0
3 years ago
Read 2 more answers
In order to solve the problem of minimizing the number of times that a user has to enter a password and the problem of a plainte
aev [14]
In order to solve the problem of minimizing the number of times that a user has to enter a password and the problem of a plaintext transmission of the password a ticket granting server is used.
3 0
3 years ago
Other questions:
  • Can someone seriously help out please!!!
    15·1 answer
  • WILL GIVE  BRAINLIEST!! WILL REPORT TOO....
    13·1 answer
  • Consider the following arrays. 1 4 21 2 4 100 B # 111(A) L3π 42 Write MATLAB expressions to do the tollowing a. Select just the
    13·1 answer
  • Alice is an investor who has created a device controlled by an app that will water plants automatically. Alice has no experience
    9·1 answer
  • Cations - Office 2016 A
    12·2 answers
  • Can anyone help I have a password but it's shown like this ••••••••••• can anyone please help ​
    14·1 answer
  • Hubs hardware advantage's and disadvantages​
    7·1 answer
  • A regional bank implemented an automated solution to streamline their operations for receiving and processing checks/cheques. Th
    8·1 answer
  • Explain why microcomputers are installed with TCP/IP protocols?​
    15·1 answer
  • When spraying pesticide wear and protective eyeglass​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!