Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Discuss the conceptual systems design process in the SDLC and the activities in this phase. (10 marks)


Write a program to implement the stack using an array and link list both.
Note: The code should have the modularity and should include following function apart from
main ():
 Push() This function inserts an element to top of the Stack.
 Pop() This function deletes an element from top of the Stack.
 Display() This function displays all the elements of the Stack by popping them one by
one.
Write a program to implement the following algorithm:
 Start with two indexes one at the left and other at the right end of the array.
 Left index simulate the first stack and second index simulate the right stack.
 If we want to put the element in the first stack then put the element at the left index.
Similarly, if we want to put the element in the second stack then put the element at the
right index.
 First stack grow towards left and second stack grow towards left.
A simple demonstration of dual stack can be observed from the following figure:
Stack A empty space stack B
1 2 3 4 [ ] [ ] [ ] 6 7 8 9
----> <-----
Entering elements Entering elements From this side From this side
Convert an infix expression to its equivalent postfix expression.
Note: The code should have the modularity and should include following functions apart from
main():
 getNextToken(): This functions returns the next token in the input infix expression. The
token may be an operator or “(“ or “)” or an operand. The operands can be of multiple
digits. For example the infix expression 1000/(10+240) contains operands 1000, 10, and
240.
 infixToPostfix(): Converts the input infix expression to postfix. This function calls
getNextToken() repeatedly to get the next token until it reaches the end. The token is
then processed depending on whether it is an operand or operator or ( or ).
Write a program to implement the stack using an array.
Note: The code should have the modularity and should include following function (
Create a class of subtraction having two private data members. Create class methods
to get data from users and for subtraction of data members. Use appropriate access
modifiers for class methods.
#include<iostream>
using namespace std;
class add //Specifies the class
{
private:
int iNum1, iNum2, iNum3; //Member data
public:
void input(int iVar1, int iVar2) //Member function
{
cout<<"Functions to assign values to the member data"<<endl;
iNum1=iVar1;
iNum2=iVar2;
}
void sum(void) //Member function
{
cout<<"Functions to find the sum of two numbers"<<endl;
iNum3=iNum1+iNum2;
}
void disp(void) //Member function
{
cout<<"The sum of the two numbers is "<<iNum3<<endl;
}
};
/////////main function of the program///////////
void main()
{
add A1;
int iX, iY;
cout<<"Input two numbers"<<endl;
cin>>iX;
cin>>iY;
A1.input(iX, iY);
A1.sum();
A1.disp();
system("pause");
}
Code the example given above and include a private constructor in the class. Create
objects of this class. Test the code and write down how the constructor will be called
or unable to be called?
#include<iostream>
using namespace std;
class add //Specifies the class
{
private:
int iNum1, iNum2, iNum3; //Member data
public:
void input(int iVar1, int iVar2) //Member function
{
cout<<"Functions to assign values to the member data"<<endl;
iNum1=iVar1;
iNum2=iVar2;
}
void sum(void) //Member function
{
cout<<"Functions to find the sum of two numbers"<<endl;
iNum3=iNum1+iNum2;
}
void disp(void) //Member function
{
cout<<"The sum of the two numbers is "<<iNum3<<endl;
}
};
/////////main function of the program///////////
void main()
{
add A1;
int iX, iY;
cout<<"Input two numbers"<<endl;
cin>>iX;
cin>>iY;
A1.input(iX, iY);
A1.sum();
A1.disp();
system("pause");
}
Code the example given above and check the errors if you try to access the private
data members in main() function.
Modify the above task by making the scope of public member functions as private.
Create access functions in public scope to access private member functions from
main().
#include<iostream>
using namespace std;
class add //Specifies the class
{
private:
int iNum1, iNum2, iNum3; //Member data
public:
void input(int iVar1, int iVar2) //Member function
{
cout<<"Functions to assign values to the member data"<<endl;
iNum1=iVar1;
iNum2=iVar2;
}
void sum(void) //Member function
{
cout<<"Functions to find the sum of two numbers"<<endl;
iNum3=iNum1+iNum2;
}
void disp(void) //Member function
{
cout<<"The sum of the two numbers is "<<iNum3<<endl;
}
};
/////////main function of the program///////////
void main()
{
add A1;
int iX, iY;
cout<<"Input two numbers"<<endl;
cin>>iX;
cin>>iY;
A1.input(iX, iY);
A1.sum();
A1.disp();
system("pause");
}
Code the example given above and check the errors if you try to access the private
data members in main() function.
Define a function hypotenuse that calculates the length of the hypotenuse of a right triangle when the other two sides are given. Use this function in a program to determine the length of the hypotenuse for each of the following triangles. The function takes two arguments of type double and return the hypotenuse as a double.
LATEST TUTORIALS
APPROVED BY CLIENTS