Questions
Java program Reverse polish notation: using stack - You can use the Stack included in java.util.Stack...

Java program

Reverse polish notation: using stack - You can use the Stack included in java.util.Stack (or your own implementation) for this problem.

Reverse Polish notation is a notation where every operator follows all of its operands. For example, an expression (1+2)*(5+4) in the conventional Polish notation can be represented as 1 2 + 5 4 + * in the Reverse Polish notation. One of advantages of the Reverse Polish notation is that it is parenthesis-free.

Write a program which reads an expression in the Reverse Polish notation and prints the computational result.

An expression in the Reverse Polish notation is calculated using a stack. To evaluate the expression, the program should read symbols in order. If the symbol is an operand, the corresponding value should be pushed into the stack. On the other hand, if the symbols is an operator, the program should pop two elements from the stack, perform the corresponding operations, then push the result in to the stack. The program should repeat this operations.

Input: An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character.

You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106

Output: Print the computational result in a line.

Constraints:

2 ≤ the number of operands in the expression ≤ 100
1 ≤ the number of operators in the expression ≤ 99
-1 × 109 ≤ values in the stack ≤ 109

Sample Input 1

1 2 +

Sample Output 1

3

Sample Input 2

1 2 + 3 4 - *

Sample Output 2

-3

In: Computer Science

what typical activities should be performed in the stage or phase of system analysis of any...

what typical activities should be performed in the stage or phase of system analysis of any methods or models of SDLC

In: Computer Science

C++ Program A company pays its salespeople on a commission basis.  The salespeople each receive $250 per...

C++ Program

A company pays its salespeople on a commission basis.  The salespeople each receive $250 per week plus 11 percent of their gross sales for the sales period.  For example, a salesperson who grosses $5000 in sales in the period receives $250 plus 11 percent of $5000, or a total of $812.21.  Write a program (using an array of counters) determines for each salesperson their total sales, their salary and additional data points.  There are 12 salesmen for the company.  The input data file is "SalesPerson SalesV3.txt". It contains the salesperson number (3 digit id) followed by his sales.   Each salesperson has numerous sales listed for the period.  You will need to keep up with the total number of sales and of course the total sales per salesman.

Output :  

             1. Print out the Sales report showing the salesmen ID, his total number of sales, his total sales      
and his average per sale.  Show the report in sorted ordered by Sales ID.

    2.  Print out the same report but this time print out in sorted ordered by total sales.

    3.  Print out the same report again sorted on average sales.

The company is looking at a reduction in sales force.  So I need to know which salesman had the smallest total sales.  Print out the worsted salesman, his total sales and percentage of his sales compared to the second worsted salesman.  (Just to see how off his sales really are compared to one other. ie did he have a bad sales period or he is really a bad salesman.)

SalesPerson SalesV3.txt

322 10.80
848 920.00
828 1267.00
848 8320.00
229 66330.00
254 6670.00
689 520.00
691 4880.00
828 3860.00
848 2820.00
229 7848.00
828 60.00
848 820.00
229 8115.00
546 1280.00
828 660.00
848 320.00
190 325.00
828 263.00
848 9315.00
828 3860.00
848 2093.00
322 4225.00
254 960.00
689 220.00
691 436.00
322 4210.00
689 520.00

In: Computer Science

1. Please briefly describe in one short paragraph a valuable business problem that you are interested...

1. Please briefly describe in one short paragraph a valuable business problem that you are interested in solving and how designing a database can help in solving this problem. You should treat this database design project as something you can put on your CV and explain to potential employers (or potential investors if you are pursuing a startup).

2. Create three tables that you will use in your database. Write the SQL code (can be done in PgAdmin or in MS Word etc.). Then write a short paragraph explaining the purpose of each table.

In: Computer Science

Use the internet and research the impact that information technology and the internet has on society,...

Use the internet and research the impact that information technology and the internet has on society, the economy, and the environment. Give positive and negative examples.

In addition, discuss strategies for safeguarding computers, mobile devices, and networks against attacks while using the internet.

In: Computer Science

SQL Consider the following business question and determine which of the following should be included in...

