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
Rest or take a break every __ minutes when typing. Please help!
Talja [164]
Maybe like 3-5 I think im right
3 0
3 years ago
Read 2 more answers
What is the primary difference between 3g and 4g cellular systems? 4g systems have greater transmission speeds. 3g systems are u
noname [10]
I believe the correct answer is the first option. The primary difference between 3g and 4g cellular systems would be that 4g systems have faster transmission as compared to 3g. The G would mean generation. The very difference of both is their speeds.
4 0
3 years ago
House real estate summary Sites like Zillow get input about house prices from a database and provide nice summaries for readers.
Ksivusya [100]

Answer:

current_price = int(input("Enter the current price: "))

last_months_price = int(input("Enter the last month's price: "))

print("This house is $" + str(current_price))

print("The change is $" + str(current_price - last_months_price) + " since last month")

print("The estimated monthly mortgage is ${:.2f}".format((current_price * 0.051) / 12))

Explanation:

Ask the user to enter the current price and last month's price

Print the current price

Print the change in the price, subtract the last month's price from the current price

Print the estimated monthly mortgage, use the given formula to calculate, in required format

6 0
3 years ago
Samuel is working on decimal and binary conversion for his college project. He is using the binary number 111011 and wants to ex
Contact [7]
<span>1 X 25 + 1 X 24 + 1 X 23 + 0 X 22 + 1 X 21 + 1 X 20 thus your Answer is C</span>
4 0
2 years ago
Read 2 more answers
In a print statement, you can set the __________ argument to a space or empty string to stop the output from advancing to a new
jeka94

In a print statement, you can set the End argument to a space or empty string to stop the output from advancing to a new line.

<h3>What is a Print statement?</h3>

A print "statement" is known to be a kind of statement that looks like a call to the make (print) or println process of the System.

Note that In a print statement, you can set the End argument to a space or empty string to stop the output from advancing to a new line so that it can work properly.

Learn more about  print statement from

brainly.com/question/25220385

#SJ1

6 0
2 years ago
Other questions:
  • If the pc­doctor software is installed on a computer's hard drive, what two different ways can the program be started?
    7·1 answer
  • What is a step by step procedure written to carry out a task?
    11·1 answer
  • Help please brainliest
    8·1 answer
  • What is the top folder of the file tree called
    5·2 answers
  • In real-world environments, risks and their direct consequences will most likely span across several domains. However, in the la
    12·1 answer
  • Design and implement an application that reads a sequence of up to 25 pairs of names and postal (ZIP) codes for individuals. Sto
    9·1 answer
  • A web designer is creating a web site and wants each browser to resize the text size to look the same in each device. what measu
    6·1 answer
  • Calculate the maximal size of a file if we have:
    6·1 answer
  • Do you guys know if there's a way for me to find a Google doc that I typed but forgot to save if you do it for points i will rep
    10·2 answers
  • Customer history is an example of what
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!