Questions
The purpose of this assignment is to build the business calculator using supporting files built inTopics...

The purpose of this assignment is to build the business calculator using supporting files built inTopics 4 and 5.Create a Java application file named RPN.java containing a main method by using the ForthStack.java and associated files from Topic 5.The application should have one text box for numeric data entry, one text box for numeric display, one text box for error display, and buttons labeled "+", "-", "*", "/","dup", "2dup", "clr", "pop" and "push." The actions of the controls should be as follows.oThe text box for numeric display should display the top element of the stack, or blank if the stack is empty.oThe text box for numeric data entry should allow the user to type in a valid numeric value.oThe text box for error display should display an error message from the previous operation (if any), or be blank if the last operation was successful.oThe buttons labeled "+", "-", "*", "/", "dup", "2dup", "clr", and pop should invoke the corresponding methods in ForthStack; "pop" should remove and discard the top item on the stack, and "push" should push the numeric value in the numeric data entry box onto the stack and clear the numeric data entry box.oAll button operations should update the display of the top of the stack.The size of the stack used should be four, no more or less, in order to standardize testing.After thoroughly testing the program, submit the AbstractStack.java, ArrayStack.java,Forth.java, ForthStack.java, TestForthStack.java, and RPN.java

STACK CODE:

ArrayStack.java

import java.util.Arrays;

public class ArrayStack extends AbstractStack {
//Attributes
private double[] array;
private int size;
private int num;
  
//Default constructor
public ArrayStack() {
array = new double[3];
size = 3;
num = 0;
}
  
//Parametrized Constructor
public ArrayStack(int a){
array = new double[a];
size = a;
num = 0;
}
  
//Insert a new element
public void push(double a){
if (num < size) {
array[num] = a;
num++;
System.out.println("Success");
}
else {
throw new ArrayIndexOutOfBoundsException("Failure! Stack is full");
}
}
  
//Take out last inserted value
public double pop(){
if (num > 0){
num--;
return array[num];
}
else {
throw new ArrayIndexOutOfBoundsException("Stack is empty");
}
}
//Check stack empty or not
public boolean isEmpty(){
return (num == 0);
}
//Get top element from stack
public double peek() {
return peek(num-1);
}
//Get specified index element
public double peek(int n){
try
{
if (num > 0){
if (n < 0 || n >= num)
return -1;
else
return array[n];
}
else{
System.out.println("Stack is empty");
return -1;
}
}catch(Exception e ){
e.printStackTrace();
}
return 0;
}
//Number of elements in stack
public int count(){
return num;
}
public void clear() {
size=0;;
num=0;
}
  
}

public class FourthStack extends ArrayStack implements Fourth{
//Parameterized constructor
public FourthStack(int sz) {
super(sz);
}

@Override
//Pop 2 elements from stack and add values
//Push into stack
public void add() {
if(super.count()<2) {
throw new ArrayIndexOutOfBoundsException("Not enough elements to pop");
}
else {
super.push(super.pop()+super.pop());
}
}

@Override
//Pop 2 elements from stack and subtract second from first
//Push into stack
public void sub() {
if(super.count()<2) {
throw new ArrayIndexOutOfBoundsException("Not enough elements to pop");
}
else {
super.push(super.pop()-super.pop());
}
}

@Override
//Pop 2 elements from stack and multiply values
//Push into stack
public void mul() {
if(super.count()<2) {
throw new ArrayIndexOutOfBoundsException("Not enough elements to pop");
}
else {
super.push(super.pop()*super.pop());
}
}

@Override
//Pop 2 elements from stack and divide second from first values
//Push into stack
public void div() {
if(super.count()<2) {
throw new ArrayIndexOutOfBoundsException("Not enough elements to pop");
}
else {
super.push(super.pop()/super.pop());
}
}

@Override
//peek an element and make duplicate
//Push into stack
public void dup() {
if(super.count()<1) {
throw new ArrayIndexOutOfBoundsException("Not enough elements to pop");
}
else {
super.push(super.peek());
}
  
}

//Peek 2 elements from stack and make their duplicate
//Push into stack in same order
@Override
public void twoDup() {
if(super.count()<2) {
throw new ArrayIndexOutOfBoundsException("Not enough elements to pop");
}
else {
double first=super.peek();
double second=super.peek(super.count()-2);
super.push(second);
super.push(first);
}
}

}

