In: Computer Science
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
In: Computer Science
I need a flow chart built in raptor and the Java source code in the source folder (src)
Please fully document the program: add comments to describe all major parts of the solution. SO that I can understand how and why the code was built that way.
Problem specifications:
-The TSA want you to design and code a program that will be used to screen travelers through AirportX. When a traveler arrives at the airport, he/she is required to go through a checkpoint for COVID-19. The traveler temperature is checked and a recommendation is made for the traveler to be quarantined or not.
A traveler will be quarantined if all of the following conditions are met:
-the temperature read for the traveler is 100.4 or more degrees Fahrenheit.
-the traveler is coughing.
-the traveler is experiencing a shortness of breath.
What need to be collected about a traveler?
Beside collecting all of the above information about a traveler, the first name and last name and passport number of the traveler are collected only if the traveler is to be quarantined.
What to do?
-develop a full solution made up of a short analysis of the problem, a flowchart using Raptor, another flowcharting program, or even by hands, and a full Java program.
In: Computer Science
Some monkey flowers (Mimulus guttatus) living near the sites of copper mines can grow in soil containing high concentrations of copper, which is toxic to most plants. Copper tolerance is a heritable trait.
The map below shows the area near an old copper mine, which contaminated the nearby soil with copper. A stream flows past the mine toward the lake at the bottom right of the map.

| The population that existed before mining must have included both copper-tolerant and copper-intolerant plants. | |
| Nearly 100% of monkey flowers growing in copper-contaminated soil are copper tolerant. | |
| Natural selection favors copper tolerance in all soils near the old mine, not only in the contaminated soils. | |
| Copper contamination in the soil created copper-tolerant plants. | |
| Copper-tolerant plants are found only in contaminated soils. | |
| If you were to test monkey flowers growing on the shore of the lake, you would expect nearly 100% of them to be copper tolerant. |
In: Biology
A student desires to know if two-bedroom apartments for rent near
the BRCC campus in Baton Rouge are significantly different, on
average, than one-bedroom apartments for rent near the BRCC campus
in Baton Rouge. The student collects data for a random sample of
ten (10) advertisements for each of one-bedroom and two-bedroom
apartments for rent near the BRCC campus in Baton Rouge. The data
below shows the advertised rents (in dollars per month) for the
selected apartments.
1 Bedroom
550
695
640
580
595
600
495
675
595
525
2 Bedroom
645
725
580
750
575
635
695
650
655
575
Set up and carry out an appropriate test to determine whether there
is convincing evidence that drinking coffee improves memory. Be
sure to provide the type of test used, the correct hypotheses, the
test statistic, the P-value, assumptions necessary (if any), and
the conclusions in context. Assume unequal variances in the
populations.
Then, provide and interpret a 99% confidence interval for the
hypotheses that you test in (a). What conclusion(s) do you make in
context?
In: Statistics and Probability
What role does accountability play in ensuring the consistent delivery of quality care? What are some of the hallmarks of a culture built on this concept? List a few tactics that create such a culture.
This is for a health care advocacy class
In: Psychology
Create a structure array that contains the following information fields concerning the road bridges in a town: bridge location, maximum load (tons), year built, year due for maintenance. Then enter the following data into the array:

In: Mechanical Engineering
Do you agree with the following statement? Justify your answer.
Although the industry is moving toward component-based construction, most software continues to be custom-built.
# please short answer in your words
In: Computer Science
Use C programming to Implement the breadth-first tree traversal. The tasks are:
a) Build the tree.
b) Perform breadth first traversal on the tree that you have built at step
a).
Note: "Please comment the program"
In: Computer Science
JB Co. is planning to invest in a new koala theme park. The investment will generate $4.5 million p.a. for 15 years with the first cash inflow received in one year's time. The required rate of return for this type of investment is expected to be 6% p.a. for years 1-9 rising to 11% p.a. for years 10-15. What is the most JB Co. should pay for this investment now?
In: Finance