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
A piece of glass has a thin film of gasoline floating on it. A beam of light is shining perpendicular on the film. If the wavele
kobusy [5.1K]

Answer:

200 nm

Explanation:

We need a constructive interference to see the bright reflection

we know that 2t=m\lambda  where m=1 and \lambda is the wavelength of the gasoline

so \lambda =\frac{560}{1.4}=400nm

putting the value of m and \lambda in thickness equation

t=\frac{1\times 400}{2}=200nm

so the thickness of the film will be 200 nm

3 0
3 years ago
Would it be possible to make VR technology in a way that our brain sees imagined experiences using simple impulses (like words)
Ludmilka [50]

Answer:

theoretically yes. we would need to cross and langue gap because our brain signals wouldn't understand words

Explanation:

educated quess

7 0
2 years ago
Which rules should be remembered when creating formulas using nested functions? Check all that apply.
White raven [17]

Answer:

Use an equal sign at the beginning of the formula (A)

Use open and close parenthesis for each set of nested functions (B)

Functions should be in CAPS

Separate functions with commas

Explanation:

5 0
3 years ago
Read 2 more answers
Which of these is NOT an example of lifelong learning?
oee [108]

Answer:

B. having lunch with a friend

Explanation:

Lifelong learning can be defined as a continuous, self-motivated, and self-initiated learning activity that is typically focused on personal or professional development. Thus, it's a form of education that is undertaken throughout life with the sole aim of pursuing knowledge, competencies, and skills for either personal or professional growth and development, especially after acquiring a formal education.

Some examples of lifelong learning includes the following;

I. Reading a trade magazine.

II. Reviewing a textbook.

III. Studying an encyclopedia.

7 0
2 years ago
2. You turn on your Windows 7 computer and see the system display POST messages. Then
Anton [14]
The monitor would definitely be the problem in this scenario.
7 0
3 years ago
Other questions:
  • reate a class called Plane, to implement the functionality of the Airline Reservation System. Write an application that uses the
    5·1 answer
  • Is it better to meet online or offline<br> (Please answer QUICK)<br><br> Thanks :')
    5·2 answers
  • Linux is: Select one: a. primarily concerned with the tasks of end users. b. designed for specific machines and specific micropr
    10·1 answer
  • Which type of error is a random error
    13·2 answers
  • Explain in a few sentences the difference between analytical papers and argumentative papers.
    8·2 answers
  • What provision of the Government Paperwork Elimination Act was designed to encourage a paperless society?
    6·2 answers
  • To exclude members of a group from the basic permissions for a folder, which type of permission would you assign? Deny Allow Mod
    13·1 answer
  • The __________ operator increases the value of the variable by 1 after the original value is used in the expression in which the
    7·1 answer
  • Demonstrate the register addressing mode for the following instructions. Also what addressing mode belongs to these instructions
    11·1 answer
  • All the network nodes are connected to each other
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!