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
When you open a program, the hard drive___
Papessa [141]

Answer:

When you open a program, the hard drive <u>Registers the program and runs the program accordingly. </u>

I hope this helped!

3 0
3 years ago
The________ format is usually used to store data
Nikitich [7]
The answer is BCD; The BCD format is usually used to store data
5 0
3 years ago
Anybody plays mine craft
GuDViN [60]
Want to avoid giant mushrooms than stay away from dark oak and mooshroom biomes
5 0
3 years ago
Read 2 more answers
You are researching RAM for a computer you are building for a friend who will be using the system as a home office server for he
AlexFokin [52]

Answer:

ECC memory

Explanation:

According to my research on information technology, I can say that based on the information provided within the question the best type of RAM for this situation would be ECC memory (RAM). This abbreviation refers to Error-Correcting-Code, this memory can detect and correct many common types of errors, and is used mainly for servers or when sensitive data is involved where errors and data corruption cannot be allowed to happen under any circumstance.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

3 0
3 years ago
What is the purpose of an IP address? A. identifying source and destination of data B. creating images on websites C. drawing ta
natka813 [3]

Answer:

The Answer is A. I could be wrong though.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Allan needs to ensure that an object is in a very precise location on a slide. He decides to use the Ruler option to achieve thi
    5·2 answers
  • When creating a spreadsheet, there's no need to worry about design and how it will be organized; the program will take care of t
    11·2 answers
  • What is f(-3) for the function f(a)=-2a2-5a+4?​
    10·1 answer
  • Which of the following was the name of the first generation of cell phone networks?
    14·1 answer
  • I don't understand how to write code for this in Java using nested for loops only. The official question is: write a program tha
    8·1 answer
  • Write a program that takes the radius of a sphere (a floating-point number) as input and then outputs the sphere’s: Diameter (2
    7·1 answer
  • A security utility program that scans the system for small programs that interfere with how a computer functions are _____ utili
    13·1 answer
  • How is a website most likely to distinguish its different sections?
    8·1 answer
  • 1. asynchronous_communication
    5·1 answer
  • Please please help I don’t understand this please.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!