Questions
Note: This is a single file C++ project - No documentation is required on this assignment....

Note: This is a single file C++ project - No documentation is required on this assignment.

Write a Fraction class whose objects will represent Fractions.

Note: You should not simplify (reduce) fractions, you should not use "const," and all of your code should be in a single file. In this single file, the class declaration will come first, followed by the definitions of the class member functions, followed by the client program.

You must provide the following member functions:

  1. A set() operation that takes two integer arguments, a numerator and a denominator, and sets the calling object accordingly.
  2. Arithmetic operations that add, subtract, multiply, and divide Fractions. These should be implemented as value returning functions that return a Fraction object. They should be named addedTo, subtract, multipliedBy, and dividedBy. In these functions you will need to declare a local "Fraction" variable, assign to it the result of the mathematical operation, and then return it.
  3. A boolean operation named isEqualTo that compares two Fraction objects for equality. Since you aren't reducing your Fractions, you'll need to do this by cross-multiplying. A little review: if numerator1 * denominator2 equals denominator1 * numerator2, then the Fractions are equal.
  4. An output operation named print that displays the value of a Fraction object on the screen in the form numerator/denominator.

Your class should have exactly two data members, one to represent the numerator of the Fraction being represented, and one to represent the denominator of the Fraction being represented.

Here's a hint for how you will set up your arithmetic operation functions: You need two Fractions. One is the parameter, one is the calling object. The function multiplies the calling object times the parameter and returns the result. In some ways it is similar to the comesBefore() function from the lesson. That function also needs two Fractions, and one is the calling object and one is the parameter.

When adding or subtracting Fractions, remember that you must first find the common denominator. The easy way to do this is to multiply the denominators together and use that product as the common denominator.

I am providing a client program for you below. You should copy and paste this and use it as your client program. The output that should be produced when the provided client program is run with your class is also given below, so that you can check your results.

I strongly suggest that you design your class incrementally. For example, you should first implement only the set function and the output function, and then test what you have so far. Once this code has been thoroughly debugged, you should add additional member functions, testing each one thoroughly as it is added. You might do this by creating your own client program to test the code at each stage; however, it would probably be better to use the provided client program and comment out code that relates to member functions that you have not yet implemented.

As you can see from the sample output given below, you are not required to reduce Fractions or change improper Fractions into mixed numbers for printing. Just print it as an improper Fraction. You are also not required to deal with negative numbers, either in the numerator or the denominator.

Here is the client program.

#include <iostream>
using namespace std;

int main()
{
    Fraction f1;
    Fraction f2;
    Fraction result;

    f1.set(9, 8);
    f2.set(2, 3);
    
    cout<<"\nArithmetic operations with fraction objects stored in the results class object\n"; 
    cout<<"------------------------------------------------------------------------------\n\n";

    cout << "The product of ";
    f1.print();
    cout << " and ";
    f2.print();
    cout << " is ";
    result = f1.multipliedBy(f2);
    result.print();
    cout << endl;

    cout << "The quotient of ";
    f1.print();
    cout << " and ";
    f2.print();
    cout << " is ";
    result = f1.dividedBy(f2);
    result.print();
    cout << endl;

    cout << "The sum of ";
    f1.print();
    cout << " and ";
    f2.print();
    cout << " is ";
    result = f1.addedTo(f2);
    result.print();
    cout << endl;

    cout << "The difference of ";
    f1.print();
    cout << " and ";
    f2.print();
    cout << " is ";
    result = f1.subtract(f2);
    result.print();
    cout << endl;

    if (f1.isEqualTo(f2)){
        cout << "The two Fractions are equal." << endl;
    } else {
        cout << "The two Fractions are not equal." << endl;
    }
    
    cout<<"\n---------------------------------------------------------\n"; 
    cout<<"\nFraction class implementation test now successfully concluded\n"; 
    // system ("PAUSE"); 
    return 0;
}

This client should produce the output shown here:

C++ CLASS SINGLE-FILE PROJECT Client.cpp - testing a Fraction class implementation 
----------------------------------------------------

Arithmetic operations with Fraction objects stored in the result class object 
------------------------------------------------------------------------------ 
The product of 9/8 and 2/3 is 18/24 
The quotient of 9/8 and 2/3 is 27/16 
The sum of 9/8 and 2/3 is 43/24 
The difference of 9/8 and 2/3 is 11/24 
The two Fractions are not equal. 
--------------------------------------------------------- 
Fraction class implementation test now successfully concluded 

Process returned 0 (0x0) execution time : 10.546 s Press any key to continue.

You may not change the client program in any way. Changing the client program will result in a grade of 0 on the project.

In: Computer Science

Assignment: Operating Budgeting Scenario Don Flowers, CEO of Burbage Manufacturing looked around the conference room as...

Assignment: Operating Budgeting

Scenario

Don Flowers, CEO of Burbage Manufacturing looked around the conference room as his management team chatted and settled in for the monthly meeting.

“Let’s get started,” Don said, “we have a lot to cover today, and frankly it’s not all good news.” The room fell quiet. Don continued, “As you know we recently experienced a cash shortage despite last quarter’s record sales. We can’t keep going back to the bank to borrow money to support operations. I am counting on each of you to figure out a way to keep this from happening in the future.”

Brian Mitchell, the newest member of the team raised his hand somewhat sheepishly. “Sir, perhaps if we looked at the Master Budget for last month we could begin to identify areas for improvement.”

Don looked to Alex, his CFO. “Well, Alex that’s your area of expertise and Brian’s suggestion makes sense. Let’s have a look at that Master Budget.”

Alex looked down at the desk and began shuffling through his paperwork. “Well Don, we don’t exactly have a Master Budget per se. I mean we have budgets for different areas within the company, but I really rely on the managers to know what they need to do in their areas.”

