write this code on java
Q: Why are Strings in Java referred to as Immutable?
A: - We need to talk about the immutability of strings in java.
Q: Java Take three number and find which is greatest.
A: import java.util.*;public class Main{ public static void main(String[] args) { Scanner sc= new…
Q: change this java code into a pseudo code
A: This code is to find whether password is valid or invalid that is entered by user.If it is valid it…
Q: Design the pattern below in the JAVA programming language. R R E R E D R E D O R E D O C
A:
Q: Write just the function reverse(int a[]) and write the program in JAVA
A: So we have to write a program in JAVA to print the elements of an given array in reverse order.
Q: Define debugger in a few words.
A: Given Data:- Define debugger in a few words.
Q: write the code for Fascinating number in java
A: Condition for fascinating number number must be three digit multiply by 2 and multiply by 3 and…
Q: casting to int in java
A: Use Integer.parseInt() to convert a string to an integer.
Q: Write the output of the java code fragmen
A: Initially, values of the variables are as follows who = 3 what = 3 done = true school = Parkville…
Q: Complete the following program in java to implement the user interface of the preceding exercise.…
A: A Java program is as follows, File name: “UnitConverter.java” import java.util.Scanner; import…
Q: Design a java method along with driver code to the number of numeric characters.
A: Coded using Java.
Q: Write a JAVA
A: Source code is in step 2
Q: Java Take three number of three digits and find which is greatest and reverse the greatest number
A: Given: Three numbers having three digits each. To find: Maximum of the three numbers and reverse of…
Q: Write for loops in Java to produce the following output:
A: public class TrianglePattern { public static void main(String args[]) { int k = 5;…
Q: Eclipse Java use two integer and computes the remainder
A: System.out.print("\nEnter number 1: ");num1 = input.nextInt();System.out.print("Enter number 2:…
Q: lowing code in
A:
Q: write the following uml in java
A: Please upvote. I am providing you the correct answer below. Please please please.
Q: Write code in java language to print thr numbers from 1 to 100 both inclusive without using any…
A: Requirements:- Write code in java language to print the numbers from 1 to 100 both inclusive without…
Q: Take a number and check if palindrome or not in java .
A: Requirements :- Take a number and check if palindrome or not in java . Approach :- Steps : - Take…
Q: Java Print 'java is best language for any kind' Using loop for 10 times
A: Requirements :- Java Print 'java is best language for any kind' Using loop for 10 times Approach…
Q: Write sample code in java
A: // Your First Program class HelloWorld { public static void main(String[] args) {…
Q: g this question using Java
A: hi
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: How to find the largest number in java?
A: Programing instructions: Create a class. Create a function getLargest() to find the largest number…
Q: Make simple interest calculator in java all enteries taken from user
A: Requirement:- Make simple interest calculator in java all entry taken from user Approach :- Simple…
Q: Make a program using java that converts infix notation to prefix or postfix either of the two.
A: Lets see the solution.
Q: Note: P1 is the parent of P2 and P1 is the parent of P3. Write a multithreading program in JAVA.
A: class P1 implements Runnable { publicvoid run() { System.out.println("P1"); } } class P2 extends P1…
Q: Java Write a program to print lowercase alphabets
A: Requirements :- Java Write a program to print lowercase alphabets . Approach :- Since we know the…
Q: how do I code String s and a char c as arguments in Java?
A: What are arguments? An argument is a value passed to a function during function call.
Q: Java Programming: Take input a decimal number from user and print the octal form of that number in…
A: Write a JAVA program to take input a decimal number from the user and print the octal form of that…
Q: Write this program using java
A: Java code: import java.util.Scanner; public class Main{ public static void main(String args[]) {…
Q: Java Take two number and perform basic 4 operations + Jand print all result with its operation
A: import java.util.*;public class Main{ public static void main(String[] args) { Scanner sc= new…
Q: 4. Write a program in Ruby language to print all two digit numbers having last digit as 1.
A: Write a program in Ruby language to print all two-digit numbers having the last digit as 1.…
Q: How does Java handle divide by zero error? Demonstrate with an example.
A: Java program to handle the divide by zero error. Exception: The exception is an abnormal…
Q: compute the result of each Java expressions 3 % 2 + 1
A: In the above code, it has been asked to compute the result of Java expression: 3 % 2 + 1, in the…
Q: In java, a+=1 is an unary operation
A: a+=1 is using the assignment operator in java. Although, a++ and a+=1 expression has the same…
Q: **** print this pattern in java in 10 minutes
A: Question : Approach : see the code you will definately get it
Q: In Java, Addition has higher precedence over the subtractions." True O False
A: In java or c++ or python, the precedence of addition and subtraction operator is same. Thus to…
Q: Take input a lowercase alphabet in Java and convert it to uppercase without any library functions.
A: Given: Take input a lowercase alphabet in Java and convert it to uppercase without any library…
Q: ode not Java
A: Since in give code segment, there is used a special type of variable called static which works on…
Q: Write the output of the following code. String proverb ="Java has lambda expressions";…
A: CODE(SCREENSHOT) : in line 3, a string variable proverb is declared and initialized with "Java has…
Q: Write this code in any language Python, Java or C++ and complete the code and make sure it runs.
A: Given: Write this code in any language Python, Java or C++ and complete the code to check a number…
Q: Print the right pascal's triangle pattern in java
A: Question. Print the right pascal's triangle pattern in java Answer. JAVA code to print the right…
Q: write the code for spy number in java
A: Concept :- Take a number from user and then separate its digits using modulus and division function.…
Q: Fill in the proper blank. JDB is used for finding and fixing ____ inside the Java program.
A: JDB is used for finding and fixing ____ inside the Java program.
Q: How to find the largest value of five distinct integers in java?
A: Given: How to find the largest value of five distinct integers in java?
Q: Is there a reason why Java Strings are referred to as Immutables?
A: The immutable string or object is a type of object in object-oriented programming that can't be…
Q: write the code in java reverse the words
A: Steps : take string and trim it 2 .now make 2 pointer and take it to last and transverse it…
Q: compute the result of each Java expressions 4 / 2 * 2
A: EXPLANATION: The operators that are executed in java work on the basis of priority and…
write this code on java
Step by step
Solved in 2 steps with 4 images
- Write an iterable Stack client that has a static method copy() that takes a stackof strings as argument and returns a copy of the stack. Note : This ability is a primeexample of the value of having an iterator, because it allows development of such functionality without changing the basic API.Here is a calling sequence for a procedure named AddThree that adds three doublewords(assume that the STDCALL calling convention is used):push 10hpush 20hpush 30hcall AddThreeDraw a picture of the procedure’s stack frame immediately after EBP has been pushed onthe runtime stackWrite a method to reverse the content of a stack. Inside the method, you may create exactly one temporary container -- either a stack or a queue. It is alright to create variables of primitive data types (such as, an integer), if required. You must use the following header. public void reverse(Stack s){
- java /* Practice Stacks and ourVector Write a java program that creates a stack of integers. Fill the stack with 30 random numbers between -300 and +300. A)- With the help of one ourVector Object and an additional stack, reorganize the numbers in the stack so that numbers smaller than -100 go to the bottom of the stack, numbers between -100 and +100 in the middle and numbers larger than +100 in the top (order does not matter) B)- (a little harder) Solve the same problem using only one ourVector object for help C)- (harder) Solve the same problem using only one additional stack as a helper */ public class HWStacks { public static void main(String[] args) { // TODO Auto-generated method stub } }Implement a method transfer in class LinkedStack. This method should transfer all elements of a stack sourceS to another stack targetS so that the element that starts at the top of sourceS is the first one to be inserted in targetS, and the element at the bottom of sourceS ends up at the top of targetS. The operation should result in sourceS being an empty stack. Test this method in the main method of LinkedStack. package stacks;public class LinkedStack<E> implements Stack<E> {/** The primary storage for elements of the stack */private SinglyLinkedList<E> list = new SinglyLinkedList<>(); // an empty list/** Constructs an initially empty stack. */public LinkedStack() { } // new stack relies on the initially empty list@Overridepublic int size() { return list.size(); }@Overridepublic boolean isEmpty() { return list.isEmpty(); }@Overridepublic void push(E element) { list.addFirst(element); }@Overridepublic E top() { return list.first(); }@Overridepublic E pop() {…Create a simple graphical application that will allow a user toperform push, pop, and peek operations on a stack, and displaythe resulting stack (using toString) in a text area
- Given a class Stack with the interface public void push(char n) // pushes n onto stack public char pop() // return the top of the stack, removing element from stack public boolean isEmpty() // return true if stack is empty Write a method public void addStars(Stack<Character> stack) which takes a Stack as input and adds two asterisk (‘*’) at the front and back of all the elements in the stack. The stack must be restored to its original order plus the asterisks. For example, the stack [bottom] a b c d [top] Would become [bottom] ** a b c d ** [top]A CapnStackSparrow is an extended stack that supports four main operations: the standard Stack operations push(x) and pop() and the following non-standard operations:• max(): returns the maximum value stored on the Stack.• ksum(k): returns the sum of the top k elements on the Stack.The zip file gives an implementation SlowSparrow that implements these operations so that push(x) and pop() each run in ?(1) time, but max() and ksum(k) run in ?(?) time. For this question, you should complete the implementation of FastSparrow that implements all four operations in ?(1) (amortized) time per operation. As part of your implementation, you may use any of the classes in the Java Collections Framework and you may use any of the source code provided with the Java version of the textbook. Don't forget to also implement the size() and iterator() methods. Think carefully about your solution before you start coding. Here are two hints:1. don't use any kind of SortedSet or SortedMap, these all require…Modify the Java class for the abstract stack type shown belowto use a linked list representation and test it with the same code thatappears in this chapter. class StackClass {private int [] stackRef;private int maxLen,topIndex;public StackClass() { // A constructorstackRef = new int [100];maxLen = 99;topIndex = -1;}public void push(int number) {if (topIndex == maxLen)System.out.println("Error in push–stack is full");else stackRef[++topIndex] = number;}public void pop() {if (empty())System.out.println("Error in pop–stack is empty"); else --topIndex;}public int top() {if (empty()) {System.out.println("Error in top–stack is empty");return 9999;}elsereturn (stackRef[topIndex]);}public boolean empty() {return (topIndex == -1);}}An example class that uses StackClass follows:public class TstStack {public static void main(String[] args) {StackClass myStack = new StackClass();myStack.push(42);myStack.push(29);System.out.println("29 is: " + myStack.top());myStack.pop();System.out.println("42 is:…
- I need to write some java code evaluating postfix of some expressions. I must use the object stack given to me and cant use a linkedlist. This is the method I am given: static double evaluatePostfixExpression (String expression) { Stack aStack = new Stack(); } These are a few of the expressions: e 4 3 ! + e 3 1 22 / / - +The ADT stack lets you peek at its top entry without removing it. For some applications of stacks, you also need to peek at the entry beneath the top entry without removing it. We will call such an operation peek2. If the stack has more than one entry, peek2 returns the second entry from the top without altering the stack. If the stack has fewer than two entries, peek2 throws an exception. Write a linked implementation of a stack class call First_Last_LinkStack.java that includes a method peek2Modify the C++ class for the abstract stack type shown belowto use a linked list representation and test it with the same code thatappears in this chapter. #include <iostream.h>class Stack {private: //** These members are visible only to other//** members and friends (see Section 11.6.4)int *stackPtr;int maxLen;int topSub;public: //** These members are visible to clientsStack() { //** A constructorstackPtr = new int [100];maxLen = 99;topSub = -1;}~Stack() {delete [] stackPtr;}; //** A destructorvoid push(int number) {if (topSub == maxLen)cerr << "Error in push--stack is full\n";else stackPtr[++topSub] = number;}void pop() {if (empty())cerr << "Error in pop--stack is empty\n";else topSub--;}int top() {if (empty())cerr << "Error in top--stack is empty\n";elsereturn (stackPtr[topSub]);}int empty() {return (topSub == -1);} }