Write a java program using stacks that takes 3 non-negative (base 10) long integer numbers and a base B (B is in the range 2-9) and writes the number to the screen as a base B number. The program prompts the user for 3 numbers and bases, and then outputs them.
Q: Write a program using stacks that will do the following: 1. Ask the user for a number then push in…
A: # Online Python compiler (interpreter) to run Python online.# Write Python 3 code in this online…
Q: Write a Java program that extracts the repeated numbers from the stack, i.e. eliminates the repeated…
A: // main methodpublic class Finals2 { public static Stack<Integer> slist = new…
Q: Write a program in C++ language that inserts two symbolic strings from the keyboard and prints them…
A: Write a program in C++ language that inserts two symbolic strings from the keyboard and prints them…
Q: please write it in C language. import java.util.*; public class EightQDfs { final int…
A: Step 1: Declare the function dispSol() that takes board configuration in the form of a…
Q: Write a java program to get the size & odd elements from the user and find out the sum of this…
A: import java.util.Scanner;public class Solution { public static void main(String[] args){…
Q: Write a Java program to print all combinations of phreses formed by picking words from each of the…
A: The Program is written in java import java.util.ArrayList; class Main { public static void…
Q: 1. For a given integer n> 1, the smallest integer d > 1 that divides n is a prime factor. We can…
A: Kindly Note: As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: Write a Java program to find the largest index of the smallest element in a sequence of integers.…
A: import java.util.*;class Test96 { public static void main(String args[]) { Scanner sc = new…
Q: reads a Java program and makes a list of all the user-defined identifiers.
A: Algorithm: Create a list of reserved words. Iterate through the document, line by line. Extract…
Q: Write a simple program in Java to display the age of a father where The sum of ages of two sons is 5…
A: import java.util.Scanner; public class fAge { public static void main(String[] args)…
Q: Write a Java Program for adding one to number represented by digits in the given array The given…
A: According to the Question below the solution: Output:
Q: Write a java program to print the numbers from a user entered number till 0 using recursion.
A: what is Recursion? The technique of making a function call itself is known as recursion. This…
Q: Write a java program that will Invoke (call) a method calcFact that will receive an integer from…
A: Java Program: import java.util.*; class CalcFactClass{ public static void calcFact(int n){ int prod…
Q: Write a JAVA program that will maintain a phone directory using a Linked-List. The program should be…
A: Actually, Java is a general-purpose also class-based, object-oriented programming language designed…
Q: Write a Java program to store the rainbow color names as strings in a TreeMap with keys starting…
A: Code import java.util.Map;import java.util.TreeMap;public class Problem1{ public static void…
Q: In Java Write a method splitStack that takes a stack of integers as a parameter and splits it into…
A: Actually, Java is a programming language originally developed by James Gosling at Sun Microsystems…
Q: Write java code that prints even and odd numbers from 1 to 10 in one code
A: Please find the answer below :
Q: Write a single java program by taking two variables num1 and num2 with values of your own and…
A: //Program to take two numbers from user and perform addition, multiplication and division import…
Q: Write a Java program to take a list of non-negative integers, print an integer list of the rightmost…
A: Create two arrays, one to store the integer and list and one to store the right most digit. Input…
Q: Java program which reads a list of pairs of a word and a page number, and prints the word and a list…
A: Programming Function to read a list of pairs of the word and page numbers and gives back words and a…
Q: Write a java program to display the output like the one below using multi dimensional array. 1 2 3 6…
A: We need to have 5 rows to store 0-4 and 10 columns to store 0-9
Q: Write a java program that reads three names and displays them in the reverse of the order in which…
A: import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner…
Q: Consider class IntArrayStack that has two instance variables: int[] data and int top. Implement an…
A: As per our policy the programming language is not mentioned so i am providing the solution in Java.…
Q: Write a Java method that outputs a formatted multiplication table for multiplying pairs of integers…
A: Required: Write a Java method that outputs a formatted multiplication table for multiplying pairs of…
Q: Consider the Python program: def A(I, P): def B(): print (I) if I > 3: P() elif I > 2: A(4, P) elif…
A: High level language is one of the languages which is used by the software such as Python is easily…
Q: Write a java program to find "nth" Fibonacci number where the value of "n" will be given by the…
A: i have provided this answer with full description in step-2.
Q: Write a program that uses stacks to evaluate an arithmetic expression in infix notation without…
A: #include<iostream> #include<stack> #include<cstring> using namespace std; //…
Q: Write a Java program that get the name of the user as input and stores each character in a stack.…
A: The complete code is given below with output .
Q: Write a Java program that counts the number of divisors of a number n given by the user.
A: Here I have taken input from the user and stored it into a variable. Next, I have declared a…
Q: Write a program in Java to make such a pattern like a pyramid with a number which will repeat the…
A: import java.util.Scanner;public class Main{ public static void main(String[] args) {…
Q: Write a Java program that solves a set of quadratic equations as per Requirement #1 (without using…
A: import java.util.Scanner; public class Tester{ public static void main(String[] args){ Scanner…
Q: Write a single java program by taking two variables num1 and num2 with values of your own and…
A: Code public class Main{ public static void main(String[] args) { int num1=4,num2=5;…
Q: You are given the following Java Code. Write down the output that will be produced when it is…
A: output of the given java code will be:…
Q: Write a simple program in Java that will generate a well-formatted addition table. Prompt the user…
A: Start Take the input values Take the upper bound value Print the addition table Stop
Q: A. Write a program that will input 10 numbers on the stack and will output how many numbers inside…
A: Stack is a data structure in which it inserts and removes the element at the one end called the top…
Q: Write a program using stacks that will do the following: 1. Ask the user for a number then push in…
A: Sample Response: //C++ program//Tested on CodeBlock IDE#include <iostream>#include…
Q: Write a Java method using a stack which takes a string and outputs (true/false) whether it is a…
A: Program Approach: Find the length of the string, which we'll call len. Find the midpoint using the…
Q: A palindrome is a string that reads the same forwards as backwards. Using only stacks and/or queues,…
A: A palindrome is a string that reads the same forwards as backwards. Using onlystacks and/or queues,…
Q: Write a java class that implements the following pseudocode · Start · Read number N, · Set remainder…
A: Programming instruction: Create a class. Read the input from the user. Calculate remainder as N…
Q: Write a Java program to input a list of names (strings) from the user and store them in an…
A: import java.util.*;public class Main{ public static void main(String[] args) {…
Q: Write a JAVA program that will maintain a phone directory using a Linked-List. The program should be…
A: Answer :
Q: Purpose To review threads in Java. Threading Divisors Directions and Example: A divisor is a number…
A: According to the information given:- we have to follow the instruction mentioned and modify the code…
Q: Write a java program that prints a multiplication table, like this: It's 10 by 10 grid. (NO ARRAYS)
A: Here we will discuss Java program to display multiplication table using for loop.
Q: Write a program that uses stacks to evaluate an arithmetic expression in infix notation without…
A:
Q: Write a program that uses stacks to evaluate an arithmetic expression in infix notation without…
A: Start. Take the infix expression. Perform the evaluation. Print the result. End.
Q: Write a complete java program to read 10 integer numbers into an array named list. Then Use the…
A: Task : Write a Java program to take input of 10 integers and then print them in order mentioned in…
Q: WRITE A JAVA PROGRAM TO TAKE A LIST OF INTEGERS FROM THE USER AND PRINT THAT LIST WHERE EACH INTEGER…
A: I give the code in java along with code and output screenshot
Q: In which memory a String is stored if we create it using new operator? a. Stack b. String memory…
A: HI THERE I AM ADDING ANSWER BELOWPLEASE GO THROUGH ITTHANK YOU
Q: Implement Tower of honai in Java by using Stack. Towers Disks Smallest Largest The mission is to…
A: Implement TOWER OF HANOI USING JAVA OR STACK implementation
Java
Dont use others answers please!!
follow the directions on the photo
will leave you feedback!!
Thank you!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- Consider implementing a stack in a computer that has a relatively small amount of fast primarymemory and a relatively large amount of slower disk storage. The operations PUSH and POP workon single-word values. The stack can grow to be much larger than can fit in memory, and thus mostof it must be stored on disk. One stack implementation strategy is to keep one block (size m) of the stack in memory, and use asmall amount of memory to keep track of which block is in the memory and a stack pointer to thedisk address of the top element of the previous block. You can perform a stack operation only ifthe relevant disk block resides in memory. If necessary, you can write the block currently inmemory to the disk and read the new block from the disk into memory. If the relevant disk blockis already in memory, then no disk accesses are required. Based on the above information, answer the following questions: (1) What is the worst-case number of disk accesses required for n PUSH…Write a C++ or Python program to read your full name in character array and reverse it using a stack . • Create a character array that can hold any name with a maximum of 50 characters • Create an array of the same size as the character array that can be used as an ADT ( Stack ) Read any user - given input ( name ) • Use stack operations to reverse the name • Your program must have the functions PUSH ( ) and POP ( ) • Show each step of output on the screen .2. Consider the two main variables: Number and N. Number is a 1024 byte variable. It represents a huge unsigned integer. N is a 4 byte variable. It represents the number of bits by which the number will be shifted. assenbly language Write an SHL1024 function that receives two parameters on the stack: the address of a number of 1024 bytes and a value giving by how many bits the number of 1024 bytes will be shifted towards the left. This function must act like an SHL but on a 1024 byte variable. On return, the content of the Number variable will be shifted to the left by the number of bits demand. On return, the values of the general registers and the EFLAGS should be the same as before the call to SHL1024
- Reverse a String “Towson University” with the following requirements: Use a loop with indexed addressing Push each character to the stack Start at the beginning of the string, pop the stack in reverse order, insert each character back into the string As a result, your output should be as follows. Insert the following lines to declare data: strTU byte “Towson University”, 0 strSize = ($ - strTU) - 1 Insert the following lines to display a string: mov edx,OFFSET <variable name> call Writestring Insert the following line to generate a new line: call crlf ; new-line createrWrite the code in assebly language code that can be read in LC3 simulators! .ORIG x3000 ; Set up the user stack: LD R6, STKBASE ; Sets up the stack by loading the base address into R6 ; Prompt for the first string: LEA R0, PRMPT1 ; Loads the address of PRMPT1 into R0 PUTS ; Call GETS to get first string: LEA R0, STRNG1 ; Loads the address of STRNG1 ADD R6, R6, #-1 ; Push the address to store the string at STR R0, R6, #0 JSR GETSP ; Call GETSP ADD R6, R6, #2 ; Clean up (pop parameter & return value) ; Prompt for second string: LEA R0, PRMPT2 ; Loads the address of PRMPT2 PUTS ; Call GETS to get second string: LEA R0, STRNG2 ; Loads the address of STRNG2 ADD R6, R6, #-1 ; Push the second address to store the string at STR R0, R6, #0 JSR GETSP ; Call GETSP ADD R6, R6, #2 ; Clean up (pop parameter & return value) ; Output both strings: LEA R0, OUT1 ; First string... PUTS LEA R0, STRNG1 PUTSP LD R0, LF ;…Suppose you have a stack with a maximum size of 1000 elements and you want to perform the following operations: Push 500 elements onto the stack. Pop 200 elements from the stack. Push 800 elements onto the stack. Pop all remaining elements from the stack. What is the final size of the stack after performing all these operations?
- Given that a stack starts like this: 4 12 10 2 3 Give the output of a stack if the following instructions are executed: Push (25); Push (9); Push (73); Pop (), Pop, Pop Select one: A. 9 73 10 B. 4 12 10 2 3 C. 73 9 25 D. 4 12 25 73Reverse a String “Towson University” with the following requirements: Use a loop with indexed addressing Push each character to the stack Start at the beginning of the string, pop the stack in reverse order, insert each character back into the string As a result, your output should look like the picture given NOTE Insert the following lines to declare data: strTU byte “Towson University”, 0 strSize = ($ - strTU) - 1 Insert the following lines to display a string: mov edx,OFFSET <variable name> call Writestring Insert the following line to generate a new line: call crlf ; new-line creater Please take a picture of your code and output as well.Complete the ARM Legv8 implementation of Main given C code. Do not implement return 0; in main(). Use Ldur,Stur,Stack if necessary, do not use MOV,LDR. X stored in X19,y in X20,w in X21,z in X22 int main() { int x, y; w = Sum(x, y); z = Dif(y, x); return 0; // Do not implement } LEGv8 code: Main: // Type your code here. B End // Procedure Sum (Do not modify)Sum: ADD X2, X0, X1 BR X30 // Procedure Dif (Do not modify)Dif: SUB X2, X0, X1 BR X30 End:
- Using Java: Write a program to perform the following operations on a stack. a) Create functions for push and pop operations of the stack.b) Write a function to convert an infix expression to a postfix expression. Pass a one-dimensional character array P to the function as input (infix exp) and return character array Q (postfix exp). Test your program for the following input P : ( A – (B / C ) * D + E ) * F % G c) Write a function for the evaluation of a given postfix expression. For testing pass the postfix expression Q of part b and supply the following set of values. A = 90, B = 50, C = 2, D = 3, E = 1, F = 2, G = 5// the language is c++, please code with common for better understanding, and after your code finished take a screenshot of the execution. Write a C++ program to simulate a stack using an array. You should create an index (the stack pointer) to point into the stack. Initialize it to 0. The stack should grow to location [1], [2], [3], etc. Write a "push (int)" function to push an int onto the top of the stack. Also, write an "int pop" instruction to pop the data that is stored on the top of the stack. The pop instruction must return the popped data. The push and pop instructions should increment and decrement the stack pointer appropriately. Your source should contain calls to your functions demonstrating that it works. Note, that you should do several pushes and several pops to show that data is correctly stored on the stack. You can do this by showing sample runs. Cut and paste the results of the runs into a separate documentJAVA You are given a stack with n integers. You need to sort the elements of the stack in ascending order such that the minimum value is at the bottom-most position of the stack. Input Format: The first line of input is the number of elements in the stack. The next line of input consists n space separated integers in the order bottom to top. Output Format: The output is sorted stack with minimum value at bottom of the stack and maximum value at the top of the stack. Example: Stack(bottom -> top) = [6, 12, 3, 4] Output: [3, 4, 6,12] Sample Input: 12 6 12 3 4 5 1 7 8 10 9 11 2 Sample Output: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] Note: You can use extra stack if needed. import java.util.*; public class Source { public static void main(String args[]) { Stack stack = new Stack<>(); Scanner s = new Scanner(System.in); int n = s.nextInt(); while (n-- > 0) stack.push(s.nextInt()); sort(stack); } // Method to sort the elements of the stack in ascending order static…