Task 1
Solve this problem using stacks, Implementation other than stack will leads to zero
marks
Write a class ex_conversion in C++ to evaluate postfix expressions. You will have to
implement following methods.
1. InputEx – will let the user enter the postfix expression in character array to
be evaluated.
Enter the expression: abc*+d-
2. ReadVar – will read the values of variables a,b,c,d . . . z from file (“data.txt”)
and return true on successful read.
10 20 30 40 50 60 . . . 26
3. EvaluateEx – will evaluate the expression and return the answer or display
the error message.
Sort the data stored in 1) stack 2) queue and 3) linked list entered in part 1 (using arrays)
In this assignment is to simulate an ATM machine. Program should able to do the following
operations:
A. Create accounts for the users. A user account is created using User ID and
Password. Every user has unique User ID and Password.
B. A user should able to login using his User ID and Password.
C. A user can quit the program.
D. Provision to Delete a User
Initially there are no users. There program should prompt for the following option:
1) New Account,
2) Login,
3) Quit and
4) Delete an Account
Depending upon the option selected necessary action to be taken. New Account option adds a
user account. When a user is added then the total number of users is increased by one. For
successful Login option user will be able to do the following:
a) Withdraw money,
b) Deposit money, and
c) Request balance,
Given an array of integers, find the one that appears an odd number of times.
There will always be only one integer that appears an odd number of times.
n = int(input())
polinom_a =[0 for item in range(n)] for item in range(n):
p, c = input().split(' ')
polinom_a[int(p)] = int(c)
m = int(input())
polinom_b =[0 for item in range(m)]
for item in range(m):
p, c = input().split(' ')
polinom_b[int(p)] = int(c)
pol_max , pol_min = polinom_a , polinom_b
if len(pol_min) > len(pol_max):
pol_max , pol_min = polinom_b , polinom_a
for item in range(len(pol_min)):
pol_max[item] += pol_min[item]
for item in range(len(pol_max)-1,0,-1):
if item == 0:
continue
print (f'{pol_max[item]}x^{item} + ',end='')
print(pol_max[0])
ouput:6x^3 + 14x^2 + 2x^1 + 6
the ouput should be like this:6x^3 + 14x^2 + 2x + 6
after adding two polynomials when we get "0" as output and it should print output as:"0"so,please can anyone make correct code?
ATM machine. Program should able to do the gvn operations:
A.users can Creat acc using UserID and Password with unique data entry everytime.
B.user must able to login using UserID and Password.
C.user can quit the program.
D.Provision to Delete a User
Initially zero users.on selecting opt.New Account opt adds a user account. When a user is added then the total number of users is increased by 1. For successful Login opt user will be able to do:a)Withdraw money, b)Deposit money,(c)Request balance,For unsuccessful Login,the program displays “Login error,try again" and prompts the initial four opts.When a Dlt an Acc opt is selected,the program prompts for: User ID,Password to be dletd.On dletng a user the no. of users is reduced by 1.Quit opt terminates the program.The program to run infinitely until a user quits the program.The program able to display when requested for:(i)No.of users and Total deposit,(ii)Deposit for Gvn User ID,(iii)Transaction Detls for a Gvn User ID,wap using class,function
] Write the algorithm of a program that reads the input line-by-line and count the number of lines. Program should terminate when end-of-file (EOF) is reached
Write the algorithm of a program that reads password from the user and then compare it with the original password stored in file. If the password matches, it should display you got 10 marks else it should print you have failed.
class baseClass
{
public:
void print();
int getX();
baseClass(int a = 0);
protected:
int x;
};
class derivedClass: public baseClass
{
public:
void print();
int getResult();
derivedClass(int a = 0, int b = 0);
private:
int y;
};
void baseClass::print()
{
cout<<"In base: x= "<< x <<endl;
}
baseClass::baseClass(int a)
{
x = a;
}
int baseClass::getX()
{
return x;
}
void derivedClass::print()
{
cout<<"In derived: x= "<< x <<", y= "<< y
<<"; x + y = "<< x + y <<endl;
}
int derivedClass::getResult()
{
return x + y;
}
derivedClass::derivedClass(int a, int b): baseClass(a)
{
y = b;
}What is the output of the following function main?
int main()
{
baseClass baseObject(7);
derivedClass derivedObject(3, 8);
baseObject.print();
derivedObject.print();
cout<<"****"<<baseObject.getX()<<endl;
cout<<"####"<<derivedObject.getResult()<<endl;
return 0;
}How to express a 3rd order differential equation into three first order differential equations?
Explain.