Terri, the production manager spoke up, “Hey, wait a minute Alex. You’re the CFO. I’m doing everything I can just to keep up with demand down there on the floor. I don’t have time to worry about that kind of thing. We had a press go down last week and I had an entire shift of down time. Besides, that’s your job, Alex.”

“You know she has a point there Alex. You are the CFO. I need Terri to put all of her time towards keeping the production line running smoothly,” Don said.

“Look, Don, Alex replied, “In January I asked everyone to send me their budgets for the year and the only thing I got was a sales budget from Peter with a note attached that asked for a pay increase for his account managers.”

Brian raised his hand to speak. “Well, I know I’m new here, but at my last company we had budgets for sales, finished goods, cash – pretty much everything was budgeted. It seemed to work pretty well, and everyone had a good grasp of where we were financially.”

Alex, the CFO gave Brian an icy stare.

Don turned to Alex. “Alex, I think this young man has a point. Is there some reason why we aren’t budgeting like he described?”

“Well”, Alex began, “It’s really complicated, Don. Marjorie in materials is short two people and she’s paying overtime to her remaining people just to meet supply requisitions from the shop floor. And then there’s the problem with the corporate office. Every time I turn around I am getting an invoice from them for some piece of office equipment or another. Last week I got a bill from some company that Jessica hired to water the plants. How am I supposed to keep track of all of this? And then ….”

Don raised his hand to cut Alex off. “Look, I know we are a complex organization – but the fact of the matter is that I can’t keep going to the bank every month, borrowing money to pay the suppliers. For heaven’s sake – we are a multi-million-dollar company.” By this time Don was red in the face and everyone around the table was showing an intense interest in the conference table. He continued, “What am I going to tell the shareholders at the annual meeting when we don’t have enough cash to pay a dividend – that Jessica spent their money on potted plants?”

“This is going to end, today. Brian, you seem like a smart young man. You are going to work with Alex and anyone else in this company to get us on board with establishing and using budgets to correct this situation,” Don explained. “Further, as for the rest of you -when Brian comes and asks you for information treat him as if it was me making the request. Understood?”

Everyone nodded their heads in agreement.

“Meeting adjourned,” Don declared.

Questions

1. Identify the problems that appear to exist in Burbage’s budgetary control system and explain how these problems are contributing to the company’s poor cash position.
2. Identify the budgets that Brian and Alex will need to create to resolve these issues, including the information that is needed to construct each budget.
3. Once you have identified the problems and necessary budgets, prepare a report for Don and the rest of the management team outlining your plan for establishing a budgetary control system, making certain to include how each component of the system will benefit the overall financial health of the company.

In: Operations Management

Important notes: Use Console I/O (Scanner and System.out) for all user I/O in this lab. Do...

Important notes: Use Console I/O (Scanner and System.out) for all user I/O in this lab.

Do not hard code data file paths or filenames; always ask the user for them.

Complete the Monster Attack project by doing the following: In place of the driver used in homework 2, add a menu with a loop and switch (this is already done, ignore this).

The user must be able to add attacks, get a report on existing attacks, save a file, retrieve a file, and clear the list as many times as she wants in any order she wants.

Replace the array of MonsterAttacks with an ArrayList of MonsterAttacks. This will require changes in several methods. You will need to be able to handle any number of MonsterAttacks the user chooses to input.

Add a method to AttackMonitor that saves the list of attacks to a comma separated values file. Iterate through the list, and for each attack, get each field using the getters from MonsterAttack. Write each value to the file, following each one except the last with a comma. Save the date as a single String in the format MM/DD/YYYY. After you have written out all the data for one attack, write out a newline. Add an item to the main menu that calls this method.

Add a method that clears the list of monster attacks, then uses a Scanner to read data from a .csv file, uses it to instantiate MonsterAttack objects, and adds the attacks to the list. This method must be able to read the files you write out in the method described above. You will need to use String's split() method here. Add an item to the main menu that calls this method. Make sure you can input attack data, save to a file, quit the program, start the program again, read your output file, and show the data from the file.

Below is the original code that needs to be modified to meet the requirements stated above.

MonsterAttack

//side note- the date is incorrect here.. user is supposed to enter the date.. but that shouldn't matter.. still works

import java.util.Date;
class MonsterAttack {
private String monsterName;
private String attackLocation;
private double damagesInMillions;
private Date date;

public MonsterAttack(){
}

public MonsterAttack(String monsterName, String attackLocation, double damagesInMillions, Date date){
this.monsterName = monsterName;
this.attackLocation = attackLocation;
this.damagesInMillions = damagesInMillions;
this.date = date;
}

public String getMonsterName(){
return monsterName;
}
public String getAttackLocation(){
return attackLocation;
}
public double getDamagesInMillions(){
return damagesInMillions;
}
public Date getDate(){
return date;
}
public void setMonsterName(String monsterName){
this.monsterName = monsterName;
}
public void setAttackLocation(String attackLocation){
this.attackLocation = attackLocation;
}
public void setDamagesInMillions(double damagesInMillions){
this.damagesInMillions = damagesInMillions;
}
public void setDate(Date date){
this.date = date;
}
public String toString(){
return " Monster named " + monsterName + " attacked in " + attackLocation + " causing damages of " + damagesInMillions + " dollars in " + date;
}
}

AttackMonitor

import java.util.Scanner;
import java.util.Arrays;
import java.util.Date;


