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
Karo-lina-s [1.5K]
3 years ago
9

Write a class named Add that has the following data members, constructor, and methods:

Computers and Technology
1 answer:
taurus [48]3 years ago
7 0

Answer:

A class is like a blueprint of object.

Explanation:

A class defines the kinds of data and the functionality their objects will have.

A class enables you to create your own custom types by grouping together variables of other types, methods and events.

In C#, we can create a class  using the class keyword.

Here's a sample program:

using System;

namespace ConsoleApplication

{

   public class Test

   {

       public static void Main()

       {

           Add a1 = new Add(70, 50);

           a1.AddNumbers();                    

           Console.ReadLine();

       }      

   }

     class Add

   {

       private int row;

       private int column;

       public Add(int r, int c)

       {

           row = r;

           column = c;

       }

       public void AddNumbers()

       {

           Console.WriteLine(row+column);

       }

   }

}

output: 120

Explanation of the program:

I have created a class named Add. Within a class, row and column are two fields and AddNumbers() is a method. We also have constructor to initialize row and column.

In main method, If I need to invoke members of the class, I must create  an instance of the class. We can create any number of instances using the single class.IN our program, a1 is the reference variable using which we can invoke members of the class. I invoked function in the class and passed arguments to the constructor while creating an instance.

Those values are assigned to method variables and it operated the addition. Thus the output is 120.

You might be interested in
This graph shows a relationship between the height of a giraffe and its weight which term describe the dashed line through the g
Nadusha1986 [10]

Answer: The Answer is C

Explanation: This is because It is mainly controlled by genetics and we can not manipulate genetics.

4 0
4 years ago
Read 2 more answers
I need help. People who know computer science. I have selected a word from the first 1000 words in my dictionary. Using the bina
Rudiy27

Answer:

14

Explanation:

8 0
3 years ago
Which one of these is NOT a type of printer
rusak2 [61]

Answer:

electric

Explanation:

eletric is not a print ouo

4 0
3 years ago
Read 2 more answers
A(n) ________ is software and/or hardware that monitors system and network resources and activities and notifies network securit
enyata [817]

Answer:

intrusion detection system

Explanation:

intrusion detection system

IDS or the intrusion detection system is the software and/or hardware system which can be used to monitor for detecting suspicious network activities and monitoring the system and notifying teams when there are attempts to break the secure network infrastructure.

5 0
4 years ago
What is the difference between a queue and a stack?
Zinaida [17]

Answer:

Difference between Queue and Stack are as following:-

  1. Queue is a FIFO(First In First Out) type data structure while Stack is a LIFO(Last In First Out) type data structure.
  2. The insertion and deletion of elements from the queue happens from two ends insertion at the tail and deletion from the front.While the insertion and deletion from stack happens from one end only that is top.
  3. The insertion and deletion operation in queue are referred as enqueue and dequeue. While in stack they are referred as push and pop respectively.
7 0
3 years ago
Other questions:
  • _____ involves those activities that ensure the orderly dissolution of a system, including disposing of all equipment in an envi
    7·1 answer
  • What is a basic operation of computers
    13·1 answer
  • Trish has bought a new computer that she plans to start working on after a week. Since Trish has not used computers in the past,
    10·1 answer
  • Constructors have the same name as the ____.1. data members2. member methods3. class4. package
    5·1 answer
  • 2. (8 points) When creating the Academic Database, there were several instances of data
    11·1 answer
  • Which of the following is an accurate definition of a computer system? A computer system consists of the operating system that t
    6·1 answer
  • You work for a company that builds custom PCs for select clients. You are training a new employee to evaluate and select appropr
    13·1 answer
  • One lap around a standard high-school running track is exactly 0.25 miles. Write the function miles_to_laps() that takes a numbe
    8·1 answer
  • Write an algorithm to find perimeter of circle<br>​
    12·1 answer
  • __________ implements a security policy that specifies who or what may have access to each specific system resource and the type
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!