Write a C++ program to define an abstract class in polymorphism?

Answers

Answer 1

Answer:

Following are the program to this question:

#include <iostream>//header file

using namespace std;//namespace

class Val //defining abstract class

{

  public://use access specifier

     virtual int squ()=0;//declaring a method squ  

     void setval(int x) //defining a method setval

     {

        a=x;//holding value in a variable

     }

  protected://use access specifier

     int a;//defining integer variable

};

class square: public Val //defining a class square that inherit abstract class

{

  public://use access specifier

   int squ() //defining squ method

   {  

   return (a*a); //return square value

   }

};

int main() //main method

{

 square s;//creating class object

 s.setval(5);//calling setval method

 cout << "The square value is: " << s.squ() << endl;//print value by calling squ method

}

Output:

The square value is: 25

Explanation:

In the above code a two-class "Val and square" is declared, in which val is abstract class, in a method squ is declared, and setval is used to set the value.

In the next step, the square class inherits Val and defines the squ method, and uses the return keyword to return its calculated value.

In the main method square class object is created and set the setval value and call the squ method and print its value.    


Related Questions

Where can a client identify the instant deposit options for their QuickBooks Payments account?

Deposits tab
Account and Settings
Invoices tab
Create Invoice screen
Banking Center

Answers

Answer:

Banking centre

.

.

..

.

.

.

.

.

.

.

what command in cisco IOS allows the user to see the routing table

Answers

Answer:

Show IP route command

Explanation:

what is output? x=-2 y=-3 print (x*y+2)

Answers

Answer:

=8

Aaaaaaaaaansjxjdjsaaaaaaa

Explanation:

-2*-3=6+2=8

A hacker posing as a potential customer has connected to your network and has discovered that a server running Windows Server has a configuration that a misconfiguration on a Windows Server that exposes the PowerShell prompt. The hacker executes a script to log valuable information about the server. Which vulnerabilities did the hacker exploit

Answers

Answer:

Lack of ips

Insecure configuration

Explanation:

Lack of IPS

This is fully known as intrusion prevention softwares this works by enabling the firewall and protecting the computer system from unauthorised users and potential attackers and it prevents data from being stolen by identifying potential attacks. It monitors the network continuously, thereby looking for possible malicious threats and also capturing informations about these threats.

Insecure configuration

Obviously if you have power shell enabled then you would have a secure configuration. Attackers can easily access your system in the presence of this flaw.

What are differences between manual formatting and formatting in word
processor?​

Answers

Answer:-

Editing refers to making quick modification to a document using editing tools such as find and replace spelling and grammar checkers,copy and paste or undo redo features. Formatting refers to changing the appearance of text in a document such as text formatting or page formatting or paragraph formatting.

What is the main advantage that a website builder offers for web development?

OA. It enables people with no coding skills to create websites.
OB. It allows developers to debug the code on your website.
OC. It allows developers to adjust the finer details more easily than an IDE does.
OD. It provides tools such as a resource manager and interpreter.

Answers

The correct answer is: OA. It enables people with no coding skills to create websites.

Answer: A

It enables people with no coding skills to create websites.

Explanation:

Write a program that prompts the user to input a string and outputs the string in uppercase letters. (Use a character array to store the string.)

Answers

Answer:

Explanation:

The following code is written in Java. It asks the user for a string/sentence and then grabs every character in the string, capitalizes it, and saves it in a char ArrayList. Then it concatenates the char array into a String variable called output and prints the capitalized String.

public static void capitalizeMe() {

               Scanner in = new Scanner(System.in);

               System.out.println("Enter a String:");

               String inputSentence = in.nextLine();

               ArrayList<Character> capitalString = new ArrayList<Character>();

               for (int x = 0; x < inputSentence.length(); x++) {

                       capitalString.add(Character.toUpperCase(inputSentence.charAt(x)));

               }

               String output = "";

               for (char x: capitalString) {

                       output += x;

               }

               System.out.println(output);

       }

Please!! I need help, this is due by tonight!!!

Answers

Answer:

sorry if it is too late but I think it is d

Explanation:

what is the full form of ARPANet, WAN,FTP,DCP,HTML,ISP and last WWW​

Answers

Advanced Research Projects Agency Network,

wide area network

File Transfer Protocol

?

Hypertext Markup Language

Internet service provider

world wide web

ARPANET — Advanced Research Projects Agency Network

WAN — Wide Area Network

FTP — File Transfer Protocol

DCP — Diploma Computer Programming

HTML — Hyper Text Markup Language

ISP — Internet Service Provider

www — World Wide Web

HOPE IT HELPS

PLEASE MARK ME BRAINLIEST ☺️