SQL

Consider the following business question and determine which of the following should be included in a fact/dimension table of the star schema

            What was the revenue of the McDonald’s in Russia and France in 2017?

A. Russia

B. France

C. Revenue

D. Countries

Answer for both Fact and Dimension tables.

Please determine from the question which is part of the fact, and which is part of the dimension. There should be two answers.

In: Computer Science

Create a C++ program that will prompt the user to input an integer number and output...

Create a C++ program that will prompt the user to input an integer number and output the corresponding number to its numerical words. (From 0-1000000 only)

**Please only use #include <iostream> and switch and if-else statements only. Thank you.

Ex.
Enter a number: 68954
Sixty Eight Thousand Nine Hundred Fifty Four

Enter a number: 100000
One Hundred Thousand

Enter a number: -2
Number should be from 0-1000000 only

In: Computer Science

In C programming language how do you find if all the character on a single line...

In C programming language how do you find if all the character on a single line in a 2 dimensional array are the same?

The program should read line by line to check if all the characters on a line are the same. For this program we want to see if the * character ever shows up on a line where it is the only character on the line. as seen below.

so lets say we have a array with the following data:

Note(this is a 5x7 two dimensional array)

D C D D * D C

D C C C D * *

* * * * * * *

D C C D * D *

* * * * * * *

So i want to return the amount of lines that have the * in every position in that row. So in this array 2 lines have all the same characters which is a * so it should print "The amount of lines where the * character is the only character that appears is 2"

In: Computer Science

Write a C program Your program will prompt the user to enter a value for the...

Write a C program

Your program will prompt the user to enter a value for the amount of expenses on the credit card. Retrieve the user input using fgets()/sscanf() and save the input value in a variable. The value should be read as type double. The user may or may not enter cents as part of the input. In other words, expect the user to enter values such as 500, 500.00 and 500.10. The program will then prompt the user to enter the Annual Percentage Rate (APR) for the credit card. This value should also be read as type double and saved in a second variable. Next, your program will prompt the user to enter the number of days money is borrowed. This value should be read as type int. After the values have been entered, your program will calculate the amount of the interest and save the result in a fourth variable. The program will then add the interest amount to the expense amount and save this result in a fifth variable. Finally, it will print all five variables (expense amount, APR, number of days, amount of interest and total amount to be paid back) to the screen in an informative format. Ensure that the floating point output always displays exactly two decimal places. Also, values of a magnitude less than 1 should display a leading 0 (ex. 0.75).

For interest calculation, we will use the compound interest method, in which, we consider not only the interest on the actual borrowed amount, but also the interest of interest that has already accrued. We will use the following simple formula to compute compound interest:

         P' = P(1 + r/n)^(nt)

         where:
         P is the original principal sum
         P' is the new principal sum
         r is the annual interest rate
         n is the compounding frequency (we assume it to be 12, like most US banks)
         t is the overall length of time the interest is applied (expressed in years).

The total compound interest generated is the final value minus the initial principal:

         I = P' - P

In order to compute the power function, you need to include math.h library and call the pow() function within it. See the man page of pow() to find more information about it. Also note that, the number of days money is borrowed needs to be converted to number of years. If you simply try days/365 to express it in terms of years, the result of the division is likely going to be incorrect. The annual interest rate, r, can be obtained from the annual percentage rate (APR), using r = APR/100.

Your program should check to ensure that negative values are not input. If an improper value is entered, an error message should be printed and the program will exit (do not re-prompt the user for a correct value).

For input, you must use the fgets()/sscanf() combination of Standard I/O functions. Do not use the scanf() or fscanf() functions. Although using scanf() for retrieving numerical data is convenient, it is problematic when used in conjunction with character string input (as you may discover if you use it in later labs). Therefore, it is best to get into the habit of avoiding scanf() completely, and using the fgets()/sscanf() combination exclusively.

In: Computer Science

You have been asked to create a project plan for the new machine learning model your...

You have been asked to create a project plan for the new machine learning model your company has asked you to build. List the main tasks and sub-tasks you would need to complete to create the model on AWS AND How would you measure the accuracy of the model you created?