import java.util.Scanner;
/**
* Test implemented functions
* @author deept
*
*/
public class TestFourthStack {
public static void main(String [] args){
//Variables for input
int choice;
int pek;
double val,poped;
boolean empty;
//Keyboard read
Scanner sc =new Scanner(System.in);
FourthStack as = new FourthStack(20);
//Loop until exit
while(true){
//User choices
System.out.println("1. Enter a Value in stack");
System.out.println("2. Pop a Value");
System.out.println("3. Check If array is Empty");
System.out.println("4. Peek Function");
System.out.println("5. Clear Stack");
System.out.println("6. Add Function");
System.out.println("7. Sub Function");
System.out.println("8. Mul Function");
System.out.println("9. Div Function");
System.out.println("10. Dup Function");
System.out.println("11. TwoDup Function");
System.out.println("0. Exit\n");
choice = sc.nextInt();
//Execute each choice
switch(choice){
case 1:
System.out.print("Enter a value To push : ");
val = sc.nextDouble();
as.push(val);
break;
case 2:
poped = as.pop();
System.out.println("Popped : "+poped);
break;
case 3:
empty = as.isEmpty();
System.out.println("Empty ? "+empty);
break;
case 4:
poped = as.peek();
if(poped != -1)
System.out.println("Peeked Value : "+poped);
else
System.out.println("Oops it was not a valid index this place is empty");
break;
case 5:
as.clear();
break;
case 6:
as.add();
break;
case 7:
as.sub();
break;
case 8:
as.mul();
break;
case 9:
as.div();
break;
case 10:
as.dup();
break;
case 11:
as.twoDup();
break;
case 0:
System.exit(0);
}
}
}
}

/*
* Pure abstract class without implementation
*/
public abstract class AbstractStack {
public abstract void push(double item);
public abstract double pop();
public abstract boolean isEmpty();
public abstract double peek();
public abstract void clear();
}


/*
* Interface to generate sum additional functions using stack
*/
public interface Fourth {
public void add();
public void sub();
public void mul();
public void div();
public void dup();
public void twoDup();
}

I PROVIDED THE FIVE PREVIOUS STACKS THAT I USED ON MY PREVIOUS WORK... LET ME KNOW IF THERE'S ANYTHING ELSE


Everything should be attached as requested, and i emailed you all the attachments

In: Computer Science

Fill in the blank for this common use of the for loop in processing each character...

Fill in the blank for this common use of the for loop in processing each character of a string.

for _____________________________________________________

{

    char ch = str.charAt(i);

    // process ch

}

Insert the missing statement in the following code fragment prompting the user to enter a positive number.

    double value;

    do

    {

    System.out.print("Please enter a positive number: ");

    value = in.nextDouble();

    }

    _____________________________________

The following for loop is executed how many times?

for (x = 0; x <= 10; x++)     

Consider the following for loop:

for (i = 0; i < str.length(); i++)

{ ... }

and the corresponding while loop:

i = 0;

while __________________________________

{

    . . .

    i++;

}

Fill in the blank for the while loop condition that is equivalent to the given for loop?

Write a for loop that is equivalent to the given while loop.

i = 1;

while (i <= 5)

{

    . . .

    i++;

}

In: Computer Science

Real Fruit Juice: A 32 ounce can of a popular fruit drink claims to contain 20%...

Real Fruit Juice: A 32 ounce can of a popular fruit drink claims to contain 20% real fruit juice. Since this is a 32 ounce can, they are actually claiming that the can contains 6.4 ounces of real fruit juice. The consumer protection agency samples 56 such cans of this fruit drink. Of these, the mean volume of fruit juice is 6.36 with standard deviation of 0.21. Test the claim that the mean amount of real fruit juice in all 32 ounce cans is 6.4 ounces. Test this claim at the 0.05 significance level.

(a) What type of test is this?

This is a two-tailed test.

This is a left-tailed test.    

This is a right-tailed test.


(b) What is the test statistic? Round your answer to 2 decimal places.
t-x= 2

(c) Use software to get the P-value of the test statistic. Round to 4 decimal places.
P-value = 3

(d) What is the conclusion regarding the null hypothesis?

reject H0

fail to reject H0    


(e) Choose the appropriate concluding statement.

There is enough data to justify rejection of the claim that the mean amount of real fruit juice in all 32 ounce cans is 6.4 ounces.

There is not enough data to justify rejection of the claim that the mean amount of real fruit juice in all 32 ounce cans is 6.4 ounces.

We have proven that the mean amount of real fruit juice in all 32 ounce cans is 6.4 ounces.