computer is an electronic machine that is used for data processing to produce meaningful information explain in statement​

Answers

A computer is an electronic machine that processes raw data to give information as output. An electronic device that accepts data as input, and transforms it under the influence of a set of special instructions called Programs, to produce the desired output (referred to as Information.) hope This helps!

What is Memory Card? Explain?​

Answers

A memory card is basically a card that holds memory. The card can be removed at anytime and put into any other device. It is mainly used for extra storage and to transport videos, pictures, etc. to other devices

Hope this helps.   : )

What two solutions address lack of human access to clean water

Answers

Answer:

THREE strategies which local municipality is implementing in addressing the issue of lack of clean water caused by human factors include:

1) Increasing the amount of tax for those companies which are opening their wastes into water sources which can help built better water cleaning and recycle system.

2) Tree plantation is another strategy to help secure the water sources and naturally keep cleaning it.

3) Running awareness campaigns for general people to keep the water sources clean as well as use the only amount of water which they need and not waste it.

Explanation:

i hope this helps you

Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in a program that takes two integer inputs, and outputs the largest magnitude value. Ex: If the inputs are: 5 7 the function returns: 7 Ex: If the inputs are: -8 -2 the function returns: -8 Note: The function does not just return the largest value, which for -8 -2 would be -2. Though not necessary, you may use the built-in absolute value function to determine the max magnitude, but you must still output the input number (Ex: Output -8, not 8). Your program must define and call the following function:

Answers

Answer:

The question is answered in python

def max_magnitude(a,b):

   if abs(a) > abs(b):

       return a

   else:

       return b

       

num1 = int(input("Num 1: "))

num2 = int(input("Num 2: "))

print(max_magnitude(num1,num2))

Explanation:

This question is answered using the concept of absolute value to get the integer with the highest magnitude

First, the function is defined with integer parameters a and b

def max_magnitude(a,b):

This checks if a has the highest magnitude

   if abs(a) > abs(b):

If true, it returns a

       return a

If otherwise, it returns b

   else:

       return b

       

The main starts here

The next two lines prompt the user for inputs

num1 = int(input("Num 1: "))

num2 = int(input("Num 2: "))

This calls the function

print(max_magnitude(num1,num2))

Explain the concept of Informed Consent?

Answers

Informed consent is a process of communication between you and your health care provider that often leads to agreement or permission for care, treatment, or services. Evey patient has the right to get information and ask questions before procedures and treatments.

What is Code?
A) Rules of conduct
B) One or more commands designed to be carried out by a computer.
C) A pack between friends.
D) Edoc spelled backwords.

Answers

Answer:

In a class of statistics course, there are 50 students, of which 15 students  scored B, 25 students scored C and 10 students scored F. If a student is chosen at random from the class, what is the probability of scoring

not F?

Explanation:

Answer:

its b it's like opening multiple tabs

In the program below, which variable has the same scope as strA?

def usernameMaker (strFirst, strLast):
return strFirst + strLast[0]

def passwordMaker (strA, numC):
if len(strA) > 4:
answer = dogName[0:3]
return answer + str(numC)
else:
return 'xk&' + str(numC)

Answers

Answer:

" numC " is the correct answer

Explanation:

The reason is that on line 3 of code it has "def passwordMaker (strA, numC):"

strA and numC are both in "( )" which is the scope and only things inside are varibles. Also its the only line that has  strA in it.

The scope of a variable is the extent at which the variable can be referenced.

The variable with the same scope as strA is variable numC

From the program, we have the following function definition

def passwordMaker (strA, numC):

Variables strA and numC are declared along with the function passwordMaker

This means that:

Variables strA and numC have the same scope

Hence, the variable with the same scope as strA is variable numC

Read more about scopes of variables at:

https://brainly.com/question/17102008

Calculate the heat energy required to raise the temperature of 5 kg of water from 20℃ to

40℃. Specific heat capacity of water is 4200 J kg-1 k-1​

Answers

Given that,

Mass of water, m = 5 kg

The temperature increases from 20℃ to  40℃.

Specific heat capacity of water is 4200 J kg⁻¹ k⁻¹

To find,

Heat energy required to raise the temperature.

Solution,

The formula for the heat energy required to raise the temperature is given by :

[tex]Q=mc\Delta T\\\\=5\times 4200\times (40-20)\\\\=420000\ J\\\\=420\ kJ[/tex]

So, the heat energy required is 420 kJ.

A(n) ___________________ is a set of characters that the originator of the data uses to encrypt the text and the recipient of the data uses to decrypt the text. (230)Group of answer choices

Answers

Answer:

The appropriate response will be "Public key".

Explanation:

A public key would be created in something like such key encryption cryptography consisting incorporates asymmetric encryption of the keys algorithms. Those same keys have been utilized to transform a document to even such an unintelligible form. Decryption consists done using only a separate, however corresponding, secret address or private key.

As per the scenario, a Public key would be the set of such characters.

A public key would have been generated using cryptographic protocols or the techniques, which contains asymmetric keyword encrypted methods.These very same keys were being used to convert a memorandum or manuscript to such an unintelligible state. Decryption has always been accomplished solely through the use of a completely separate, but associated, highly classified address and otherwise key.

Thus the above response is correct.

Learn more:

https://brainly.com/question/20709892


A browser is an example of a. :
general-purpose application
specialized
program
system application
utility program​

Answers

a browser is an example of a system application

Rosa is building a website for a multimedia company. She wants to add a drop-down menu functionality to the website's main page. Which
markup language or technology will allow Rosa to add this element?

OA. HTML
OB. Semantic HTML
OC. DHTML
OD. XML

Answers

The answer is: OC: DHTM
Explanation: PLATOLIVESMATTER

Answer:

The correct answer is C. DHTML.

Explanation:

I got it right on the Edmentum test.

i want to touch it but if i talked about the past , it would be i wanted to touch it or i wanted to touched it?​

Answers

Answer:

I wanted to touch it

Explanation:

since you put the setting in the past you can use present verbs because we already know it's something that already happened

write instruction to recharge mobile phone ​

Answers

1) Grab Charger
2) Plug Charger into wall outlet
3) grab your phone
4) grab cord connected to charger
5) plug end of cord into the charger port of your phone
6) wait for phone to charge

*phone will give you a notification when it’s charging and when done*

These are some instructions to recharge a mobile phone:

You need to have a phone charger.Connect your phone charger to your phone.Then connect it to the electricity.Wait for the mobile phone to charge fully.Disconnect your phone from the phone charger and the electricity.

How do you give instructions?

In this exercise, you have to give instructions to charge a mobile phone.

When you have to give instructions it is helpful to explain every action using a specific order so it is easier for the other person to understand the instructions.

Check more information about mobile phones here https://brainly.com/question/9447658

________ reveals functional requirements regarding the exchange of data and services between systems.
a. Observations
b. User interface analysis
c. Document analysis
d. System interface analysis

Answers

The answer to this question is b

Which type(s) of license(s) allow the underlying software code to be viewed?

a. Freeware
b. Free software

Answers

Answer:

The correct answer is B. Free software.

Explanation:

Free software is a term used for software that the holder can use, copy, read, modify and distribute with or without modification at will. Software that falls under this category includes software that is not protected by copyright laws or software that is licensed to be used in this way.

Motives for developing free software can be technical, economic or social. What is significant for developers is the desire to develop as producers of programs by learning from other producers. The desire to help others is also a major motive.

If you have a line that is 2.5 inches in decimal, what is that in fraction form?

2 5/16 inches

2 1/4 inches

2 3/4 inches

2 1/2 inches

If you are asked to measure 9/16th on a ruler how many lines would you have to count?

Answers

Answer: 2 1/2 inches; 9 lines

Explanation:

If one has a line that is 2.5 inches in decimal, this in fraction form will be written as:

= 2.5 inches = 2 5/10 inches.

When we reduce 5/10 to its lowest term, this will be 1/2. Therefore 2.5 inches = 2 1/2 inches.

Since each mark on a ruler is 1/16, therefore 9/16 will be (9/16 ÷ 1/16) = (9/16 × 16/1) = 9 lines

Leo needs to consolidate data in multiple worksheets by performing a calculation across all worksheets on the same cells.
Which feature should he use to perform this task?
A) data consolidation
B) 3-D reference
C) grouped cells
D) linked cells

Answers

A do you think is the answer

Answer:

3-D reference

Explanation:

Edge 2022

What will be result of below if statement.
if (Grade >= 90)
puts("A");

What’s the answer?

Answers

Explanation:

pls check it ur answer hp u understand this

Write a program that can be used to calculate the federal tax. The tax is calculated as follows: For single people, the standard exemption is $4,000; for married people, the standard exemption is $7,000. A person can also put up to 6% of his or her gross income in a pension plan. The tax rates are as follows: If the taxable income is:

Between $0 and $15,000, the tax rate is 15%.
Between $15,001 and $40,000, the tax is $2,250 plus 25% of the taxable income over $15,000.
Over $40,000, the tax is $8,460 plus 35% of the taxable income over $40,000. Prompt the user to enter the following information:
Marital status
If the marital status is “married,” ask for the number of children under the age of 14
Gross salary (If the marital status is “married” and both spouses have income, enter the combined salary.)
Percentage of gross income contributed to a pension fund Your program must consist of at least the following functions:
Function getData: This function asks the user to enter the relevant data.
Function taxAmount: This function computes and returns the tax owed.