In: Computer Science

Given the following mix of job, job lengths, and arrival times, assume a time slice of...

Given the following mix of job, job lengths, and arrival times, assume a time slice of 10 and compute the completion for each job and average response time for the FCFS, SJN, SRT, and Round Robin Scheduling Algorithm.

jobs arrival time CPU cycle(ms)

A 0 16

B 3 2

C 5 11

D 9 6

E 10 1

F 12 9

G 14 4

H 16 14

I 17 1

J 19 8

In: Computer Science

Question #1 Please specify he output of the following code (2.4) # import the pandas library...

Question #1 Please specify he output of the following code (2.4)
# import the pandas library and aliasing as pd
import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randn(8, 4),
index = ['a','b','c','d','e','f','g','h'], columns = ['A', 'B', 'C', 'D'])

# for getting values with a boolean array
print df.loc['a']>0

Question #2 Please specify the output of the following code (2.2)

import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randn(5, 3), index=['a', 'c', 'e', 'f',
'h'],columns=['one', 'two', 'three'])

df = df.reindex(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'])
print df.dropna(axis=1)

Question #3 Given the following temp.csv (2.1)

S.No,Name,Age,City,Salary
1,Tom,28,Toronto,20000
2,Lee,32,HongKong,3000
3,Steven,43,Bay Area,8300
4,Ram,38,Hyderabad,3900

Please specify what is the output of the following code:

import pandas as pd 

df=pd.read_csv("temp.csv",names=['a','b','c','d','e'],header=0)
print df

Question 4 Please describe what the following code is doing (2.3)

import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randn(10, 4),
      index = pd.date_range('1/1/2000', periods=10),
      columns = ['A', 'B', 'C', 'D'])
print df
r = df.rolling(window=3,min_periods=1)
print r['A'].aggregate(np.sum)

In: Computer Science

Comprehension and Coding 12. Nadha Skolar needs to write a method smallToBig() that will accept 3...

Comprehension and Coding 12. Nadha Skolar needs to write a method smallToBig() that will accept 3 integers as parameters and print out the sequence of numbers smallest to largest. For example, regardless of whether the sequence is 3 5 7, 5 7 3, 3 7 5, the method should print out 3 5 7. Nadha writes the following in IntelliJ and feels pretty confident until he submits the code to zyBooks… public static void smallToBig (int num1, int num2, int num3){ int min, middle, max; if (num1 <= num2){ min = num1; middle = num2; if (num1 <= num3) { middle = num1; max = num3; } else { middle = num3; max = num1; } } else { min = num2; middle = num1; if (num2 <= num3) { middle = num2; max = num3; } else { middle = num3; max = num2; } } System.out.println("Min = " + min + " Mid = " + middle + " Max = " + max); } Describe the error in Nadha’s program and how you could correct it. You do not have to code the fix

In: Computer Science

Research the topic of binary search trees. Write a brief summary of your understanding of this....

Research the topic of binary search trees. Write a brief summary of your understanding of this. Design a simple program, using pseudocode, that performs a search of a binary search tree.. In your own words, explain how a binary search tree works using graph theory terminology. Construct a binary search tree for any alphabetically ordered list of five words. Represent it visually as a graph. Discuss any characteristics you note about the graph you created in part (d). In your discussion, make sure to address the following: What are the degrees of each vertex? Is it a complete graph? Is the graph planar?

In: Computer Science

I need to make this into a Java Code: Write a program that prompts the user...

I need to make this into a Java Code:

Write a program that prompts the user for a double value representing a radius. You will use the radius to calculate:

  • circleCircumference = 2πr
  • circleArea = πr2
  • sphereArea = 4πr2
  • sphereVolume = 43πr3

You must use π as defined in the java.lang.Math class.

Your prompt to the user to enter the number of days must be:

Enter radius:

Your output must be of the format:

Circle Circumference = circleCircumference
Circle Area = circleArea
Sphere Area = sphereArea
Sphere Volume = sphereVolume

Please make sure to end each line of output with a newline.

Please note that your class should be named CircleSphere.

In: Computer Science