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
Create an application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and th
crimeas [40]

Answer:

Explanation:

The following code is all written in Java, first I will add the object initialization and declaration code that can be added to the main method of any program. Then I have also written the entire SalesTransaction class as the question was not clear as to exactly which was needed.

//Object Creation to copy and paste into main method

SalesTransaction sale1 = new SalesTransaction("Gabriel", 25, 5);

SalesTransaction sale2 = new SalesTransaction("Daniela", 5);

SalesTransaction sale3 = new SalesTransaction("Jorge");

//SalesTransaction class with three constructors

package sample;

class SalesTransaction {

   String name;

   int salesAmount, commission;

   private int commissionRate;

   public SalesTransaction(String name, int salesAmount, int rate) {

       this.name = name;

       this.salesAmount = salesAmount;

       this.commissionRate = rate;

       commission = salesAmount * rate;

   }

   public SalesTransaction(String name, int salesAmount) {

       this.name = name;

       this.salesAmount = salesAmount;

       this.commissionRate = 0;

   }

   public SalesTransaction(String name) {

       this.name = name;

       this.salesAmount = 0;

       this.commissionRate = 0;

   }

}

8 0
3 years ago
shayne keeps his home office computer on his desk. he wants to use a wireless keyboard and mouse, and to send output to his prin
dexar [7]

Based on the information provided, a type of network which is best for Shayne is: PAN.

<h3>What is a PAN?</h3>

PAN is an abbreviation for personal area network and it can be defined as a type of telecommunication network that is designed and developed to cover a very short range of geographical locations (regions) such as buildings, home office, etc., especially for the purpose of establishing communication between different users that are resident within the same space or environment.

This ultimately implies that, personal area network (PAN) is a computer network that is designed and developed to only connect computers and network devices such as a wireless keyboard, scanner, printer, and mouse, that are within the range of an individual (person).

Read more on PAN here: brainly.com/question/14704303

#SPJ1

Complete Question:

Shayne keeps his home office computer on his desk. He wants to use a wireless keyboard and mouse, and to send output to his printer and receive input from his scanner wirelessly. Which type of network is best for Shayne?

WAN

PAN

MAN

LAN

7 0
2 years ago
1.in 3 sentences explain briefly what are the examples of the advantage of using multimedia approach in a slide presentation bra
Fiesta28 [93]
Here’s what i found online when researching this for a different question...
approach the question in a similar way to how this is written but add your own words :)
hope this helps

6 0
3 years ago
Distancelearning has got a boost due to the ___________.
Alona [7]

Answer: All of the above

Explanation: Distance learning which is also known as distance education/online learning  in which the education is provided via online lectures, online classes or e-learning .Students are provided recording of the lectures or online tutoring is given.This learning is helpful to many people who having issues like can only study in weekend, can study only after work/job,etc.

This is a flexible way of providing education and communication is also easy in it as the student can watch the video lecture whenever they want.The content of the lecture is also interactive so that student can understand it easily and no doubts arise.

5 0
4 years ago
Is a system software that manages the hardware resources and provides services 5o the application software
Alborosie

Answer:

"Operating system" is the right response.

Explanation:

  • The key program collection on something like a computer device that maintains it interacts mostly with underlying hardware of that system is considered as an Operating system.
  • Even without the need for an OS, every consumer isn't able to access either equipment, monitor as well as portable phone or devices.
8 0
3 years ago
Other questions:
  • ASAP
    12·1 answer
  • before donating a computer you should use a program to wipe the hardest to remove all of his data true or false
    6·1 answer
  • The leader of the team wants to do everything him or herself. They have a very big ego and are difficult to work with. What is t
    14·1 answer
  • Eric’s computer slows down when he open several computer programs. Why does this happen?
    15·2 answers
  • What is Identity Theft?
    8·1 answer
  • Does anyone know how to fix this? Everytime i make a new page it only types in the middle of the page. I want to type at the top
    11·1 answer
  • How are status reports useful
    6·1 answer
  • You are asked to write a program that prompts the user for the size of two integer arrays, user input for the size must not exce
    13·1 answer
  • Explain the risks to privacy from collecting and storing personal data on computer systems and the programmer’s role to safeguar
    11·1 answer
  • What type of html list will automatically place a list marker, or bullet point, indicator in front of each item? group of answer
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!