We have proven that the mean amount of real fruit juice in all 32 ounce cans is not 6.4 ounces

In: Math

A 100g ball is tied to a string so that the center its mass hangs 60...

A 100g ball is tied to a string so that the center its mass hangs 60 cm below the point where the string is tied to a support rod. The ball is pulled aside to a 70° angle with vertical and released. As the string approaches vertical, it encounters a peg at a distance x below the support rod. The string then bends around the peg. If the position of the peg is low enough, the ball will move in a circle wrapping the string around the peg. a. Draw a FBD for the ball. Starting from the definition of work W=F d cos, demonstrate and explain the work done by each of the force on your FBD. b. What is the work done by nonconservative force? What can you say about the total mechanical energy for the ball as it swing and rotate around the support rod and peg. c. What is the smallest value of x for which the ball will move in a circle wrapping the string around the peg? Note: to answer the last question c, first explain what happen to the mechanical energy, gravitational potential energy, kinetic energy, speed, and centripetal force of the ball as you decrease x. Then predict what will happen to the mechanical energy, gravitational potential energy, kinetic energy, speed, and centripetal force when x reaches its minimum value. Set up a mathematical equation that satisfy the condition for minimum x and solve it based on the conditions provided.

In: Physics

In Susan Sontags book " On Photography" chapter 4 The Heroism of Vision explain what she...

In Susan Sontags book " On Photography" chapter 4 The Heroism of Vision explain what she talking about in the chapter, the two most important parts of the essay, the idea behind it and why the essay is important as a whole.

In: Psychology

The Harding Corporation has $50 million of bonds outstanding that were issued at a coupon rate...

The Harding Corporation has $50 million of bonds outstanding that were issued at a coupon rate of 10.25 percent seven years ago. Interest rates have fallen to 9 percent. Preston Alter, the vice-president of finance, does not expect rates to fall any further. The bonds have 18 years left to maturity, and Preston would like to refund the bonds with a new issue of equal amount also having 18 years to maturity. The Harding Corporation has a tax rate of 25 percent. The underwriting cost on the old issue was 2.5 percent of the total bond value. The underwriting cost on the new issue will be 1.8 percent of the total bond value. The original bond indenture contained a five-year protection against a call, with an 8 percent call premium starting in the sixth year and scheduled to decline by one-half percent each year thereafter (Consider the bond to be seven years old for purposes of computing the premium). Use Appendix D. (Round "PV factor" to 3 decimal places.) a. Compute the discount rate. (Round the final answer to 2 decimal places.) Discount rate 6.75 6.75 Correct % b. Calculate the present value of total outflows. (Do not round intermediate calculations. Enter the answers in whole dollars, not in millions. Round the final answer to nearest whole dollar.) Total outflows $ 2812500 2812500 Incorrect c. Calculate the present value of total inflows. (Do not round intermediate calculations. Enter the answers in whole dollars, not in millions. Round the final answer to nearest whole dollar.) Total inflows $ 4801477 4801477 Correct d. Calculate the net present value. (Do not round intermediate calculations. Round the final answer to nearest whole dollar.) Net present value $ 1365193 1365193 Incorrect e. Should the Harding Corporation refund the old issue? Yes No

In: Accounting

give an example of how DEA (data envelopement analysis) can be utilized to improve efficiency and...

give an example of how DEA (data envelopement analysis) can be utilized to improve efficiency and operations in Public Policy or Administration (local, state, or federal) and an example of how it can improve efficiency of Business Management. I need to write a 2 pages report and please no plagiarism.

In: Operations Management

1Write an SQL statement utilizing the WHERE, LIKE, and HAVING clauses that select gender, and the...

