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
maria [59]
3 years ago
11

Provide a class Letter for authoring a simple letter. In the constructor, supply the names of the sender and the recipient: def

__init__(self, letterFrom, letterTo) Supply a method
Computers and Technology
1 answer:
STatiana [176]3 years ago
4 0

Answer:

class Letter:

   header="Dear "

   footer="Sincerely, \n"

   text=""

   def __init__(self,letterFrom,letterTo):

       self.header+=letterTo + ":\n\n"

       self.footer+=letterFrom + "\n"

   

   def getText(self):

       return self.header+self.text+self.footer

   def addLine(self,line):

       self.text+=line+"\n\n"

l = Letter("Cain", "Abel")

l.addLine("I am very happy to be writing to you at this joyful moment of my life.")

I.addLine("I am really sorry i killed you, I was a saddist back then.")

print(l.getText())

Explanation:

The Letter class a used to write a letter. The magic method "__init__" is used as a constructor to accept the sender and the recipient of the letter. The addLine method is called on an instance of the class to add string lines to the object while the getText method returns the entire written letter.

You might be interested in
Main function of Ubuntu
Lynna [10]

Answer:

Ubuntu includes thousands of pieces of software, starting with the Linux kernel version 5.4 and GNOME 3.28, and covering every standard desktop application from word processing and spreadsheet applications to internet access applications, web server software, email software, programming languages and tools

Explanation:

5 0
3 years ago
Read 2 more answers
A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a fi
neonofarm [45]

Answer:

Python file with appropriate comments given below

Explanation:

#Take the input file name

filename=input('Enter the input file name: ')

#Open the input file

inputFile = open(filename,"r+")

#Define the dictionary.

list={}

#Read and split the file using for loop

for word in inputFile.read().split():

  #Check the word to be or not in file.

  if word not in list:

     list[word] = 1

  #increment by 1

  else:

     list[word] += 1

#Close the file.

inputFile.close();

#print a line

print();

#The word are sorted as per their ASCII value.

fori in sorted(list):

  #print the unique words and their

  #frequencies in alphabetical order.

  print("{0} {1} ".format(i, list[i]));

3 0
4 years ago
What are three different reasons why people access networks? <br> Give an example of each reason
denpristay [2]

Communication: Communication is one way to be connected to the network and use the internet. It helps maintains communication with other network users. A few examples include email, IM services, video conferencing, Skype and many more.

File sharing: Easily sharing files and data. From businesses to schools to friends, everyone sends files to through internet and this has become an essential part of life. Various services like Gmail and yahoo mail are used.

Social networking: This is an essential medium to communicate with friends and family members. Examples include Facebook, Twitter, and Instagram.






3 0
4 years ago
ABC Resort and Hotel has approached you to write a program to keep track of the number of rooms needed for an event. Customers c
nexus9112 [7]

Answer:

Check the explanation

Explanation:

/ Pseudocode for tracking the reservation of rooms for an event

Declaration

 

  string roomInput;

  string roomNames[4];

  number roomPrice[4];

  number roomCount[4];

  number i;

  boolean roomFound;

  number totalRevenue, avgRevenue;

  number totalRoomsNeeded;

Start

 

  // initialize the room names, and price for each room

  // array index starts from 0 and goes to n-1 where n is the total number of elements in the array

  roomNames[0] = "Single";

  roomNames[1] = "Single Deluxe";

  roomNames[2] = "Double";

  roomNames[3] = "Double Deluxe";

 

  roomPrice[0] = 79.95;

  roomPrice[1] = 99.95;

  roomPrice[2] = 149.95;

  roomPrice[3] = 179.95;

 

  // initialize each room count to 0 at the start

  for(i=0;i<4;i++)

  do

      roomCount[i] = 0;

  end for  

 

  // input the room type, user should type exit to indicate they are done

  Display "Enter room type ('exit' to quit ) : ";

  Input roomInput;

 

  // loop that continues till user types quit

  while(roomInput != "quit")

  do  

      roomFound = false;

      // loop to determine if user input is valid and increment the associated room count

      for(i=0;i<4;i++)

      do

          if(roomNames[i] == roomInput) then

              roomCount[i] = roomCount[i] + 1;

              roomFound = true;

          end if

      end for

     

      // if invalid room type, display error

      if(roomFound == false) then

          Display "Invalid input for Room type. Room type can be Single or Single Deluxe or Double or Double Deluxe ";

      end if  

     

      Display "Enter room type ('exit' to quit ) : ";

      Input roomInput;

  end while

 

  // set totalRevenue and totalRoomsNeeded to 0

  totalRevenue = 0;

  totalRoomsNeeded = 0;

  Display("Room Type Price($) Rooms Needed");

  // loop to display each room type details and calculate the totalRevenue and totalRoomsNeeded

  for(i=0;i<4;i++)

  do

      Display(roomNames[i],roomPrice[i],roomCount[i])

      totalRevenue = totalRevenue + (roomPrice[i]*roomCount[i]);

      totalRoomsNeeded = totalRoomsNeeded + roomCount[i];

  end for  

 

  // calculate average revenue

  if(totalRoomsNeeded > 0) then

      avgRevenue = totalRevenue/totalRoomsNeeded;

  else

      avgRevenue = 0;

  end if

 

  // display the total revenue and average revenue

  Display("Total revenue from all rooms : $",totalRevenue);

  Display("Average revenue from a room : $",avgRevenue);

 

End  

//end of pseudocode

5 0
3 years ago
What’s considered the brain of a computer?
Colt1911 [192]

Answer: The computer brain is a microprocessor called the central processing unit (CPU).

Explanation:

The CPU is a chip containing millions of tiny transistors. It's the CPU's job to perform the calculations necessary to make the computer work -- the transistors in the CPU manipulate the data.

5 0
4 years ago
Read 2 more answers
Other questions:
  • Your friend is working on fixing their Homework assignment. They need a lot of help. You know all the bugs in the file, but due
    12·1 answer
  • For a set of integers stored in an array,calculate the sum of the positive numbers and the sum of the negative numbers. The prog
    10·1 answer
  • An interstate route with even numbers travels north/south. True or false?
    6·2 answers
  • Which one of the following words means most nearly the opposite of RANDOM? (remember,opposite)
    12·1 answer
  • Define and discuss statistical significance as it pertains to web analytics, formulate your own opinions of what this means. in
    8·1 answer
  • Which of the following is an object such as a field which can be inserted into a document
    7·1 answer
  • A heart murmur is caused by incorrect operation of ________?​
    7·1 answer
  • Ok it is important aspects which is perfect
    10·1 answer
  • 8.10.8 guess the passcode codehs
    8·1 answer
  • Which statement best describes one reason why assembly language is easier
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!