public class AttackMonitor {
Scanner in = new Scanner (System.in);
MonsterAttack[] monsterArray = new MonsterAttack[5];

double[] damagesArray = new double[5];
static double damages = 0;

private void reportAttack(){
for (int i = 0; i < 5; i++){
// if (i == 0)
// System.out.println("press enter");
in.nextLine();
System.out.println("name");
String name = in.nextLine();
System.out.println("location");
String location = in.nextLine();
System.out.println("damage ");
double millions = in.nextDouble();
System.out.println("date");
damagesArray[i] = millions;
Date date = new Date();
damages = damages + millions;
MonsterAttack a = new MonsterAttack(name, location, millions, date);
monsterArray[i] = a;
}
}

private void printAttacks(){
for (int x = 0; x < monsterArray.length; x++){
System.out.println(monsterArray[x]);
}
}

private void showDamages(){
for (int i = 0; i < damagesArray.length; i++){
System.out.println("damage for attack " + (i+1) + ": " + damagesArray[i]);
}
System.out.println("total damages: " + damages);
System.out.println("average damage: " + damages/5);
}

private void findEarliestAttack () {
Date early = monsterArray[0].getDate();
for (int i = 0; i < monsterArray.length; i++){
if (early.compareTo(monsterArray[0].getDate()) > 0){
early = monsterArray[i].getDate();
}
}
System.out.println(early);
}

public void menu(){
String[] choices = { "Quit", "report attacks", "show attacks", "show damages", "find earliest attack"};
int choice;
do {
System.out.println("Enter\n 0 to quit,\n 1 to report attacks, \n 2 to show attacks, \n 3 to show damages, \n 4 to find earliest attack");;
choice = in.nextInt();
switch(choice){
case 0:
break;
case 1:
reportAttack();
break;
case 2:
printAttacks();
break;
case 3:
showDamages();
break;
case 4:
findEarliestAttack();
break;
}
} while (choice !=0);
}
}

MonitorDriver

import java.util.Scanner;
import java.util.Arrays;
import java.util.Date;
public class MonitorDriver{
public static void main (String[] args){
AttackMonitor test = new AttackMonitor();
test.menu();

}
}

In: Computer Science

This is my current code for a question that asks: "Implement the stack methods push(x) and...

This is my current code for a question that asks: "Implement the stack methods push(x) and pop() using two queues". It works well, other than I want it to work for data of type T, not just Int's. (EXCUSE THE INDENTING... CHEGG POSTING DOESNT ALLOW PROPER CODE TO BE UPLOADED... JUST COPY PASTE IT INTO ECLIPSE IDE, HIGHLIGHT ALL CODE, PRESS COMMAND+SHIFT+F AND SHOULD AUTO-FORMAT)

MY QUESTION: How could one modify this code in order to take data of type T, rather than only Int's?