1Write an SQL statement utilizing the WHERE, LIKE, and HAVING clauses that select gender, and the email addresses that belong to female users and have an email address that contains a number (0 to 9) within it. Create an alias for the resultant email column name and name it ‘Email Addresses Female With Numbers’

  1. IPV4 (Internet Protocol Version 4) addresses utilize a notation known as the dotted-quad notation. Quad because an IPV4 address is actually a series of 4 numbers separated by a dot (hence dotted quad). Each one of the numbers has a range of 0-255. For example 255.0.65.23 is a valid IPV4 address, and so is 2.2.2.2. However, 2682.586.549.365 is NOT a valid IPV4 address (thank me later for not using IPV6 addresses for this – Google IPV6 and you will see what I mean).

    1. Write an SQL insert statement that will insert 4 rows with invalid IPV4 addresses.

    2. Write an SQL statement that will find all the rows with invalid IPV4 addresses.

      1. To do this you will need to utilize regular expressions. This is the research

        component of the lab.

      2. Regular expression documentation:

        https://dev.mysql.com/doc/refman/5.6/en/regexp.html

      3. You can look up the regular expression, you do not have to write one from scratch, but it is always a good thing to look up the syntax of regular expressions to be able to understand them.

      4. You need to validate that there are 4 numbers separated by dots each with a length of 1-3 (e.g., 999.999.999.999 is considered a valid IP address in your regular expression even though it is not in reality). Validating that there are 4 numbers separated by dots each with a length of 1-3 AND are less than 256 is a little complicated, but I encourage you to take on the challenge.

      5. By now you should see how the query from b can be created in a much cleaner fashion.

In: Computer Science

If you currently own a business or are thinking about starting a business. What are defensive...

If you currently own a business or are thinking about starting a business. What are defensive actions you would take to protect your business against some of the perils over which you have minimal control (taxes, interest rate, etc.)? Please I need a mini essay thanks

In: Finance

In this module, you learned about the components involved in the effective management of operations. This...

In this module, you learned about the components involved in the effective management of operations.

This video case is about Numi Organic which is the tea of choice for high-end restaurants, hotel chains, and cruise lines.

View Numi Organic Tea: The Value Chain, IT, and E-Business (Time: 6:56. This video uses the Amara Toolbar to display captions.) and answer the following questions by providing 1-2 paragraphs for each item:

How does Numi’s relationship with third parties address operations systems elements in areas related to product-mix, capacity, facilities, and layout? What is the benefit of their approach?

Describe the technologies and tools used by Numi in managing performance. Why did the tea maker eventually adopt a more complex information technology system?

In: Operations Management

Describe the emergence and subsequent decline of the political risk analysis industry. Discusses what political risk...

Describe the emergence and subsequent decline of the political risk analysis industry. Discusses what political risk means for multinational firms and various ways in which firms have tried to analyze and grapple with these risks.

In: Operations Management

given pair (a,b) after each unit of time pair (a,b) get changed to (b-a,b+a).you are given...

given pair (a,b) after each unit of time pair (a,b) get changed to (b-a,b+a).you are given the initial value of pair and an integer n and you to print the value of pair at the nth unit of time.

input format:

1.First line:t donating the number of test cases

2.Next t lines:three space-seperated integer a,b and n

output format :

for each test case ,print two integers (mod 10^9 +7) per

line denoting the value of the pair at the n th unit time.

constrains:

1<t< 10^6

0< a<b<10^9

1<n<10^5

sample input :

5

1 3 5

2 3 9  

sample output

4 12

32 48

81920 131072

In: Computer Science

The purpose of this problem is to gain familiarity with stacks and queues. You have three...

The purpose of this problem is to gain familiarity with stacks and queues. You have three jugs that can hold c1, c2, and c3 liters of water, respectively. Initially, jug 1 is full and the other two jugs are empty. You can repeat the following procedure any number of times: Choose two of the jugs and pour the contents of one into the other until either the first is empty or the second is full. Your goal is to end up with exactly d liters in one of the jugs. Make a program called WaterTransfer.java to determine the transfers required to reach the goal. The input is a single line containing four integers between 2 and 100 (inclusive) representing c1, c2, c3, and d. The output is a minimal sequence of jug contents, starting with the initial contents and ending with one of the jugs containing d liters. Each line of the output should consist of 3 integers separated by spaces. If no solution exists, then your program should produce no output.

Good test case: 10 5 3 4 ; from movie ”Die hard: with a vengeance”; seehttps://www.youtube.com/watch?v=6cAbgAaEOVE

For example, if the input is 20 5 3 4t hen a valid output is

20 0 0

15 5 0

15 2 3

18 2 0

18 0 2

13 5 2

13 4 3

There may be other solutions, but none with fewer transfers (6) than this one. (this code should probably use queues)

In: Computer Science

What role will technology and communications play for Nvidia in the future? How will they impact...

What role will technology and communications play for Nvidia in the future? How will they impact society?

In: Operations Management

Reflect on how we can apply the positive leadership model to higher education? What does it...

Reflect on how we can apply the positive leadership model to higher education? What does it mean to be a positive leader? What are alternative approaches and why is a positive leader the most appropriate for higher education?

In: Psychology