m java program Imagine that you invest in the stock market. The value of each stock can vary daily, and it might differ from its original purchase cost. The net worth of your stock portfolio is the difference between its original cost and its current value. Desgin a system to track your invesments. Include methods that purchase stock (add to the stack), sell stock from your portfolio ( remove from the st
Q: C++ PROGRAMMING Topic: HashTable - PolyHash Quadratic Explain the c++ code below.: SEE ATTACHED…
A: NOte:student asked only to provide only explation for the code
Q: in c++ Create a class of pancakes. The Pancakes class can have attributes flavor and topping that…
A: A class is the basic unit of object oriented methodology. An instance of a class is an object. A…
Q: STACK PROJECT Write a program that uses stacks to evaluate an arithmetic expression in infix…
A: INTRODUCTION: Here we need to create a program that uses stacks to evaluate an arithmetic expression…
Q: Java Programing Programming Problem 3: Palindrome Numbers A palindrome is known mostly for String…
A: After reverse a number when the digit of the number remains same, the number is called palindromic…
Q: Explain the role of the back button as it relates to the back stack.
A: Role of the back button The users are allowed to navigate back to the screens once they had visited…
Q: please write code using userdefine class names it Stack to convert expresion from infix to postfix…
A: Code to convert Infix To Postfix using user define a class #include <bits/stdc++.h> using…
Q: ===========Answer question below:=========== - Write program in Java. (Convert infix to postfix)…
A: The complete code is given below with the output.
Q: C++ PROGRAMMING Topic: Binary Search Trees Explain the c++ code below.: SEE ATTACHED PHOTO FOR THE…
A: ntroduction The given problem is related to C++ programming where binary tree is implemented and…
Q: Population Count Description: The population count is the number of 1s (ones) in the binary…
A: Write a Java program to input the population(a non-negative integer) from the user and count the…
Q: C++ Language C++ Code not working, what is the missing piece in this code? #include #include…
A: The solution to the given problem is below.
Q: Exercise Arithmetic (Command-line arguments): Write a program called Arithmetic that takes three…
A: Note: two different questions are given .Since it is not mentioned which one to answer.we would…
Q: Write Java Program Mr. Patrick is fond of reading books he is looking for a computerized way to keep…
A: To write a java program to keep record fo book collections. Must have following functions like…
Q: Write a function that makes a copy of a stack. You may tleclare and use any lo variables. You may…
A: Input : Input stack elements. Output : Create a copy of stack.
Q: I get an error when I run this c++ code. Below I have attached the code, prompt and the error I…
A: The following statement was missing in that else part – cout << "You are " << distance…
Q: A group of objects that have been piled atop one another is known as a stack. Which kinds of…
A: Foundation This question originates from the Data Structure paper that is part of the Computer…
Q: Output tracing. Give the exact output of the program. Give the exact output of the program. (ps. I…
A: Output: Stack: [club, spade, heart, diamond]Size of Stack: 4Is Stack empty? falseFlower not found,…
Q: ----------------******************-----------------************** - Write in Java. (Convert infix…
A: Code: import java.io.*; class Stack { char a[]=new char[100]; int top=-1; void push(char c) { try…
Q: Design a program which can tansfer an infix expression into a postfix expression and compute its…
A: #include <stdio.h> #include <string.h> #include <stdlib.h> struct Stack { int…
Q: ndng 2. Modular Programming: Your program should be modular and consists of the following functions:…
A: the code is an given below : Raw_Code: def read():#prompting and reading Z value from userZ =…
Q: The ADT in this case is a Stack. Write the code for this stack. You are hired to help design…
A: import java.util.*;public class Main{ public static void order(int num){ //function to take…
Q: In this assignment you are going to create an application that reverses a text file and saves it.…
A: Actually, program is an executable software that runs on a computer.
Q: 1- Write a Python function that takes a user input of a word and returns True if it is a Palindrome…
A: THe solution for the above given program is given below in python:
Q: Write method bodies of following method: CheckParenthesis() // This method will check if both…
A: Given: Write method bodies of following method: CheckParenthesis() // This method will check if both…
Q: # Reverse the stack - This procedure will reverse the order of items in the stack. This one may…
A: In the below program we can implement the stack reverse operation for example the original stack is…
Q: C++ Programming, Stack queue and deque
A: correct implementation od deque is given in next step
Q: Problem1. Write a java program that will PUSH and POP element using Stacks. Filename:…
A: The Java Code is given Below:
Q: JAVA programming question i will attach images of the ourQueue code and the main I have to do the…
A: One loop that would result into the stack Stack containing all of the negative number at the bottom…
Q: Inheritance (based on 8.38) You MUST use inheritance for this problem. A stack is a sequence…
A: Our Task: Create an empty stack. Iterate over the characters in the given string: If the character…
Q: Programming Assignment # 3 Objective: To use stacks to solve a programming problem Write a Java…
A: Given: Programming Assignment # 3 Objective: To use stacks to solve a programming problem Write a…
Q: Make a program fro Stack ising java which should evaluate the algebraic expresions.
A: //Source code using java import java.util.*; public class EvaluateAlgebricUsingStacks { public…
Q: Write in Java. (Convert infix to postfix) Note: Postfix notation is a way of writing expression…
A: Program static int Prec(char ch) { switch (ch) { case '+': case…
Q: For this code, just explain the void pop function, with each and every line. And please provide…
A: POP function:- Basically POP function created to remove the top elements l from the stack.
Q: Problem Statement: Recall the concepts of stacks. Implement a stack using arrays. Build a program…
A: Here, I have created some helper functions like push,pop,precedence,is_operator, and the required…
Q: in C++ langauge please and with the given functions. I submitted earlier and someone did it with a…
A: A C++ program for the given criteria is as follows, File name: “main.cpp” //Include header files…
Q: Complete the missing code then compile, debug and test your program using the command lines below:…
A: code:-
Q: To become familiar with stacks and queues. Directions: You are playing a simple game with a stack of…
A: The java code is shown below :
Q: in C++ please
A: A C++ program for the given criteria is as follows, File name: “main.cpp” //Include header files…
Q: ion Design a program which can tansfer an infix expression into a postfix expression
A: //Implementation code in C #include<stdio.h> #include<string.h> #include<stdlib.h>…
Q: Using arrays please write a program to implement the STACK concept. After creating the Array, the…
A: Solution: Procedure: The program is implemented using a menu with the options- push pop top exit…
Q: 1. Import Scanner and Stacks from the java.util package. 2. Create a Stack object named basket. 3.…
A: The python and java codes provided below
Q: heritance (based on 8.38) You MUST use inheritance for this problem. A stack is a sequence container…
A: Below is the required python program. Program Approach: Define a class as a stack. Inside the…
Q: IN JS PROGRAMMING LANGUAGE Your local bank has decided to upgrade its ATM machines by incorporating…
A: Your JavaScript program is given below as you required with an output.
Q: Course: Data Structure and Algorithms: Language: Java Please solve problem completely according…
A: The ask is to build a program to evaluate an infix algebraic expression and displays the output. It…
Q: 7. Dynamic MathStack The MathStack class shown in this chapter has only two member functions: add…
A: Given: 7. Dynamic MathStack The MathStack class shown in this chapter has only two member functions:…
Q: Java design a Queue with O(1) lookup time of the Maximum element. You will implement this…
A: Answer is given below:
Q: C++ Programming Activity: Linked List Stack and Brackets Explain the flow of the main code not…
A: As you asked for the explanation only I am writing the explanation in comment form. after // you'll…
Q: Expression Conversion Design a program which can tansfer an infix expression into a postfix…
A: GIVEN: Design a program which can tansfer an infix expression into a postfix expression and compute…
Q: Java Programming Create a program that allows the user to enter a string. Separate the vowels and…
A: Answer :
Q: Java Without using any java functions, data structures, libraries, string builder or anything…
A: The StringTokenizer classes in Java is used to tokenize a string. When taking a substring of both…
Data structure & algorithum java program
Imagine that you invest in the stock market. The value of each stock can vary daily, and it might differ from its original purchase cost. The net worth of your stock portfolio is the difference between its original cost and its current value. Desgin a system to track your invesments. Include methods that purchase stock (add to the stack), sell stock from your portfolio ( remove from the stack), and calculate the current net worth of the portfolio. when you sell a stock, you sell the most recently purchased one first.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- C# Reverse the stack - This procedure will reverse the order of items in the stack. This one may NOT break the rules of the stack. HINTS: Make use of more stacks. Arrays passed as parameters are NOT copies. Remember, this is a procedure, not a function. This would occur in the NumberStack class, not the main class. These are the provided variables: private int [] stack;private int size; Create a method that will reverse the stack when put into the main class.Using one or more stacks, write a code segment to read a string of charactersand determine whether it forms a palindrome.Definition: A palindrome is a sequence of characters that reads the same both forward andbackward.Example: ABLE WAS I ERE I SAW ELBA.The character ‘.’ ends the string. Write a message indicating whether the string is a palindrome.You may assume that the data are correct and that the maximum number of characters is 80.Expression Conversion Design a program which can tansfer an infix expression into a postfix expression and compute its result. Suppose the infix expression only includes’ *’, ‘/’, ‘+’, ‘-‘, ‘(‘, ‘)’ and the numbers are all integers. [Basic Requirements] 1) You are required to use stack. 2) The infix expression is inputted from keyboard as a string. If the input is legal, please convert the infix expression into postfix expression, calculate the result, and finally output the postfix expression and its value. 3) If the infix expression entered is illegal, the program can prompt the user to input incorrectly and prompt the user to re-enter. Please do the program according to the requirements above and it should be in C language...also after the code i want a report that the algorithm explanations of the code plesse don't just copy other student program and give me back please please please
- Expression Conversion Design a program which can tansfer an infix expression into a postfix expression and compute its result. Suppose the infix expression only includes’ *’, ‘/’, ‘+’, ‘-‘, ‘(‘, ‘)’ and the numbers are all integers. [Basic Requirements] 1) You are required to use stack. 2) The infix expression is inputted from keyboard as a string. If the input is legal, please convert the infix expression into postfix expression, calculate the result, and finally output the postfix expression and its value. 3) If the infix expression entered is illegal, the program can prompt the user to input incorrectly and prompt the user to re-enter. I want the program to be written in C language and want explanation for the algorithm of this programC# Reverse the stack - This procedure will reverse the order of items in the stack. This one may NOT break the rules of the stack. HINTS: Make use of more stacks. Arrays passed as parameters are NOT copies. Remember, this is a procedure, not a function. public void ReverseStack(){ }C# Reverse the stack - This procedure will reverse the order of items in the stack. This one may NOT break the rules of the stack. HINTS: Make use of more stacks. Arrays passed as parameters are NOT copies. Remember, this is a procedure, not a function. private int [] stack; private int size; public void ReverseStack(){ }
- Compulsory Task Follow these steps: ● For this task, you are required to refactor the badly written program RPN.java. This program is a Reverse-Polish Notation calculator which uses a stack. A Reverse-Polish Notation calculator is a calculator that will calculate equations where the operator follows the operands. Therefore, instead of inputting an equation as “1 + 2”, a Reverse-Polish Notation calculator would take the following input “ 1 2 +”. A stack is a data structure in which items are added to the top of the stack and removed from the top of the stack. It is therefore known as a last-in, first-out (LIFO) data structure. Stack terminology: ○ Push — is an operation that adds an item to the top of a stack. ○ Pop — is an operation that removes an item from the top of a stack. The pseudocode for this program is: ○ Get an equation (e.g. 2 3 +) from the user as input. ○ Loop through the string value input by the user. ■ When you encounter a number (remember that numbers can include…C++ ProgrammingTopic: Stack, Ques and DequesBelow is the initial program of the main file, only modify the main file, sllstack file also provided. See attached photo for instructions. main.cpp #include <iostream> #include <cstring> #include "sllstack.h" using namespace std; int main(int argc, char** argv) { SLLStack* stack = new SLLStack(); int test; string str; cin >> test; switch (test) { case 0: getline(cin, str); // PERFORM SOLUTION TO BRACKETS PROBLEM HERE // FYI: Place your variable declarations, if any, before switch. break; case 1: stack->push('a'); stack->push('b'); stack->push('c'); cout << stack->pop() << endl; cout << stack->pop() << endl; cout << stack->pop() << endl; cout << stack->isEmpty() << endl; break;…dont use answers show your step by step solution please will leave you feedback! Thank you!! Convert the following from infix to prefix using stacks: a / ( b * c + d ) do it approximately as it shown on the picturre
- Java Programming Hello! Can you make an algorithm / code for this part for my java calculator application. (see attached photo) All basic operations are already working, only the M's are needed to be implemented. Contains 'M+', 'M-', 'MC', 'MR' buttons(used to temporarily store data) with the corresponding stack functionalities as follows: 'M+' is push 'M-' is pop 'MC' is clear stack 'MR' is peakC++ Programming, Stack queue and dequeImprove the error code below, you can also create custom methods in the main class. See attached photo for the instructions.main.cpp: In function ‘int main(int, char**)’: main.cpp:17:15: error: expected primary-expression before ‘char’ stack<char> s; ^~~~ main.cpp:21:17: error: ‘s’ was not declared in this scope s.push(x[i]); ^ main.cpp:22:37: error: ‘s’ was not declared in this scope else if (x[i]==')' and !s.empty()) ^ main.cpp:44:16: error: ‘s’ was not declared in this scope return (s.empty()); ^ main.cpp:47:14: error: jump to case label [-fpermissive] case 1: ^ main.cpp:16:16: note: crosses initialization of ‘std::__cxx11::string x’ string x=str; ^ main.cpp:56:14: error: jump to case label [-fpermissive] case 2: ^ main.cpp:16:16: note: crosses initialization of ‘std::__cxx11::string x’ string x=str; ^ main.cpp:74:14: error: jump to case label [-fpermissive] case 3: ^ main.cpp:16:16: note: crosses initialization of ‘std::__cxx11::string x’…C++ ProgrammingActivity: Linked List Stack and BracketsExplain the flow of the main code not necessarily every line, as long as you explain what the important parts of the code do. The code is already correct, just explain the flow SEE ATTACHED PHOTO FOR THE PROBLEM INSTRUCTIONS int main(int argc, char** argv) { SLLStack* stack = new SLLStack(); int test; int length; string str; char top; bool flag = true; cin >> test; switch (test) { case 0: getline(cin, str); length = str.length(); for(int i = 0; i < length; i++){ if(str[i] == '{' || str[i] == '(' || str[i] == '['){ stack->push(str[i]); } else if (str[i] == '}' || str[i] == ')' || str[i] == ']'){ if(!stack->isEmpty()){ top = stack->top(); if(top == '{' && str[i] == '}' || top == '(' && str[i] == ')' ||…