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]
3 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]3 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
What is malware? a type of virus that spreads through a network connection a type of virus that targets programs and files any p
andreyandreev [35.5K]

Answer:

any program designed to do harm.

Explanation:

Malware is a program that was created by someone with malicious intent. Malware can target your windows system files and damage windows(or what ever os you use). Malware can corrupt files and even lock you out of your computer.

4 0
3 years ago
Twisted copper telephone wire, coaxial copper cable, fiber-optic cable, and media for wireless transmission are all __________.
mina [271]

Twisted copper telephone wire, coaxial copper cable, fiber-optical cable, and media for wireless transmission are all physical transmission medium.

A system or material that can mediate the propagation of signals for telecommunications purposes is referred to as a transmission medium. Typically, signals are applied to a wave of some sort that is appropriate for the selected medium.

For instance, data may modulate sound, and while air is a common transmission channel for sounds, solids and liquids can also be used. A useful transmission medium for electromagnetic waves like light and radio waves is vacuum or air.

Although a physical substance is not necessary for the propagation of electromagnetic waves, these waves are typically impacted by the transmission medium they pass through, for example, by absorption, reflection, or refraction at the interfaces between media. Therefore, waves can be transmitted or guided using technical devices.

To know more about transmission medium click here:

brainly.com/question/28113920

#SPJ4

8 0
1 year ago
When might be the best time to start saving for retirement?
sasho [114]

High School or when you get hired.

5 0
3 years ago
Read 2 more answers
How do you reflect yourself in the topic (filters)​
Gnesinka [82]
In what topic ?? Please explain more
6 0
3 years ago
If you know the unit prices of two different brands of an item you are better able to
vitfil [10]

Answer:

TO UNDERSTAND TO ITS VALUES AND ITS  FEATURES

Explanation:

4 0
3 years ago
Other questions:
  • 1. An Excel file is called a workbook?<br> A) True<br> B) False
    6·2 answers
  • )a___ is a complete binary tree such that each node in the tree contains a comparable object that us greater than or equal to th
    9·1 answer
  • Your company runs several databases on a single MySQL instance. They need to take backups of a specific database at regular inte
    12·1 answer
  • Downloading files is safe for most types of files except Select one: a. documents. b. pictures. c. executable files. d. music fi
    7·1 answer
  • How to create a distribution list in outlook?
    7·1 answer
  • Write a program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The name wil
    13·1 answer
  • Name three types of hard drives, along with its speed and size.
    8·1 answer
  • Primary technology skills are skills that are necessary for success in online education
    9·2 answers
  • Write a C++ program that determines if an integer is a multiple of 7. The program should prompt the user to enter and integer, d
    13·1 answer
  • If you have 128 oranges all the same size, color, and weight except one orange is heavier than the rest. Write down a C++ Code/A
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!