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
iogann1982 [59]
2 years ago
8

Gimme Shelter Roofers maintains a file of past customers, including a customer number, name, address, date of job, and price of

job. It also maintains a file of estimates given for jobs not yet performed; this file contains a customer number, name, address, proposed date of job, and proposed price. Each file is in customer number order.
Required:
Design the logic that merges the two files to produce one combined file of all customers whether past or proposed with no duplicates; when a customer who has been given an estimate is also a past customer.
Computers and Technology
1 answer:
gulaghasi [49]2 years ago
8 0

Answer:

Hence the complete implementation of python code that reads two files and merges them together.

def merge_file(past_file_path,proposed_file_path, merged_file_path):

   past_file_contents=load_file(past_file_path)

   proposed_file_contents=load_file(proposed_file_path)

   proposed_customer_name = []

   for row in proposed_file_contents:

       proposed_customer_name.append(row[1])

   with open(merged_file_path,'w') as outputf:

       outputf.write("Customer Number, Customer Name, Address\r\n")

       for row in proposed_file_contents:

           line = str(row[0]) +", " + str(row[1]) + ", " + str(row[2]) +"\r\n"

           outputf.write(line)

       for row in past_file_contents:

           if row[1] in proposed_customer_name:

               continue

           else:

               line = str(row[0]) + ", " + str(row[1]) + ", " + str(row[2]) + "\r\n"

               outputf.write(line)

       print("Files merged successfully!")

# reads the file and returns the content as 2D lists

def load_file(path):

   file_contents = []

   with open(path, 'r') as pastf:

       for line in pastf:

           cells = line.split(",")

           row = []

           for cell in cells:

               if(cell.lower().strip()=="customer number"):

                   break

               else:

                   row.append(cell.strip())

           if  len(row)>0:

               file_contents.append(row)

   return file_contents

past_file_path="F:\\Past Customer.txt"

proposed_file_path="F:\\Proposed Customer.txt"

merged_file_path="F:\\Merged File.txt"

merge_file(past_file_path,proposed_file_path,merged_file_path)

You might be interested in
Most network cards contain a port that accepts a(n) ____, which looks similar to a telephone connector but is larger.
Vadim26 [7]
YOUR ANSWER IS -------- It accepts a RJ-45 connector
hope i helped you :).
take care
8 0
3 years ago
Which is the best information to determine an athlete's abilities and needed areas of improvement?
katen-ka-za [31]

Answer:

4

Explanation:

7 0
2 years ago
Read 2 more answers
A company asked you help mitigate the brute force attacks carried out against its users' Windows account passwords. You successf
prohojiy [21]

Answer:

The following options are true.

Explanation:

A corporation has requested the user to support minimize the brute force attacks on credentials of their Microsoft account holder's. They effectively eliminated the malware involved in those assaults and have to protect their credentials allocated towards their user profiles properly without restricting the usefulness of the program.

The following should be included in securing the user accounts are need credentials for the user profile, create logon constraints that failed as well as need powerful credentials.

7 0
2 years ago
Laura has identified the job she wants, the skills needed for the position, and the areas she needs to improve in order to get i
DerKrebs [107]

The answer to your question is,

C. Identify her current skills

-Mabel <3

5 0
3 years ago
Read 2 more answers
Your son is complaining that his smartphone is broken. He tells you that he cannot connect to the internet, nor can he make or r
ycow [4]

Answer:

the correct and only reasonable answer is option B

3 0
1 year ago
Other questions:
  • What is a valence orbit?
    13·2 answers
  • Transparency is an important concept in policies related to the handling and use of customer data. Organizations should be trans
    5·1 answer
  • The second stage of digestion takes place in the small intestine. <br> True Or False?
    8·1 answer
  • The motion of any object can be broken down into it's component (parts of) vectors. true or false
    9·2 answers
  • The concept of plug and play" is demonstrated by which of the following
    15·1 answer
  • A videogame designer would be most interested in the _____ elements of beowulf.
    12·2 answers
  • ¿En qué año se funda lego?
    5·1 answer
  • The people on this platform are unbelievably nice. its almost rare to see this type of kindness online these days. Just wanted t
    14·1 answer
  • A major retailer wants to enhance their customer experience and reduce losses
    6·1 answer
  • The term used to describe whereby old and new media are available via the integration of personal computers and high speed satel
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!