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
notka56 [123]
3 years ago
13

Write the implementation of a class Cse20 Topic that represents a topic in the cse20 class. The class should implement the init

function, getters, and override the str and add functions.
Computers and Technology
1 answer:
Kay [80]3 years ago
8 0

Answer:

class Cse20_topic:

   def __init__(self, title, length):

       self.title = title

       self.length = length

   def get_length(self):

       return self.length

   def get_title(self):

       return self.title

   def get_length_in_days(self):

       return self.length*7

   def __str__(self):

       return f'Title: {self.title}, length: {self.length}'

   def __add__(self, other):

       return self.length+other.length

Explanation:

The python program above defines the class Cse20 which is used to create a topic ( instance of the Cse20 object). The getter methods like the get_lenght, get_title and get_length_in_days return the length of a topic object, the title of the topic and the topic length in days respectively while the __str__ and __add__ methods overrides the string object and addition of topic length respectively.

You might be interested in
Computer-aided design software is used primarily by:
guapka [62]
Is used primarily by Students and Engineers.
4 0
4 years ago
What kind of battery does a dji spark have?
shutvik [7]
Lithium-Ion Battery. The same kind of battery found in smartphones, laptops, etc.
6 0
4 years ago
How would you write out the Python code to PRINT the answer to 5 times 2?
Gwar [14]

I dont this this is the place to ask

6 0
2 years ago
The elements of an integer-valued array can be set to 0 (i.e., the array can be cleared) recursively as follows: An array of siz
dangina [55]

Answer:

The method definition to this question can be given as:

Method definition:

public void clear(int[] arr, int num) //define method clear.

{

   if (num == 0) //if block

{

       return 0;  return value.

}

else //else block

{

 arr[num - 1] = 0; //assign value in arr.

return arr[];  //return value.

}

}

clear(arr, num - 1);   //calling

Explanation:

The description of the above method definition as follows:

  • Firstly we define a method that is "clear" that does not return any value because its return type is "void". This method accepts two integer variables that are "arr[] and num" where arr[] is an array variable and num is an integer variable.
  • Inside a method, we use a conditional statement in if block we check that num variable value is equal to 0. if this condition is true so, it will return 0 otherwise it will go to else block in else block it will assign value in variable arr[num-1] that is "0" and return arr value.

4 0
4 years ago
To rehearse giving a PowerPoint presentation, Hema would like to print out the presentation with all of the speaker notes. Hema
seraphim [82]

From the given case in the question, Hema would prefer having a handout document for the audience that does not include the slide dates, which are included in her printed notes for the presentation.

To do this, Hema would need to execute option (D) View → Notes and Handouts → Header & Footer → Date and time → Fixed.

This is because the option to modify dates for handouts and notes are in the View tab, not on the insert Tab.

8 0
4 years ago
Other questions:
  • Application partitioning gives developers the opportunity to write application code that can later be placed on either a client
    7·1 answer
  • Why do we need IP Addresses in order for the Internet to function properly?
    7·1 answer
  • Select the education and qualifications that are most helpful for Insurance Services careers. Check all that apply.
    14·2 answers
  • Describe the cutting-edge program that is referred to as agile
    5·1 answer
  • What can a user modify on a business card using the Edit Business card in the dialog box?​
    8·1 answer
  • 2. How much did John Jones have in his account on the first day of the
    5·1 answer
  • Most widely used insulator for splices of smaller wires
    13·1 answer
  • How easily can teachers see browsing history on chromebook]
    9·1 answer
  • Why is translator required ​
    11·1 answer
  • What does playstation network is currently undergoing maintenance?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!