To calculate the taxable income, subtract the sum of the standard exemption, the amount contributed to a pension plan, and the personal exemption, which is $1,500 per person. (Note that if a married couple has two children under the age of 14, then the personal exemption is $1,500 ∗ 4 = $6,000.)

Since your program handles currency, make sure to use a data type that can store decimals with a decimal precision of 2.

Answers

Answer:

?

Explanation:

You can ask for helps on sites meant specifically for coding like cpphelp and stackoverflow

y'+2y = 5-e^(-4x), y(0)=-11

Use Euler's Method with a step size of h = 0.1 to find approximate values of the solution as x= 0.1, 0.2, 0.3, 0.4, and 0.5. Compare them to the exact values of the solution at these points.

Answers

Answer:

  see attached

Explanation:

A differential equation solver says the exact solution is ...

  y = 5/2 -14e^(-2x) +1/2e^(-4x)

The y-values computed by Euler's method will be ...

  y = ∆x·y' = 0.1(5 - e^(-4x) -2y)

The attached table performs these computations and compares the result. The "difference" is the approximate value minus the exact value. (When the step size is decreased by a factor of 10, the difference over the same interval is decreased by about that same factor.)

Which file extension indicates a text document? .ppt .tst .pdf .txt

Answers

Answer:

The answer is .txt

Explanation:

Answer:

.txt

Explanation:

odesseyware 2021

Other Questions
Financial intermediaries are A. the same as financial markets. B. individuals who make profits by buying a stock low and selling it high. C. a more general name for financial assets such as stocks, bonds, and checking accounts. D. financial institutions through which savers can indirectly provide funds to borrowers. 3. Two people are playing tug of war. One person pulls to the right with 32 N of force. The other person pulls to the left with 37 N of force. How strong is the net force and in which direction? Can someone explain this to me please? Why does Orwell compare the animals to slaves? What literary device is used? -1. What kind of energy does the Earth receive directly from the Sun?A. The Earth directly receives both heat and light energy from the SunB. The Earth directly receives only heat energy from the SunC. The Earth directly receives only light energy from the SunD. The Earth directly receives only visible light energy from the Sun Summarive at least 3 elements of an ideal tragedy, as described by Aristotle. Pioneers who crossed the Sierra Nevada mountains in the mid-1800s were threatened byexposure to too much sun.Apache and Comanche attacks.snow and freezing temperatures.slow travel across sand. A solar-powered car has a kinetic energy of 110250 J. Its mass is 180 kg. Work out how fast the car is travelling. You and your buddy are scuba diving and notice that air bubbles triple in volume as they rise to the surface from where you are in the ocean. Ignoring any temperature changes, how far below the surface of the water (in m) are you when these bubbles are released Assume that you are an intern with the Brayton Company, and you have collected the following data: The yield on the company's outstanding bonds is 7.75%; its tax rate is 40% and bond flotation cost is immaterial. The expected dividend on the company's common stock to be paid one year form today is $0.65 a share; the dividend is expected to grow at a constant rate of 6.00% a year; the price of the stock is $15.00 per share; the flotation cost for selling new shares is F Please help me im very depressed and im struggling a lot on my math and i really need some answersWhich sequence shows the numbers in order from least to greatest? Mr.Williams' physical education class lasts 7/8 hours. How many minutes are not spent on instructions? playing game:1/2, instructions: 1/5, warm up and cool down:3/10 A balloon tied up with a wooden piece is moving upward with velocity of 15m/s. At a height of 300m above the ground, the wooden block detached from the balloon. How much time will it take to reach the ground? How much heat is required to raise the temperature of a 175 g piece of aluminum from 37.0 oC to 92.0 oC? Which of the following makes sense to round to the nearest 10?A. Your friend's telephone numberB. The PIN code of your city or townC. The number of pages in your Maths bookD.t he year of your birth which policy did the british government use to govern the american colonies prior to the french and indian war? A college cafeteria pays student cashiers $540 per hour. Cashiers earn an additional$110 per hour for each hour worked over 35 hours per week. A cashier worked 39hours one week and 37 hours the second -week. Show and explain to the cashier how her salarywould be calculated in this two-week period? a mutation in which type of cell would only affect the organism and not future generation Which is the following is an example of an oxymoron At a school 1/2 of the pupils walk to school.2/5 of the pupils get the bus.The remaining 68 pupils get a lift in a car.Calculate the number of pupils who get the bus and who walk to school.