PS: the code must continue to use the data structure provided.... must use the Queue class built... (can't use built-in ArrayList from Java).

HERE IS MY CODE CURRENTLY

//author: Nicolas Wills

package ass1Q1B;

public class StackUsingTwoQueues {

public Queue queue1 = new Queue();

public Queue queue2 = new Queue();

// public int s = queue1.size()+queue2.size(); //dont really use this

// variable... ignore it

public boolean inQueue1 = false; // inQueue1 is true when elements are in queue1. set to false to start means

// first add(x) will add to queue1 first

public void push(int x) { // queue1 holds data when there's an odd number of elements, queue2 holds data

// when even number of elements

if (!inQueue1) { // elements not in queue1, therefore will push to queue1, then transfer queue2

// elements to queue1

queue1.add(x); // add pushed element to previously empty queue1

int queue2StartSize = queue2.size(); // use this variable for "for-loop"... cant put "for(int i=0;

// i

// changes the return value of queue2.size().

for (int i = 0; i < queue2StartSize; i++) {

try {

queue1.add(queue2.remove()); // remove beginning element of queue1, add it to queue2

} catch (NoSuchElementException e) {

}

;

} // end for loop

inQueue1 = true;

} // end else if

else if (inQueue1) { // previous push() added to queue1, therefore add "x" to queue2.

queue2.add(x); // add pushed element to previously empty queue2

int queue1StartSize = queue1.size(); // use this variable for "for-loop"... cant put "for(int i=0;

// i

// change the return value of queue1.size().

for (int i = 0; i < queue1StartSize; i++) {

try {

queue2.add(queue1.remove()); // remove beginning element of queue1, add it to queue2

} catch (NoSuchElementException e) {

}

;

} // end for loop

inQueue1 = false;

} // end else if

}// end push method

// the running time of push O(n+1) time. n for the loop, 1 for the resize()

// operation

public Integer pop() {

Integer x = null; // very sketchy way to get around error

try {

if (inQueue1) {

x = queue1.remove(); // if the elements are currently in queue1, remove first element from queue1

} else {

x = queue2.remove(); // if the elements are currently in queue2, remove first element from queue2

}

} catch (NoSuchElementException e) {

}

;

return x;

}// end pop() method

// the running time of the pop() method is O(1)

public String printArray() {

if (inQueue1) {

return (queue1.stringedArray()); // if the elements are currently in queue1, printArray() will return a

// string version of the contents of queue1

} else

return (queue2.stringedArray()); // if the elements are currently in queue2, printArray() will return a

// string version of the contents of queue2

}

public static void main(String[] args) {

StackUsingTwoQueues myStack = new StackUsingTwoQueues();

// push elements

myStack.push(1);

System.out.println(myStack.printArray());

myStack.push(2);

System.out.println(myStack.printArray());

myStack.push(3);

System.out.println(myStack.printArray());

myStack.push(4);

System.out.println(myStack.printArray());

myStack.push(5);

System.out.println(myStack.printArray());

myStack.push(6);

System.out.println(myStack.printArray());

myStack.push(7);

System.out.println(myStack.printArray());

myStack.push(8);

System.out.println(myStack.printArray());

myStack.push(9);

System.out.println(myStack.printArray());

myStack.push(10);

System.out.println(myStack.printArray());

// pop elements

myStack.pop();

System.out.println(myStack.printArray());

myStack.pop();

System.out.println(myStack.printArray());

myStack.pop();

System.out.println(myStack.printArray());

myStack.pop();

System.out.println(myStack.printArray());

myStack.pop();

System.out.println(myStack.printArray());

myStack.pop();

System.out.println(myStack.printArray());

myStack.pop();

System.out.println(myStack.printArray());

}

}

package ass1Q1B;

//import ass1Q1.illegalOperation;

//import ass1Q1.priorityQ;

public class Queue {

int[] arr = new int[10];

int j=0; // keeps track of index of front of array

int n = 0; //number of elements in array

public int size() {

return n;

}

public boolean add(int x) { // why cant i just return void

if ((n + 1) > arr.length)

resize();

arr[(j + n) % arr.length] = x;

n++;

return true;

}

private void resize() { // only function in queue class that can be private right?

int[] b = new int[(Math.max(1, n * 2))];

for (int k = 0; k < n; k++)

b[k] = arr[(j + k) % arr.length];

arr = b;

j = 0;

}

public int remove() throws NoSuchElementException {

if (n == 0)

throw new NoSuchElementException("cant remove if theres no elements to remove");

int x = arr[j];

j = (j + 1) % arr.length;

n--;

if (arr.length >= 3 * n)

resize();

return x;

}

public String stringedArray() {

String returnString = "";

for(int i=0; i

returnString+= arr[(i+j)%(arr.length)];

}

return returnString;

}

}

In: Computer Science

Please convert this java program to a program with methods please. import java.io.*; import java.util.*; public...

Please convert this java program to a program with methods please.

import java.io.*;
import java.util.*;

public class Number{

public static void main(String[] args) {
  
Scanner scan = new Scanner(System.in);

System.out.println("Enter 20 integers ranging from -999 to 999 : "); //print statement

int[] array = new int[20]; //array of size 20

for(int i=0;i<20;i++){

array[i] = scan.nextInt(); //user input

if(array[i]<-999 || array[i]>999){ //check if value is inside the range

System.out.println("Please enter a number between -999 to 999");
i--;
}
}

// Now we have to create 4 array for odd,even,positive,negative number

int odd = 0; //initializing as zero
int even = 0;
int positive = 0;
int negative = 0;

for(int i=0;i<20;i++){

if(array[i]%2 == 0){ //check if even

even++; //increment
}
if(array[i]%2 != 0){ //check if odd

odd++; //increment
}
if(array[i]>0){ //check if positive

positive++; //increment
}   
if(array[i]<0){ //check if negative

negative++; //increment
}
}

//Now initializing array for all

int[] oddA = new int[odd]; //arrays of required size
int[] evenA = new int[even];
int[] positiveA = new int[positive];
int[] negativeA = new int[negative];

int countOdd = 0; //initializing as zero
int countEven = 0; //for array indexing
int countPositive = 0;
int countNegative = 0;

for(int i=0;i<20;i++){

if(array[i]%2 == 0){ //check if even

evenA[countEven] = array[i]; //Putting value
countEven++;
}
if(array[i]%2 != 0){ //check if odd

oddA[countOdd] = array[i]; //Putting value
countOdd++;
}
if(array[i]>0){ //check if positive

positiveA[countPositive] = array[i]; //Putting value
countPositive++;   
}   
if(array[i]<0){ //check if negative

negativeA[countNegative] = array[i]; //Putting value
countNegative++;   
}
}

//Difference between highest and lowest positive number

int highest = -1000; //Initialize
int lowest = 1000;

for(int i=0;i<20;i++){

if(array[i]>0 && array[i]>highest){ //condition for highest positive number

highest = array[i];
}
if(array[i]>0 && array[i]<lowest){ //condition for lowest positve number

lowest = array[i];
}
}

int diff = highest - lowest; //difference

//Sum of all negative numbers

int sumNegative = 0;

for(int i=0;i<negative;i++){

sumNegative = sumNegative + negativeA[i]; //sum of negative number
}

int input = 0;

do{

System.out.println("Enter your choice : ");

System.out.println("1. The orginal array");
System.out.println("2. The array of all odd numbers");
System.out.println("3. The array of all even numbers");
System.out.println("4. The array of all positive numbers");
System.out.println("5. The array of all negative numbers");
System.out.println("6. The highest and lowest postive value and difference between them");
System.out.println("7. The sum of all negative numbers");
System.out.println("8. Display all positive appearing in positive array whose value is less than 50");
System.out.println("9. Display all even numbers in reverse order");
System.out.println("10. Display all multiples of 5 (positive or negative)");

int choice = scan.nextInt(); //user choice

switch(choice){

case 1 :

for(int i=0;i<20;i++){

System.out.print(array[i]+" ");
}
System.out.println("");
break;

case 2 :

for(int i=0;i<odd;i++){

System.out.print(oddA[i]+" ");
}
System.out.println("");
break;

case 3 :

for(int i=0;i<even;i++){

System.out.print(evenA[i]+" ");
}
System.out.println("");
break;

case 4 :

for(int i=0;i<positive;i++){

System.out.print(positiveA[i]+" ");
}
System.out.println("");
break;

case 5 :

for(int i=0;i<negative;i++){

System.out.print(negativeA[i]+" ");
}
System.out.println("");
break;

case 6 :

System.out.println("The highest positive value is : " + highest);
System.out.println("The lowest positive value is : " + lowest);
System.out.println("The difference between the highest and lowest positve value is : " + diff);
break;

case 7 :

System.out.println("The sum of all negative number is : " + sumNegative);
break;

case 8 :

for(int i=0;i<positive;i++){

if(positiveA[i]<50){

System.out.print(positiveA[i]+" ");
}
}
System.out.println("");
break;

case 9 :

for(int i=even-1;i>=0;i--){

System.out.print(evenA[i]+" ");
}
System.out.println("");
break;

case 10 :

for(int i=0;i<20;i++){

if(array[i]%5 == 0){

System.out.print(array[i]+" ");
}
}
System.out.println("");
break;
}

System.out.println("Do you wish to continue : (1 or 0) : Press 1 to continue : ");

input = scan.nextInt();

}while(input == 1);
}
}

In: Computer Science

Skills needed to complete this assignment: linked lists, stacks. Postfix notation, is a mathematical notation in...

Skills needed to complete this assignment: linked lists, stacks.

Postfix notation, is a mathematical notation in which operators follow their operands; for instance, to add 3 and 4, one would write 3 4 + rather than 3 + 4 (infix notation). If there are multiple operations, operators are given immediately after their second operands; so, the expression written 3 − 4 + 5 in conventional notation would be written 3 4 − 5 + in postfix notation: 4 is first subtracted from 3, then 5 is added to it. An advantage of postfix notation is that it removes the need for parentheses that are required by infix notation. While 3 − 4 × 5 can also be written 3 − (4 × 5), which is different from (3 − 4) × 5. In postfix notation, the former could be written 3 4 5 × −, while the latter could be written 3 4 − 5 × or 5 3 4 − ×.

Stacks can be used to evaluate expressions in postfix notations by following these steps: • If a number is typed, push it on the stack. • If an operation is typed, depending on the operation, pop off two numbers from the stack, perform the operation, and push the result back on the stack. You should complete the Stack class and other functions in the template file (found on Carmen) so that when the user enters an expression in postfix notation, the program calculates and shows the result. In this assignment the user enters one-digit positive numbers only, but the result can be any integer. Only basic operations (i.e. +, -, /, *) are entered by the user and integer division is used in calculations. User input ends with a semicolon.

Class Stack uses a linked list to implement a stack, and it has five public member functions:

• Default constructor: initializes the stack to an empty stack • isEmpty: returns true if the stack is empty and false otherwise

• push: pushes a new number to the top of stack

• pop: removes the top of stack

• top: returns the value at the top of stack, does not remove it from stack

You must use the template file and only add you code were you see /*your code here*/. Do not modify other parts of the code. Do not use C/C++ libraries other than iostream and cstdlib.

template code

#include <iostream>
#include <cstdlib>

using namespace std;

const char SENTINEL = ';';

struct Node {
int data;
Node *link;
};

// precondition: c is initialized
// postcondition: returns true if c is '+', '-', '*' or '/'
bool isOperator(char c);

// precondition: o1 and o2 are initialized and op is an operator
// postcondition: returns op(o1, o2), e.g. if op is '-' then returns o1-o2
int calculate(int o1, int o2, char op);

// precondition: c is a digit
// postcondition: returns the integer value of c
int charToInt(char c);

class Stack {

public:
// default constructor
// initializes the stack to an empty stack
Stack();

// this is a const function, meaning it cannot change any of the member variables
// returns true if the stack is empty, false otherwise
bool isEmpty() const;

// this is a const function, meaning it cannot change any of the member variables
// returns the value at the top of stack, does not modify the stack, does not check if the stack is empty or not
int top() const;

// adds data to the top of stack
void push(int data);

// removes the top value of stack, does not return it, does nothing if the stack is empty
void pop();

private:
Node *listHead; // pointer to the head of a linked list

};

int main() {
char in;
Stack operandStack;

cout << "Enter a postfix expression (ending with " << SENTINEL << " and press Enter):\n";
cin >> in ;
while ( in != SENTINEL) {
if (isOperator( in )) {
// pop two numbers from stack
int n1, n2;
if (operandStack.isEmpty()) {
// pring error message
/*your code here*/

exit(1);
}
n2 = operandStack.top();
operandStack.pop();

if (operandStack.isEmpty()) {
// pring error message
/*your code here*/

exit(1);
}
n1 = operandStack.top();
operandStack.pop();

// push the result of calculation to the top of operandStack
/*your code here*/

} else {
// push the number to the top of opernadStack
/*your code here*/

}
cin >> in ;
}

// pop a number from the top of stack
int result;
result = operandStack.top();
operandStack.pop();

if (operandStack.isEmpty()) // nothing left in the stack
cout << "\nThe result is: " << result << endl;
else // there are still numbers in the stack
{
// pring an error message
/*your code here*/

}

return 0;
}

Stack::Stack() {
/*your code here*/
}

bool Stack::isEmpty() const {
/*your code here*/
}

int Stack::top() const {
/*your code here*/
}

void Stack::pop() {
/*your code here*/
}

void Stack::push(int data) {
/*your code here*/
}

int calculate(int o1, int o2, char op) {
/*your code here*/
}

bool isOperator(char c) {
return c == '+' || c == '-' || c == '*' || c == '/';
}

int charToInt(char c) {
return (static_cast<int>(c) - static_cast<int>('0'));}

In: Computer Science

-The table below details the individual Consumer Price Indices (CPI) for individual expenditure categories for 2016...

-The table below details the individual Consumer Price Indices (CPI) for individual expenditure categories for 2016 and 2017:

CPI Category

2016

2017

Price Change

Gasoline

195.915

216.781

Apparel

122.637

120.614

College textbooks

346.15

342.34235

What was the price change between 2016 and 2017 in the gasoline expenditure category?

1. 216.781%

2. 110.65%

3. 10.65%

4. 195.915%

please explain me how to calculate and answers.

- Read the following excerpt from a U.S. Energy Information Administration Report that was published on January 9, 2018:

Crude Oil Prices. Brent crude oil averaged $54/barrel (b) in 2017, an increase of $10/b from 2016 levels. Prices increased fairly steadily through the second half of the year, with year-end prices higher than the annual average. Daily Brent spot prices ended 2017 near $67/b, which was the highest level since December 2014. The monthly average spot price of Brent crude oil increased by $2/b in December to $64/b, marking only the fourth time that monthly Brent crude oil prices averaged more than $60/b in the past 36 months

Most of the upward price movement in recent months reflects continuing draws in global oil inventory levels. EIA estimates that global petroleum and other liquid fuels inventories fell by an average of 0.4 million b/d in 2017, which was the first year of annual average draws since 2013. In addition, oil prices were supported by OPEC’s November 30, 2017, announcement to extend its crude oil supply reduction agreement through the end of 2018. Also, Brent prices increased in December because of a disruption to the North Sea’s Forties crude oil pipeline system early in the month. The Forties pipeline system is one of the primary distribution networks for Brent crude oil delivery in the North Sea, and its outage curtailed available supply in the near term. Trade press reports indicate the Forties pipeline system restarted operations in late December 2017.

Questions:

Based on the excerpt, was the increase in the gasoline expenditure category CPI due to a change in supply or demand in the market?

1. Demand, because there were several factors affecting the market that were caused by producers of crude oil. In particular, inventory levels increased, OPEC extended production increases, and there was a disruption in a major pipeline system.

2. Supply, because there were several factors affecting the market that were caused by producers of crude oil. In particular, inventory levels declined, OPEC extended production reductions, and there was a disruption in a major pipeline system.

3. Supply because price increases are generally due to production decisions. In addition, supply creates its own demand, thus the supply side of the market will determine equilibrium prices.

4. Demand because as prices rose we saw a reduction in the quantity demanded in the market. This led to the reduction in crude oil inventory levels and the production disruptions.

what is answer?

-Read the following excerpt from a Forbes article that was published on November 3, 2017:

Now department stores’ frantic plunge into the off-price sector is in danger of killing off the full-price apparel business for good, experts warn.

In addition to discounting merchandise in their full-line stores, marked-down goods are increasingly feeding the pipeline in department stores’ ever burgeoning off-price channel, from the already heavily promotional Macy’s expanding its BackstageLinks to an external site. spin-off concept to Nordstrom’s Rack format.“The off-price business is driving growth and getting bigger than the full-price channel,” said Susan LeeLinks to an external site., a partner with consultancy Simon-Kucher.

Today, Nordstrom operates 216 Nordstrom Rack off-price stores, nearly double the number of its 122 full-line stores, just as Saks Fifth Avenue’s 39-store full-line chain is a fraction of its 118-store Off 5th outlet fleet.

The Amazon Factor

Amazon isn’t doing the full-price apparel business any favors either. While fashion brands are by no means flocking to the site, still fearful of losing control of their brand image, the discount-aggressive e-tailer is gunning for apparel, and has scored some big symbolic wins, such as itspartnership with NikeLinks to an external site..

Lord & Taylor department stores, for one, recently started pricing matching AmazonLinks to an external site.. (Not to mention partnering with Wal-Mart in an online mall venture.)

Questions:

Based on the excerpt, was the decrease in the apparel expenditure category CPI due to a change in supply or demand in the market?

1. Supply. This is due to a reduction in overall competition in the low priced apparel market.

2. Supply. This is due to increased competition among suppliers in the apparel market, which reduced prices.

3. Demand because consumers tastes and preferences shifted to higher priced apparel items.

4. Demand. This is due to decreased competition among suppliers in the apparel market, which reduced prices.

In: Economics

You have been hired as an accountant for KTZFIG Consulting Inc. This business was created when...

You have been hired as an accountant for KTZFIG Consulting Inc. This business was created when some friends decided to make use of their newly minted college degrees and go into business together. The business was created on July 1, 2018. The company will have a fiscal year end of June 30.   The initial formation transactions and early purchases for KTZFIG Consulting Inc. resulted in the balances that are included in the first 2 columns of the Worksheet. (see the worksheet tab)
During July, the first month of operations, the following transactions occurred:
Event
Borrowed 25,000 from the bank for operating cash. The note has a 6% interest rate (simple interest) and is to be paid back in 5 years
Purchased office furniture for $9,865.  
Paid $13,800 for 12 months rent on office space
Received $11,400 from SBoard Inc. for work to be performed over the next 12 months.
Paid $1,275 for utilities.
Paid $8,975 for purchases of supplies previously made on account.
Performed services for various customers for $12,750 cash and another $15,780 on account.  
Collected $11,680 as payment for amounts previously billed.
Purchased $10,660 of additional office supplies on account.
Paid salaries to employees totaling $3,850 for 1 week.
Dividends of $1,000 were declared and paid.
At the end of July, the following additional information is available to help determine what adjustments are needed:
Additional work for customers of $5,980 has been performed during the last week of July but not yet billed
One month of interest has accrued on the note payable for the bank loan.
Supplies on hand are $4,785.
One month of the prepaid rent has been used up
One month of the services for SBoard Inc. has been performed (see above).
Salaries of $3,850 are paid every Friday (for a 5 day work week). July 30, 2018 was a Tuesday.
Depreciation expense for the computer equipment is $140 and for the office furniture is $120
SUGGESTED STEPS FOR COMPLETION OF THE PROJECT:
Prepare journal entries to record the July transactions given. Please refer to the Worksheet tab for Account Titles you may need.
Add the July journal entry information to the Worksheet in the July columns. You can do this in one of 2 ways - (1) Post the journal entries to ledger accounts using T-accounts to represent ledger accounts and then use those totals to post to the worksheet or (2) use excel to add all entries for a particular account into the correct column in the worksheet (ie., add all cash debits from the journal entries into the cash debit column for July entries). There is a tab to use for T Accounts if you want but the T Accounts are NOT required
Prepare an unadjusted trial balance as of July 31, 2018. This will be part of the Worksheet you prepare. There is a tab in this file that you will use for this. Excel formulas must be used throughout the project to obtain full credit.
Prepare adjusting entries for the month of July given the information provided.
Post the adjusting entries to the Adjusting entries columns on the worksheet
Prepare an adjusted trial balance as of July 31, 2018. This will be part of the Worksheet you prepare. There is a tab in this file that you will use for this.
Prepare financial statements for the month ending July 31, 2018. (Income Statement, Statement of Retained Earnings, Classified Balance Sheet ). Formatting is important and will be graded so be sure you use dollar signs and underlines as appropriate. Also be sure you have headings and proper column usage for all statements. There is a tab for these statements. Heading are PARTIALLY completed for the 3 statements.
Prepare closing entries for the end of the period

Copy the Worksheet from the Worksheet tab to the Worksheet formulas tab and the Financial Statements from the Financial Statements tab to the Financial Statements tab. Highlight the entire worksheet/financial statements area respecively and press the "ctrl" key and the "~" key. This will cause the formulas used to display instead of the numbers. Save your file with the formulas displayed.

Worksheet - KTZFIG Consulting Inc
BEGINNING NUMBERS JULY ENTRIES UNADJUSTED TRIAL BALANCE ADJUSTMENTS ADJUSTED TRIAL BALANCE
ACCOUNT DEBIT CREDIT DEBIT CREDIT DEBIT CREDIT DEBIT CREDIT DEBIT CREDIT
Cash 120,500 22,065 142,565
Accounts Receivable 4,100 4,100
Supplies 8,975 10,660 19,635
Prepaid Rent 13,800 13,800
Land 30,000 30,000
Computer Equipment 49,500 49,500
Accumulated Depreciation, Comp Equip
Office Furniture 9,865 9,865
Accumulated Depreciation, Off Furn
Accounts Payable 8,975 1,685 10,660
Salaries Payable
Interest Payable
Unearned Revenue 11,400 11,400
Long-term Notes Payable 25,000 25,000
Common Stock 200,000 200,000
Retained Earnings
Dividends 1,000 1,000
Service Revenue 28,530 28,530
Salaries Expense 3,850 3,850
Rent Expense
Supplies Expense
Utilities Expense 1,275 1,275
Interest Expense
Depreciation Expense, Comp Equip
Depreciation Expense, Office Furniture
208,975 208,975 66,615 66,615 275,590       275,590


In: Accounting

On September 12, 1962, President John F. Kennedy delivered a speech at Rice University Stadium in...

On September 12, 1962, President John F. Kennedy delivered a speech at Rice University Stadium in Houston, Texas, in which he appealed for support of the National Aeronautics and Space Administration’s program to land humans on the Moon. The following passage is an excerpt from Kennedy’s speech. Read the passage carefully. Compose a thesis statement you might use for an essay analyzing the rhetorical choices Kennedy makes to accomplish his purpose. Then select at least four pieces of evidence from the passage and explain how they support your thesis.

In your response you should do the following:

  • Respond to the prompt with a claim that establishes a line of reasoning.
  • Select and use evidence to develop and support your line of reasoning.
  • Explain the relationship between the evidence and your thesis.

No man can fully grasp how far and how fast we have come, but condense, if you will, the 50,000 years of man’s recorded history in a time span of but a half-century. Stated in these terms, we know very little about the first 40 years, except at the end of them advanced man had learned to use the skins of animals to cover them. Then about 10 years ago, under this standard, man emerged from his caves to construct other kinds of shelter. Only five years ago man learned to write and use a cart with wheels. Christianity began less than two years ago. The printing press came this year, and then less than two months ago, during this whole 50-year span of human history, the steam engine provided a new source of power.

Newton explored the meaning of gravity. Last month electric lights and telephones and automobiles and airplanes became available. Only last week did we develop penicillin and television and nuclear power, and now if America’s new spacecraft succeeds in reaching Venus, we will have literally reached the stars before midnight tonight.

This is a breathtaking pace, and such a pace cannot help but create new ills as it dispels old, new ignorance, new problems, new dangers. Surely the opening vistas of space promise high costs and hardships, as well as high reward.

So it is not surprising that some would have us stay where we are a little longer to rest, to wait. But this city of Houston, this State of Texas, this country of the United States was not built by those who waited and rested and wished to look behind them. This country was conquered by those who moved forward—and so will space.

William Bradford, speaking in 1630 of the founding of the Plymouth Bay Colony, said that all great and honorable actions are accompanied with great difficulties, and both must be enterprised and overcome with answerable courage.

If this capsule history of our progress teaches us anything, it is that man, in his quest for knowledge and progress, is determined and cannot be deterred. The exploration of space will go ahead, whether we join in it or not, and it is one of the great adventures of all time, and no nation which expects to be the leader of other nations can expect to stay behind in the race for space.

Those who came before us made certain that this country rode the first waves of the industrial revolutions, the first waves of modern invention, and the first wave of nuclear power, and this generation does not intend to founder in the backwash of the coming age of space. We mean to be a part of it—we mean to lead it. For the eyes of the world now look into space, to the moon and to the planets beyond, and we have vowed that we shall not see it governed by a hostile flag of conquest, but by a banner of freedom and peace. We have vowed that we shall not see space filled with weapons of mass destruction, but with instruments of knowledge and understanding.

Yet the vows of this Nation can only be fulfilled if we in this Nation are first, and, therefore, we intend to be first. In short, our leadership in science and in industry, our hopes for peace and security, our obligations to ourselves as well as others, all require us to make this effort, to solve these mysteries, to solve them for the good of all men, and to become the world’s leading space-faring nation.

We set sail on this new sea because there is new knowledge to be gained, and new rights to be won, and they must be won and used for the progress of all people. For space science, like nuclear science and all technology, has no conscience of its own. Whether it will become a force for good or ill depends on man, and only if the United States occupies a position of pre-eminence can we help decide whether this new ocean will be a sea of peace or a new terrifying theater of war. I do not say the we should or will go unprotected against the hostile misuse of space any more than we go unprotected against the hostile use of land or sea, but I do say that space can be explored and mastered without feeding the fires of war, without repeating the mistakes that man has made in extending his writ around this globe of ours.

In: Civil Engineering

Economic growth will: Group of answer choices Shift PPF left Shift PPF right Cause movement along...

Economic growth will:

Group of answer choices

Shift PPF left

Shift PPF right

Cause movement along PPF

Decrease production

Flag this Question

Question 171 pts

What annual growth rate is needed for a country to double its output in 14 years?

Group of answer choices

7

2

5

10

Flag this Question

Question 181 pts

Which of the following is NOT a phase of the business cycle?

Group of answer choices

Recession

Base

Expansion

Peak

Flag this Question

Question 191 pts

Two consecutive quarters of negative economic growth as measured by a country's GDP is a:

Group of answer choices

Business Cycle

Great Recession

Recession

Depression

Flag this Question

Question 201 pts

Unemployment rate is defined as ________

Group of answer choices

Unemployed divided by the total population

Unemployed divided by the labor force

Unemployed divided by the labor participation

Labor force divided by the total population

Flag this Question

Question 211 pts

The type of unemployment caused by workers voluntarily changing jobs and by temporary layoffs is:

Group of answer choices

Frictional Unemployment

Structural Unemployment

Structural Unemployment

Burdensome Unemployment

Flag this Question

Question 221 pts

Unemployment of workers whose skills are not demanded by employers, who lack sufficient skill to obtain employment, or who cannot easily move to locations where jobs are available is:

Group of answer choices

Structural Unemployment

Frictional Unemployment

Cyclical Unemployment

Burdensome Unemployment

Flag this Question

Question 231 pts

Natural rate of unemployment is define as ________

Group of answer choices

Cyclical unemployment

Frictional unemployment plus structural unemployment

Seasonal unemployment plus cyclical unemployment

Zero unemployment

Flag this Question

Question 241 pts

The generalization that any 1% point rise in the unemployment rate above the natural rate of unemployment is associated with a rise in the negative GDP gap by 2% of potential GDP is known as:

Group of answer choices

Keynes’ law

GDP Gap

Economic growth

Okun’s law

Flag this Question

Question 251 pts

The index that measures the prices of a fixed market basket of 300 goods and services is:

Group of answer choices

Purchase Price Index

Consumer Price Index

Consumer Sales Index

Consumer Base Index

Flag this Question

Question 261 pts

If the CPI was 314 in 2015 and 335 in 2016, what is the rate of inflation?

Group of answer choices

4.28%

3.14%

5.53%

6.69%

Flag this Question

Question 271 pts

Cost-push inflation occurs when there is ___________.

Group of answer choices

Excess inventory

Increases in the price level resulting from an increase in resource costs and hence in per-unit production costs; inflation caused by reduction in aggregate supply

Increases in the price level resulting from increases in aggregate demand

A trade deficit

Flag this Question

Question 281 pts

Demand-pull inflation occurs when there is ___________.

Group of answer choices

Increases in the price level resulting from an increase in resource costs and hence in per-unit production costs; inflation caused by reduction in aggregate supply

Excess inventory

Excess inventory

Increases in the price level resulting from increases in aggregate demand

Flag this Question

Question 291 pts

_________ inflation reduces real output.

Group of answer choices

Cost-push

Demand-pull

Core

Core

Flag this Question

Question 301 pts

Core inflation ___________.

Group of answer choices

excludes certain items that face volatile price movements, such as energy and food products.

Is the natural rate of inflation

Is measured every two years.

Is cost-pull plus demand-pull inflation

Flag this Question

Question 311 pts

Nominal Interest Rate = Real Interest Rate + _____________.

Group of answer choices

Inflation

Taxes

GDP Deflator

Price Index

Flag this Question

Question 321 pts

The minimum level of consumption that would still exist even if a consumer had absolutely no income is:

Group of answer choices

Autonomous Consumption

Dissaving

Consumption Schedule

Consumption Schedule

Flag this Question

Question 331 pts

Consumption shifters include:

Group of answer choices

Interest Rates

Expectations

Borrowing

All of the other answers

Wealth and Disposable Income

Flag this Question

Question 341 pts

Levi’s is deciding whether to buy a jean rivet press machine for $1000. The company expects the machine to have a 1-year life. The machine is expected to contribute $1220 to the year’s net revenue. What is the expected rate of return?

Group of answer choices

33%

20%

22%

44%

Flag this Question

Question 351 pts

A construction firm is deciding which projects to invest in. It is deciding among five projects. The firm expects a real interest rate of 6%. Given the table, the construction firm will invest in:

Project

E(R)

A

5%

B

9%

C

4%

D

2%

E

10%

Group of answer choices

Projects A & B

Projects A, C, D

Projects B & E

Projects B & D

Flag this Question

Question 361 pts

If MPS = 0.25, then the multiplier is:

Group of answer choices

1

2

3

4

In: Economics