/**
* @author Derek Harter
* @cwid 123 45 678
* @class
* @ide Visual Studio Community 2017
* @date
* @assg C++ Stacks videos
*
* @description A Stack ADT with two concrete impelementation
* examples: an array based stack implementaiton (AStack), and
* a linked list based implementation (LStack).
*/
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
//-------------------------------------------------------------------------
/** stack (base class)
* The basic definition of the Stack Abstract Data Type (ADT)
* and stack operations. All declared functions here are
* virtual, they must be implemented by concrete derived
* classes.
*/
template <class T>
class Stack
{
public:
/** clear
* Method to clear out or empty any items on stack,
* put stack back to empty state.
* Postcondition: Stack is empty.
*/
virtual void clear() = 0;
/** isEmpty
* Function to determine whether the stack is empty. Needed
* because it is undefined to pop from empty stack. This
* function will not change the state of the stack (const).
*
* @returns bool true if stack is empty, false otherwise.
*/
virtual bool isEmpty() const = 0;
/** push
* Add a new item onto top of stack.
*
* @param newItem The item of template type T to push on top of
* the current stack.
*/
virtual void push(const T& newItem) = 0;
/** top
* Return the top item from the stack. Note in this ADT, peeking
* at the top item does not remove the top item. Some ADT combine
* top() and pop() as one operation. It is undefined to try and
* peek at the top item of an empty stack. Derived classes should
* throw an exception if this is attempted.
*
* @returns T Returns the top item from stack.
*/
virtual T top() const = 0;
/** pop
* Remove the item from the top of the stack. It is undefined what
* it means to try and pop from an empty stack. Derived classes should
* throw an exception if pop() from empty is attempted.
*/
virtual void pop() = 0;
/** size
* Accessor method to provide the current size of the stack.
*/
virtual int size() const = 0;
/** tostring
* Represent stack as a string
*/
virtual string tostring() const = 0;
// operload operators, mostly to support boolean comparison between
// two stacks for testing
bool operator==(const Stack<T>& rhs) const;
virtual const T& operator[](int index) const = 0;
// overload output stream operator for all stacks using tostring()
template <typename U>
friend ostream& operator<<(ostream& out, const Stack<U>& aStack);
};
/** Stack equivalence
* Compare two given stacks to determine if they are equal or not.
* stacks are equal if they are both of the same size, and each corresponding
* item on each stack is equal at the same position on the stack.
* This function relies on overloaded operator[] to access items on stack
* by index for the comparis.
Write a program that converts an infix expression into an equivalent.pdfmohdjakirfb
Write a program that converts an infix expression into an equivalent postfix expression. The
rules to convert an infix expression into an equivalent postfix expression are as follows (C++):
Initialize pfx to an empty expression and also initialize the stack.
Get the next symbol, sym, from infx.
If sym is an operand, append sym to pfx.
If sym is (, push sym into the stack.
If sym is ), pop and append all of the symbols from the stack until the most recent left
parentheses. Pop and discard the left parentheses.
If sym is an operator:
Pop and append all of the operators from the stack to pfx that are above the most recent left
parentheses and have precedence greater than or equal to sym.
Push sym onto the stack.
After processing infx, some operators might be left in the stack. Pop and append to pfx
everything from the stack.
In this program, you will consider the following (binary) arithmetic operators: +, -, *, and /.
You may assume that the expressions you will process are error free. Design a class that stores
the infix and postfix strings. The class must include the following operations:
getInfix: Stores the infix expression.
showInfix: Outputs the infix expression.
showPostfix: Outputs the postfix expression.
convertToPostfix: Converts the infix expression into a postfix expression. The resulting postfix
expression is stored in pfx.
precedence: Determines the precedence between two operators. If the first operator is of higher
or equal precedence than the second operator, it returns the value true; otherwise, it returns the
value false.
A + B - C;
(A + B ) * C;
(A + B) * (C - D);
A + ((B + C) * (E - F) - G) / (H - I);
A + B * (C + D ) - E / F * G + H;
Infix Expression: A+B-C;
Postfix Expression: AB+C-
Infix Expression: (A+B)*C;
Postfix Expression: AB+C*
Infix Expression: (A+B)*(C-D);
Postfix Expression: AB+CD-*
Infix Expression: A+((B+C)*(E-F)-G)/(H-I);
Postfix Expression: ABC+EF-*G-HI-/+
Infix Expression: A+B*(C+D)-E/F*G+H;
Postfix Expression: ABCD+*+EF/G*-H+
Turn in:
A UML diagram for your class.
The header file for your class.
The implementation file for your class.
The source code for your test program. (C++)
(Below already done code.)
//Header file: myStack.h
#ifndef H_StackType
#define H_StackType
#include
#include
#include \"stackADT.h\"
using namespace std;
template
class stackType: public stackADT
{
public:
const stackType& operator=(const stackType&);
//Overload the assignment operator.
void initializeStack();
//Function to initialize the stack to an empty state.
//Postcondition: stackTop = 0
bool isEmptyStack() const;
//Function to determine whether the stack is empty.
//Postcondition: Returns true if the stack is empty,
// otherwise returns false.
bool isFullStack() const;
//Function to determine whether the stack is full.
//Postcondition: Returns true if the stack is full,
// otherwise returns false.
void push(const Type& newItem);
//Function to add newItem to the stack.
//Precondition: The stack exists and is not full.
//Postc.
files/Heap.h
#ifndef HEAP_H
#define HEAP_H
#include <vector>
#include <stdexcept> // std::out_of_range
#include <math.h> // pow()
using namespace std;
template<typename T>
class Heap
{
private:
vector<T> _items; // Main vector of elements for heap storage
/**
* Used to take unsorted data and heapify it
*/
void buildHeap()
{
for (int i = _items.size() / 2; i >= 0; i--)
{
percolateDown(i);
}
}
/*********************************************************************/
/********************* Microassignment zone *************************/
/**
* Percolates the item specified at by index down
* into its proper location within a heap.
* Used for dequeue operations and array to heap conversions
* MA TODO: Implement percolateDown!
*/
void percolateDown(int index)
{
}
/**
* Percolate up from a given index to fix heap property
* Used in inserting new nodes into the heap
* MA TODO: Implement percolateUp
*/
void percolateUp( int current_position )
{
}
/************************** Microassigment zone DONE *********************/
public:
/**
* Default empty constructor
*/
Heap()
{
}
/**
* Constructor with a vector of elements
*/
Heap(const vector<T> &unsorted)
{
for (int i = 0; i < unsorted.size(); i++)
{
_items.push_back(unsorted[i]);
}
buildHeap();
}
/**
* Adds a new item to the heap
*/
void insert(T item)
{
int current_position = size(); // Get index location
_items.push_back(item); // Add data to end
percolateUp( current_position ); // Adjust up, as needed
}
/**
* Returns the top-most item in our heap without
* actually removing the item from the heap
*/
T& getFirst()
{
if( size() > 0 )
return _items[0];
else
throw std::out_of_range("No elements in Heap.");
}
/**
* Removes minimum value from heap and returns it to the caller
*/
T deleteMin()
{
int last_index = size() - 1; // Calc last item index
int root_index = 0; // Root index (for readability)
T min_item = _items[root_index]; // Keep item to return
_items[root_index] = _items[last_index]; // Move last item to root
_items.erase(_items.end() - 1); // Erase last element entry
percolateDown(0); // Fix heap property
return min_item;
}
/**
* Returns true if heap is empty, else false
*/
bool isEmpty() const
{
return _items.size() == 0;
}
/**
* Returns current quantity of elements in heap (N)
*/
int size() const
{
return _items.size();
}
/**
* Return heap data in order from the _items vector
*/
string to_s() const
{
string ret = "";
for(int i = 0; i < _items.size(); i++)
{
ret += to_string(_items[i]) + " ";
}
return ret;
}
/**
...
A class that automates conversion from a C++ recursive function to an iterative function. It allow the recursive function to preserve its structure by reproducing the "call stack" on an std::stack. The examples use combinatorics to illustrate usage.
/**
* @author Derek Harter
* @cwid 123 45 678
* @class
* @ide Visual Studio Community 2017
* @date
* @assg C++ Stacks videos
*
* @description A Stack ADT with two concrete impelementation
* examples: an array based stack implementaiton (AStack), and
* a linked list based implementation (LStack).
*/
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
//-------------------------------------------------------------------------
/** stack (base class)
* The basic definition of the Stack Abstract Data Type (ADT)
* and stack operations. All declared functions here are
* virtual, they must be implemented by concrete derived
* classes.
*/
template <class T>
class Stack
{
public:
/** clear
* Method to clear out or empty any items on stack,
* put stack back to empty state.
* Postcondition: Stack is empty.
*/
virtual void clear() = 0;
/** isEmpty
* Function to determine whether the stack is empty. Needed
* because it is undefined to pop from empty stack. This
* function will not change the state of the stack (const).
*
* @returns bool true if stack is empty, false otherwise.
*/
virtual bool isEmpty() const = 0;
/** push
* Add a new item onto top of stack.
*
* @param newItem The item of template type T to push on top of
* the current stack.
*/
virtual void push(const T& newItem) = 0;
/** top
* Return the top item from the stack. Note in this ADT, peeking
* at the top item does not remove the top item. Some ADT combine
* top() and pop() as one operation. It is undefined to try and
* peek at the top item of an empty stack. Derived classes should
* throw an exception if this is attempted.
*
* @returns T Returns the top item from stack.
*/
virtual T top() const = 0;
/** pop
* Remove the item from the top of the stack. It is undefined what
* it means to try and pop from an empty stack. Derived classes should
* throw an exception if pop() from empty is attempted.
*/
virtual void pop() = 0;
/** size
* Accessor method to provide the current size of the stack.
*/
virtual int size() const = 0;
/** tostring
* Represent stack as a string
*/
virtual string tostring() const = 0;
// operload operators, mostly to support boolean comparison between
// two stacks for testing
bool operator==(const Stack<T>& rhs) const;
virtual const T& operator[](int index) const = 0;
// overload output stream operator for all stacks using tostring()
template <typename U>
friend ostream& operator<<(ostream& out, const Stack<U>& aStack);
};
/** Stack equivalence
* Compare two given stacks to determine if they are equal or not.
* stacks are equal if they are both of the same size, and each corresponding
* item on each stack is equal at the same position on the stack.
* This function relies on overloaded operator[] to access items on stack
* by index for the comparis.
Write a program that converts an infix expression into an equivalent.pdfmohdjakirfb
Write a program that converts an infix expression into an equivalent postfix expression. The
rules to convert an infix expression into an equivalent postfix expression are as follows (C++):
Initialize pfx to an empty expression and also initialize the stack.
Get the next symbol, sym, from infx.
If sym is an operand, append sym to pfx.
If sym is (, push sym into the stack.
If sym is ), pop and append all of the symbols from the stack until the most recent left
parentheses. Pop and discard the left parentheses.
If sym is an operator:
Pop and append all of the operators from the stack to pfx that are above the most recent left
parentheses and have precedence greater than or equal to sym.
Push sym onto the stack.
After processing infx, some operators might be left in the stack. Pop and append to pfx
everything from the stack.
In this program, you will consider the following (binary) arithmetic operators: +, -, *, and /.
You may assume that the expressions you will process are error free. Design a class that stores
the infix and postfix strings. The class must include the following operations:
getInfix: Stores the infix expression.
showInfix: Outputs the infix expression.
showPostfix: Outputs the postfix expression.
convertToPostfix: Converts the infix expression into a postfix expression. The resulting postfix
expression is stored in pfx.
precedence: Determines the precedence between two operators. If the first operator is of higher
or equal precedence than the second operator, it returns the value true; otherwise, it returns the
value false.
A + B - C;
(A + B ) * C;
(A + B) * (C - D);
A + ((B + C) * (E - F) - G) / (H - I);
A + B * (C + D ) - E / F * G + H;
Infix Expression: A+B-C;
Postfix Expression: AB+C-
Infix Expression: (A+B)*C;
Postfix Expression: AB+C*
Infix Expression: (A+B)*(C-D);
Postfix Expression: AB+CD-*
Infix Expression: A+((B+C)*(E-F)-G)/(H-I);
Postfix Expression: ABC+EF-*G-HI-/+
Infix Expression: A+B*(C+D)-E/F*G+H;
Postfix Expression: ABCD+*+EF/G*-H+
Turn in:
A UML diagram for your class.
The header file for your class.
The implementation file for your class.
The source code for your test program. (C++)
(Below already done code.)
//Header file: myStack.h
#ifndef H_StackType
#define H_StackType
#include
#include
#include \"stackADT.h\"
using namespace std;
template
class stackType: public stackADT
{
public:
const stackType& operator=(const stackType&);
//Overload the assignment operator.
void initializeStack();
//Function to initialize the stack to an empty state.
//Postcondition: stackTop = 0
bool isEmptyStack() const;
//Function to determine whether the stack is empty.
//Postcondition: Returns true if the stack is empty,
// otherwise returns false.
bool isFullStack() const;
//Function to determine whether the stack is full.
//Postcondition: Returns true if the stack is full,
// otherwise returns false.
void push(const Type& newItem);
//Function to add newItem to the stack.
//Precondition: The stack exists and is not full.
//Postc.
files/Heap.h
#ifndef HEAP_H
#define HEAP_H
#include <vector>
#include <stdexcept> // std::out_of_range
#include <math.h> // pow()
using namespace std;
template<typename T>
class Heap
{
private:
vector<T> _items; // Main vector of elements for heap storage
/**
* Used to take unsorted data and heapify it
*/
void buildHeap()
{
for (int i = _items.size() / 2; i >= 0; i--)
{
percolateDown(i);
}
}
/*********************************************************************/
/********************* Microassignment zone *************************/
/**
* Percolates the item specified at by index down
* into its proper location within a heap.
* Used for dequeue operations and array to heap conversions
* MA TODO: Implement percolateDown!
*/
void percolateDown(int index)
{
}
/**
* Percolate up from a given index to fix heap property
* Used in inserting new nodes into the heap
* MA TODO: Implement percolateUp
*/
void percolateUp( int current_position )
{
}
/************************** Microassigment zone DONE *********************/
public:
/**
* Default empty constructor
*/
Heap()
{
}
/**
* Constructor with a vector of elements
*/
Heap(const vector<T> &unsorted)
{
for (int i = 0; i < unsorted.size(); i++)
{
_items.push_back(unsorted[i]);
}
buildHeap();
}
/**
* Adds a new item to the heap
*/
void insert(T item)
{
int current_position = size(); // Get index location
_items.push_back(item); // Add data to end
percolateUp( current_position ); // Adjust up, as needed
}
/**
* Returns the top-most item in our heap without
* actually removing the item from the heap
*/
T& getFirst()
{
if( size() > 0 )
return _items[0];
else
throw std::out_of_range("No elements in Heap.");
}
/**
* Removes minimum value from heap and returns it to the caller
*/
T deleteMin()
{
int last_index = size() - 1; // Calc last item index
int root_index = 0; // Root index (for readability)
T min_item = _items[root_index]; // Keep item to return
_items[root_index] = _items[last_index]; // Move last item to root
_items.erase(_items.end() - 1); // Erase last element entry
percolateDown(0); // Fix heap property
return min_item;
}
/**
* Returns true if heap is empty, else false
*/
bool isEmpty() const
{
return _items.size() == 0;
}
/**
* Returns current quantity of elements in heap (N)
*/
int size() const
{
return _items.size();
}
/**
* Return heap data in order from the _items vector
*/
string to_s() const
{
string ret = "";
for(int i = 0; i < _items.size(); i++)
{
ret += to_string(_items[i]) + " ";
}
return ret;
}
/**
...
A class that automates conversion from a C++ recursive function to an iterative function. It allow the recursive function to preserve its structure by reproducing the "call stack" on an std::stack. The examples use combinatorics to illustrate usage.
Data structuresUsing java language and develop a prot.pdfarmyshoes
Data structures:
****Using java language and develop a prototype for a demo program that reads in strings that
look like:
Using the infix to postfix code below:
A = 3; // your code should store A and 3 as a key-value pair
B = 4; // your code should store B and 4 as a key-value pair
A; // your code should now look-up A and then display its value
later we (you) will add the ability to write
Y = A * B + 3;
Y; // your code should show 16
Using this code
// infix.java
// converts infix arithmetic expressions to postfix
// to run this program: C>java InfixApp
import java.io.*; // for I/O
////////////////////////////////////////////////////////////////
class StackX {
private int maxSize;
private char[] stackArray;
private int top;
// --------------------------------------------------------------
public StackX(int s) // constructor
{
maxSize = s;
stackArray = new char[maxSize];
top = -1;
}
// --------------------------------------------------------------
public void push(char j) // put item on top of stack
{
stackArray[++top] = j;
}
// --------------------------------------------------------------
public char pop() // take item from top of stack
{
return stackArray[top--];
}
// --------------------------------------------------------------
public char peek() // peek at top of stack
{
return stackArray[top];
}
// --------------------------------------------------------------
public boolean isEmpty() // true if stack is empty
{
return (top == -1);
}
// -------------------------------------------------------------
public int size() // return size
{
return top + 1;
}
// --------------------------------------------------------------
public char peekN(int n) // return item at index n
{
return stackArray[n];
}
// --------------------------------------------------------------
public void displayStack(String s) {
System.out.print(s);
System.out.print(\"Stack (bottom-->top): \");
for (int j = 0; j < size(); j++) {
System.out.print(peekN(j));
System.out.print(\' \');
}
System.out.println(\" \");
}
// --------------------------------------------------------------
} // end class StackX
////////////////////////////////////////////////////////////////
class InToPost // infix to postfix conversion
{
private StackX theStack;
private String input;
private String output = \"\";
// --------------------------------------------------------------
public InToPost(String in) // constructor
{
input = in;
int stackSize = input.length();
theStack = new StackX(stackSize);
}
// --------------------------------------------------------------
public String doTrans() // do translation to postfix
{
for (int j = 0; j < input.length(); j++) {
char ch = input.charAt(j);
theStack.displayStack(\"For \" + ch + \" \"); // *diagnostic*
switch (ch) {
case \'+\': // it’s + or -
case \'-\':
gotOper(ch, 1); // go pop operators
break; // (precedence 1)
case \'*\': // it’s * or /
case \'/\':
gotOper(ch, 2); // go pop operators
break; // (precedence 2)
case \'(\': // it’s a left paren
theStack.push(.
1- The design of a singly-linked list below is a picture of the functi (1).pdfafgt2012
1. The design of a singly-linked list
below is a picture of the function that needs to be used
below is the code of the above picture:
#include <string>
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define defaultSize 100
void Assert(bool val, string s)
{
if (!val)
{ // Assertion failed -- close the program
cout << "Assertion Failed: " << s << endl;
exit(-1);
}
}
template <typename E>
class Link {
public:
E element; // Value for this node
Link *next; // Pointer to next node in list
// Constructors
Link(const E& elemval, Link<E>* nextval = NULL)
{ element = elemval; next = nextval; }
Link(Link<E>* nextval =NULL) { next = nextval; }
};
template <typename E>
class LList: public Link<E> {
private:
Link<E>* head;// Intialization helper method
Link<E>* tail;// Pointer to last element
Link<E>* curr;// Access to current element
int cnt;// Size of list
void init(){// Intialization helper method
curr = tail = head = new Link<E>;
cnt = 0;
}
void removeall() {// Return link nodes to free store
while(head != NULL) {
curr = head;
head = head->next;
delete curr;
}
}
public:
LList(int size=defaultSize) { init(); }// Constructor
~LList() { removeall(); }// Destructor
void print() const;// Print list contents
void clear() { removeall(); init(); }// Clear list
// Insert "it" at current position
void insert(const E& it) {
curr->next = new Link<E>(it, curr->next);
if (tail == curr) tail = curr->next; // New tail
cnt++;
}
void append(const E& it) { // Append "it" to list
tail = tail->next = new Link<E>(it, NULL);
cnt++;
}
// Remove and return current element
E remove() {
Assert(curr->next != NULL, "No element");
E it = curr->next->element; // Remember value
Link<E>* ltemp = curr->next; // Remember link node
if (tail == curr->next) tail = curr; // Reset tail
curr->next = curr->next->next; // Remove from list
delete ltemp; // Reclaim space
cnt--; // Decrement the count
return it;
}
void moveToStart()// Place curr at list start
{ curr = head; }
void moveToEnd() // Place curr at list end
{ curr = tail; }
void prev(){
if (curr == head) return;
Link<E>* temp = head;
while (temp->next!=curr) temp=temp->next;
curr = temp;
}
void next(){ if (curr != tail) curr = curr->next; }
int length() const { return cnt; }
int currPos() const {
Link<E>* temp = head;
int i;
for (i=0; curr != temp; i++)
temp = temp->next;
return i;
}
void moveToPos(int pos){
Assert ((pos>=0)&&(pos<=cnt), "Position out of range");
curr = head;
for(int i=0; i<pos; i++) curr = curr->next;
}
const E& getValue() const {
Assert(curr->next != NULL, "No value");
return curr->next->element;
}
};
completed this code to fulfill the requirement below:
Write a function to insert an integer into a singly-linked list of elements arranged from largest to
smallest. Requires that elements remain ordered after insertion.
2. The design of array-based stack
below is a picture of the function that needs to be used
below is the code of the above picture:
#include <string.h>
#.
Use a simple vector you created before to create two other more steviesellars
Use a simple vector you created before to create two other more complex vectors with
A) Memory allocation that doubles size of memory when end reached, and 1/2's memory when the size reaches 1/4.
B) Implemented with a singularly linked list.
Main.cpp
#include
#include "SimpleVector.h"
//System Libraries
#include //Input/Output Library
using namespace std;
//User Libraries
//Global Constants, no Global Variables are allowed
//Math/Physics/Conversions/Higher Dimensions - i.e. PI, e, etc...
//Function Prototypes
void fillVec(SimpleVector &);
void addVec(SimpleVector &);
void delVec(SimpleVector &);
void prntVec(SimpleVector &,int);
//Execution Begins Here!
int main(int argc, char** argv) {
//Declare Variables
int size;
//Read in the size
cout<<"What size vector to test?"<
cin>>size;
SimpleVector sv(size);
//Initialize or input i.e. set variable values
fillVec(sv);
//Display the outputs
prntVec(sv,10);
//Add and subtract from the vector
addVec(sv);
//Display the outputs
prntVec(sv,10);
//Add and subtract from the vector
delVec(sv);
//Display the outputs
prntVec(sv,10);
//Exit stage right or left!
return 0;
}
void addVec(SimpleVector &sv){
int add=sv.size()*0.1;
for(int i=1;i<=add;i++){
sv.push_front(i+add-1);
sv.push_back(i-add);
}
}
void delVec(SimpleVector &sv){
int del=sv.size()*0.2;
for(int i=1;i<=del;i++){
sv.pop_front();
sv.pop_back();
}
}
void fillVec(SimpleVector &sv){
for(int i=0;i
sv[i]=i%10;
}
}
void prntVec(SimpleVector &sv,int n){
cout<
for(int i=0;i
cout<
if(i%n==(n-1))cout<
}
cout<
}
SimpleVector.h
// SimpleVector class template
#ifndef SIMPLEVECTOR_H
#define SIMPLEVECTOR_H
#include
#include // Needed for bad_alloc exception
#include // Needed for the exit function
using namespace std;
template
class SimpleVector
{
private:
T *aptr; // To point to the allocated array
int arraySize; // Number of elements in the array
void memError(); // Handles memory allocation errors
void subError(); // Handles subscripts out of range
public:
// Default constructor
SimpleVector()
{ aptr = 0; arraySize = 0;}
// Constructor declaration
SimpleVector(int);
// Copy constructor declaration
SimpleVector(const SimpleVector &);
// Destructor declaration
~SimpleVector();
//Adding and subtracting from the Vector
void push_front(T);
void push_back(T);
T pop_front();
T pop_back();
// Accessor to return the array size
int size() const
{ return arraySize; }
// Accessor to return a specific element
T getElementAt(int position);
// Overloaded [] operator declaration
T &o ...
Start with the inclusion of libraries#include iostream .docxMARRY7
// Start with the inclusion of libraries
#include <iostream> //The library of io functions
#include <fstream> //The library of external stream functions
#include <cstdlib> //The library for external errors
#include <string> //The library for string functions
#include <cmath> //The library of C math functions
#include <iomanip> //Allows setting widths, etc. for I/O
#include <stdlib.h>
#include <stdio.h>
#include<vector>
using namespace std;
// Define all of the prototypes for functions used in the program
// Counts the number of unique letters seen
int countunique(int *array, int size);
// Creates the input file and formats it for use by the cipher section.
void createinput(string ifile, string ofile);
// Creates the encoded input file
void createcipher(int key, string ifile, string ofile);
// Finds and counts the number of digrams
int digram(int *pointer, string ifile);
// Counts the letter frequency in the encoded input file
int lettercount(int*, string ifile, string ofile);
// Finds the highest count in the singlton (or any other) array
int singleton(int*, int size);
// Trims an input file to the right size starting at an offset
void trimfile(string ifile, string ofile, int offset, int size);
// Begin the main function for testing
int main(int argc, char* argv[])
{
int count = 0;
int second = 0;
int singlefreq[26];
int *single = singlefreq;
int delta;
int loop; //The loop counter for arguments
int final = 0;
int totalcnt;
int key = -1; //Sets the key value
int len = 0; //The length to investigate for testing
int off; //Holds the offset into the file
double m; //Holds the metric error value
char loopletter;
float percent;
string ifile1 = "";
string ofile1 = "";
string deflt = "c:\\dissertation\\ShiftandSubcipherC++files\\clean.txt";
string ifile2 = "";
string ofile2 = ""; //Holds selected file path names
string cmdarg; //Holds the command line argument
string stop = "l"; //Gives the stop condition, assumes l
string reportfile = "c:\\dissertation\\test\\report.txt";
ofstream outs; //Declare an output stream for reporting
int digramc[676]; //Set up the digram array
int *two = digramc; //Point to the digram array
int dicount = 0; //Holds the count of the number of digrams
int total = 0; //Counts the total number of letters seen for analysis
for (loop = 1; loop<argc; loop++) //Decide if we have arguments or must use defaults
{
if (!argv[1])
{
// cout << "No argument found.\n";
ifile1 = deflt;
}
else
{
cmdarg = argv[loop];
if (cmdarg == "-k")
{
loop++;
key = atoi(argv[loop]);
cout << "key = " << key << endl;
}
if (cmdarg == "-l")
{
loop++;
len = atoi(argv[loop]);
cout << "Run for " << len << " characters.\n";
}
if (cmdarg == "-m")
{
loop++;
m = atof(argv[loop]);
cout << "Run until and error of " << m << "\n";
}
if (cmdarg == "-off")
{
loop++;
off = atoi(argv[loop]);
cout << ...
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxcurwenmichaela
New folder/jsjf/ArrayStack.classpackage jsjf;
publicsynchronizedclass ArrayStack implements StackADT {
privatestaticfinal int DEFAULT_CAPACITY = 100;
private int top;
private Object[] stack;
public void ArrayStack();
public void ArrayStack(int);
public void push(Object);
private void expandCapacity();
public Object pop() throws exceptions.EmptyCollectionException;
public Object peek() throws exceptions.EmptyCollectionException;
public int size();
public boolean isEmpty();
public String toString();
}
New folder/jsjf/ArrayStack.javaNew folder/jsjf/ArrayStack.javapackage jsjf;
import jsjf.exceptions.*;
import java.util.Arrays;
// -------------------------------------------------------
// Author: Yifu Wu
// Date: 03/10/16
// Source Name: ArrayStack<T>
// Due date: 03/10/16
// Description:
/**
* An array implementation of a stack in which the bottom of the
* stack is fixed at index 0.
*
* @author Java Foundations
* @version 4.0
*/
publicclassArrayStack<T>implementsStackADT<T>
{
privatefinalstaticint DEFAULT_CAPACITY =100;
privateint top;
private T[] stack;
/**
* Creates an empty stack using the default capacity.
*/
publicArrayStack()
{
this(DEFAULT_CAPACITY);
}
/**
* Creates an empty stack using the specified capacity.
* @param initialCapacity the initial size of the array
*/
publicArrayStack(int initialCapacity)
{
top =0;
stack =(T[])(newObject[initialCapacity]);
}
/**
* Adds the specified element to the top of this stack, expanding
* the capacity of the array if necessary.
* @param element generic element to be pushed onto stack
*/
publicvoid push(T element)
{
if(size()== stack.length)
expandCapacity();
stack[top]= element;
top++;
}
/**
* Creates a new array to store the contents of this stack with
* twice the capacity of the old one.
*/
privatevoid expandCapacity()
{
//stack = Arrays.copyOf(stack, stack.length * 2);
System.out.println("Expanding stack capacity\n");
T[] temp =(T[])(newObject[2*top]);
for(int i=0; i< top; i++)
temp[i]= stack[i];
stack = temp;
}
/**
* Removes the element at the top of this stack and returns a
* reference to it.
* @return element removed from top of stack
* @throws EmptyCollectionException if stack is empty
*/
public T pop()throwsEmptyCollectionException
{
if(isEmpty())
thrownewEmptyCollectionException("stack");
top--;
T result = stack[top];
stack[top]=null;
return result;
}
/**
* Returns a reference to the element at the top of this stack.
* The element is not removed from the stack.
* @return element on top of stack
* @throws EmptyCollectionException if stack is empty
*/
public T peek()throwsEmptyCollectionException
{
if(isEmpty())
thrownewEmptyCollectionException("stack");
return stack[top-1];
}
/**
* Returns the number of elements in ...
Given the following ADT definition of a stack to use stack .docxshericehewat
Given the following ADT definition of a stack to use:
/** stack (base class)
* The basic definition of the Stack Abstract Data Type (ADT)
* and stack operations. All declared functions here are
* virtual, they must be implemented by concrete derived
* classes.
*/
template <class T>
class Stack
{
public:
/** clear
* Method to clear out or empty any items on stack,
* put stack back to empty state.
* Postcondition: Stack is empty.
*/
virtual void clear() = 0;
/** isEmpty
* Function to determine whether the stack is empty. Needed
* because it is undefined to pop from empty stack. This
* function will not change the state of the stack (const).
*
* @returns bool true if stack is empty, false otherwise.
*/
virtual bool isEmpty() const = 0;
/** push
* Add a new item onto top of stack.
*
* @param newItem The item of template type T to push on top of
* the current stack.
*/
virtual void push(const T& newItem) = 0;
/** top
* Return the top item from the stack. Note in this ADT, peeking
* at the top item does not remove the top item. Some ADT combine
* top() and pop() as one operation. It is undefined to try and
* peek at the top item of an empty stack. Derived classes should
* throw an exception if this is attempted.
*
* @returns T Returns the top item from stack.
*/
virtual T top() const = 0;
/** pop
* Remove the item from the top of the stack. It is undefined what
* it means to try and pop from an empty stack. Derived classes should
* throw an exception if pop() from empty is attempted.
*/
virtual void pop() = 0;
/** size
* Accessor method to provide the current size of the stack.
*
* @returns int The current size (number of items) on the stack.
*/
virtual int size() const = 0;
};
perform the following tasks by writing code that uses a stack to accomplish the task. You will
need to create a stack of the needed type, then use the methods of the stack abstraction (push,
top, pop, etc.) to solve the given task asked for.
Question 7 (5 points)
Given a stack of integers, calculate the sum of the integer values. Also, the stack should still be
unchanged after you have calculated the sum Hint: take the items off the stack to sum them up
and keep them on a second temporary stack so you can put them all back on after you have
calculated the sum.
ANSWER FOR NUMBER 7:
int sumStackOfIntegers(Stack<int> currentStack) {
Stack<int> tempStack;
int sum = 0;
while(!currentStack.isEmpty()) {
int temp = currentStack.top();
tempStack.push(temp);
currentStack.pop();
sum += temp;
}
while(!tempStack.isEmpty()) {
int temp = tempStack.top();
currentStack.push(temp);
tempStack.pop();
}
return sum;
}
Stack Implementation
Given the following linked list implementation of a Stack ADT (this is the same implementation
you used in Assignment 10), add the asked for additional member methods to the linked list stack
implementation.
/** Node
* A basic node contaning an item and a link to t ...
StackInterface An interface for the ADT stack. Do not modif.pdfARCHANASTOREKOTA
StackInterface
/**
An interface for the ADT stack.
Do not modify this file
*/
package PJ2;
public interface StackInterface
{
/** Gets the current number of data in this stack.
@return the integer number of entries currently in the stack*/
public int size();
/** Adds a new data to the top of this stack.
@param aData an object to be added to the stack */
public void push(T aData);
/** Removes and returns this stack\'s top data.
@return either the object at the top of the stack or,
if the stack is empty before the operation, null */
public T pop();
/** Retrieves this stack\'s top data.
@return either the data at the top of the stack or
null if the stack is empty */
public T peek();
/** Detects whether this stack is empty.
@return true if the stack is empty */
public boolean empty();
/** Removes all data from this stack */
public void clear();
} // end StackInterface
SimpleLinkedStack.java
/**
A class of stacks whose entries are stored in a chain of nodes.
Implement all methods in SimpleLinkedStack class using
the inner Node class.
Main Reference : text book or class notes
Do not change or add data fields
Do not add new methods
You may access Node object fields directly, i.e. data and next
*/
package PJ2;
public class SimpleLinkedStack implements StackInterface
{
// Data fields
private Node topNode; // references the first node in the chain
private int count; // number of data in this stack
public SimpleLinkedStack()
{
// add stataments
} // end default constructor
public void push(T newData)
{
// add stataments
} // end push
public T peek()
{
// add stataments
return null;
} // end peek
public T pop()
{
// add stataments
return null;
} // end pop
public boolean empty()
{
// add stataments
return false;
} // end empty
public int size()
{
// add stataments
return -1;
} // end isEmpty
public void clear()
{
// add stataments
} // end clear
public String toString()
{
// add stataments
// note: data class in stack must implement toString() method
// return a list of data in Stack, separate them with \',\'
return \"\";
}
/****************************************************
private inner node class
Do not modify this class!!
you may access data and next directly
***************************************************/
private class Node
{
private T data; // entry in list
private Node next; // link to next node
private Node (T dataPortion)
{
data = dataPortion;
next = null; // set next to NULL
} // end constructor
private Node (T dataPortion, Node nextNode)
{
data = dataPortion;
next = nextNode; // set next to refer to nextNode
} // end constructor
} // end Node
/****************************************************
Do not modify: Stack test
****************************************************/
public static void main (String args[])
{
System.out.println(\"\ \"+
\"*******************************************************\ \"+
\"Sample Expected output:\ \"+
\"\ \"+
\"OK: stack is empty\ \"+
\"Push 3 data: 10, 30, 50\ \"+
\"Print stack [50,30,10,]\ \"+
\"OK: sta.
package algs13;
import stdlib.*;
import java.util.Iterator;
import java.util.NoSuchElementException;
/* ***********************************************************************
* Compilation: javac Queue.java
* Execution: java Queue < input.txt
* Data files: http://algs4.cs.princeton.edu/13stacks/tobe.txt
*
* A generic queue, implemented using a linked list.
*
* % java Queue < tobe.txt
* to be or not to be (2 left on queue)
*
*************************************************************************/
/**
* The <tt>Queue</tt> class represents a first-in-first-out (FIFO)
* queue of generic items.
* It supports the usual <em>enqueue</em> and <em>dequeue</em>
* operations, along with methods for peeking at the top item,
* testing if the queue is empty, and iterating through
* the items in FIFO order.
* <p>
* All queue operations except iteration are constant time.
* <p>
* For additional documentation, see <a href="http://algs4.cs.princeton.edu/13stacks">Section 1.3</a> of
* <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne.
*/
public class Queue<T> implements Iterable<T> {
private int N; // number of elements on queue
private Node<T> first; // beginning of queue
private Node<T> last; // end of queue
// helper linked list class
private static class Node<T> {
public Node() { }
public T item;
public Node<T> next;
}
/**
* Create an empty queue.
*/
public Queue() {
first = null;
last = null;
N = 0;
}
/**
* Is the queue empty?
*/
public boolean isEmpty() {
return first == null;
}
/**
* Return the number of items in the queue.
*/
public int size() {
return N;
}
/**
* Return the item least recently added to the queue.
* @throws java.util.NoSuchElementException if queue is empty.
*/
public T peek() {
if (isEmpty()) throw new NoSuchElementException("Queue underflow");
return first.item;
}
/**
* Add the item to the queue.
*/
public void enqueue(T item) {
Node<T> oldlast = last;
last = new Node<>();
last.item = item;
last.next = null;
if (isEmpty()) first = last;
else oldlast.next = last;
N++;
}
/**
* Remove and return the item on the queue least recently added.
* @throws java.util.NoSuchElementException if queue is empty.
*/
public T dequeue() {
if (isEmpty()) throw new NoSuchElementException("Queue underflow");
T item = first.item;
first = first.next;
N--;
if (isEmpty()) last = null;
return item;
}
/**
* Return string representation.
*/
public String toString() {
StringBuilder s = new StringBuilder();
for (T item : this)
s.append(item + " ");
return s.toString();
}
// check internal invariants
private static <T> boolean check(Queue<T> that) {
int N = that.N;
Queue.Node<T> first = that.first;
Queue.Node<T> last = that.last;
if (N == 0) {
if (first != null) return false;
if (last != null) return false;
}
else if (N == 1) {
if (f.
Why do you believe money laundering is a difficult fraud to investig.pdffsenterprises
Why do you believe money laundering is a difficult fraud to investigate
Solution
Money laundering is mostly a difficult situation to Investigate as sometimes it miss the clue
chain for tracking Criminals, Sometimes Criminals not have a identity/social security to trace
and the funds moved through offshore accounts is still unavailable for accessing any kind of
information to whom transferred and whom to be transferred.
It is very difficult to trace when governmental authority or Person or Agent or Agency of
authority support / help such kinds of frauds or Money laundering situations. They are looting
and transferring the money within seconds and closing the accounts for unidentity.
Sometimes It may not be difficult to investigate but difficult to gather the evidence We all know
facts so happened but difficult to get evidence and prove in the court of law as because of
unauthorised way of activity and transaction, If it is authorised then all documents are available.
Every Country may not follow transparency rather they follow their own rules and regulations
depending upon the situations it is facing around the world. some of the countries indirectly
encouraging by not laying appropriate controls by way of regulations.
Most of the Money Laundering happening in the united states are belonging too or linked to
another country which results in gathering the evidence from other countries which is so risky
and lot of intrications are involved and very tricky situations. Some of the countries still
following anonymous way to open bank account and close the same, The country indirectly
promoting money laundering thereby terrorism thereby harming world economy and peace.
Bitcoin is one of the example , is it authorised to issue such kind of currency or paper, where
funds are unknowly investing thereby increasing the value of bitcoin and realised gains are
transferring as a real earned Money.
The rules and Regulations and dual economy business treaty which always impact the
investigation in many ways which results in lack of evidence thereby relieving the case without
any proper action and prosecutions..
Which of the following is a characteristic of Baroque instrumental m.pdffsenterprises
Which of the following is a characteristic of Baroque instrumental music?
a. use of the direct ancestors of modern instruments
b. development of the orchestra
c. use of multi-movement works
d. all of the abovea.b.c.d.
Solution
Answer:
D.All of the above given characterize the Baroque instrumental music.
It uses direct ancestors of modern instruments with multi-movement works there were
development of the orchestra..
More Related Content
Similar to Were writing code for a project that dynamically allocates an arra.pdf
Data structuresUsing java language and develop a prot.pdfarmyshoes
Data structures:
****Using java language and develop a prototype for a demo program that reads in strings that
look like:
Using the infix to postfix code below:
A = 3; // your code should store A and 3 as a key-value pair
B = 4; // your code should store B and 4 as a key-value pair
A; // your code should now look-up A and then display its value
later we (you) will add the ability to write
Y = A * B + 3;
Y; // your code should show 16
Using this code
// infix.java
// converts infix arithmetic expressions to postfix
// to run this program: C>java InfixApp
import java.io.*; // for I/O
////////////////////////////////////////////////////////////////
class StackX {
private int maxSize;
private char[] stackArray;
private int top;
// --------------------------------------------------------------
public StackX(int s) // constructor
{
maxSize = s;
stackArray = new char[maxSize];
top = -1;
}
// --------------------------------------------------------------
public void push(char j) // put item on top of stack
{
stackArray[++top] = j;
}
// --------------------------------------------------------------
public char pop() // take item from top of stack
{
return stackArray[top--];
}
// --------------------------------------------------------------
public char peek() // peek at top of stack
{
return stackArray[top];
}
// --------------------------------------------------------------
public boolean isEmpty() // true if stack is empty
{
return (top == -1);
}
// -------------------------------------------------------------
public int size() // return size
{
return top + 1;
}
// --------------------------------------------------------------
public char peekN(int n) // return item at index n
{
return stackArray[n];
}
// --------------------------------------------------------------
public void displayStack(String s) {
System.out.print(s);
System.out.print(\"Stack (bottom-->top): \");
for (int j = 0; j < size(); j++) {
System.out.print(peekN(j));
System.out.print(\' \');
}
System.out.println(\" \");
}
// --------------------------------------------------------------
} // end class StackX
////////////////////////////////////////////////////////////////
class InToPost // infix to postfix conversion
{
private StackX theStack;
private String input;
private String output = \"\";
// --------------------------------------------------------------
public InToPost(String in) // constructor
{
input = in;
int stackSize = input.length();
theStack = new StackX(stackSize);
}
// --------------------------------------------------------------
public String doTrans() // do translation to postfix
{
for (int j = 0; j < input.length(); j++) {
char ch = input.charAt(j);
theStack.displayStack(\"For \" + ch + \" \"); // *diagnostic*
switch (ch) {
case \'+\': // it’s + or -
case \'-\':
gotOper(ch, 1); // go pop operators
break; // (precedence 1)
case \'*\': // it’s * or /
case \'/\':
gotOper(ch, 2); // go pop operators
break; // (precedence 2)
case \'(\': // it’s a left paren
theStack.push(.
1- The design of a singly-linked list below is a picture of the functi (1).pdfafgt2012
1. The design of a singly-linked list
below is a picture of the function that needs to be used
below is the code of the above picture:
#include <string>
#include <iostream>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define defaultSize 100
void Assert(bool val, string s)
{
if (!val)
{ // Assertion failed -- close the program
cout << "Assertion Failed: " << s << endl;
exit(-1);
}
}
template <typename E>
class Link {
public:
E element; // Value for this node
Link *next; // Pointer to next node in list
// Constructors
Link(const E& elemval, Link<E>* nextval = NULL)
{ element = elemval; next = nextval; }
Link(Link<E>* nextval =NULL) { next = nextval; }
};
template <typename E>
class LList: public Link<E> {
private:
Link<E>* head;// Intialization helper method
Link<E>* tail;// Pointer to last element
Link<E>* curr;// Access to current element
int cnt;// Size of list
void init(){// Intialization helper method
curr = tail = head = new Link<E>;
cnt = 0;
}
void removeall() {// Return link nodes to free store
while(head != NULL) {
curr = head;
head = head->next;
delete curr;
}
}
public:
LList(int size=defaultSize) { init(); }// Constructor
~LList() { removeall(); }// Destructor
void print() const;// Print list contents
void clear() { removeall(); init(); }// Clear list
// Insert "it" at current position
void insert(const E& it) {
curr->next = new Link<E>(it, curr->next);
if (tail == curr) tail = curr->next; // New tail
cnt++;
}
void append(const E& it) { // Append "it" to list
tail = tail->next = new Link<E>(it, NULL);
cnt++;
}
// Remove and return current element
E remove() {
Assert(curr->next != NULL, "No element");
E it = curr->next->element; // Remember value
Link<E>* ltemp = curr->next; // Remember link node
if (tail == curr->next) tail = curr; // Reset tail
curr->next = curr->next->next; // Remove from list
delete ltemp; // Reclaim space
cnt--; // Decrement the count
return it;
}
void moveToStart()// Place curr at list start
{ curr = head; }
void moveToEnd() // Place curr at list end
{ curr = tail; }
void prev(){
if (curr == head) return;
Link<E>* temp = head;
while (temp->next!=curr) temp=temp->next;
curr = temp;
}
void next(){ if (curr != tail) curr = curr->next; }
int length() const { return cnt; }
int currPos() const {
Link<E>* temp = head;
int i;
for (i=0; curr != temp; i++)
temp = temp->next;
return i;
}
void moveToPos(int pos){
Assert ((pos>=0)&&(pos<=cnt), "Position out of range");
curr = head;
for(int i=0; i<pos; i++) curr = curr->next;
}
const E& getValue() const {
Assert(curr->next != NULL, "No value");
return curr->next->element;
}
};
completed this code to fulfill the requirement below:
Write a function to insert an integer into a singly-linked list of elements arranged from largest to
smallest. Requires that elements remain ordered after insertion.
2. The design of array-based stack
below is a picture of the function that needs to be used
below is the code of the above picture:
#include <string.h>
#.
Use a simple vector you created before to create two other more steviesellars
Use a simple vector you created before to create two other more complex vectors with
A) Memory allocation that doubles size of memory when end reached, and 1/2's memory when the size reaches 1/4.
B) Implemented with a singularly linked list.
Main.cpp
#include
#include "SimpleVector.h"
//System Libraries
#include //Input/Output Library
using namespace std;
//User Libraries
//Global Constants, no Global Variables are allowed
//Math/Physics/Conversions/Higher Dimensions - i.e. PI, e, etc...
//Function Prototypes
void fillVec(SimpleVector &);
void addVec(SimpleVector &);
void delVec(SimpleVector &);
void prntVec(SimpleVector &,int);
//Execution Begins Here!
int main(int argc, char** argv) {
//Declare Variables
int size;
//Read in the size
cout<<"What size vector to test?"<
cin>>size;
SimpleVector sv(size);
//Initialize or input i.e. set variable values
fillVec(sv);
//Display the outputs
prntVec(sv,10);
//Add and subtract from the vector
addVec(sv);
//Display the outputs
prntVec(sv,10);
//Add and subtract from the vector
delVec(sv);
//Display the outputs
prntVec(sv,10);
//Exit stage right or left!
return 0;
}
void addVec(SimpleVector &sv){
int add=sv.size()*0.1;
for(int i=1;i<=add;i++){
sv.push_front(i+add-1);
sv.push_back(i-add);
}
}
void delVec(SimpleVector &sv){
int del=sv.size()*0.2;
for(int i=1;i<=del;i++){
sv.pop_front();
sv.pop_back();
}
}
void fillVec(SimpleVector &sv){
for(int i=0;i
sv[i]=i%10;
}
}
void prntVec(SimpleVector &sv,int n){
cout<
for(int i=0;i
cout<
if(i%n==(n-1))cout<
}
cout<
}
SimpleVector.h
// SimpleVector class template
#ifndef SIMPLEVECTOR_H
#define SIMPLEVECTOR_H
#include
#include // Needed for bad_alloc exception
#include // Needed for the exit function
using namespace std;
template
class SimpleVector
{
private:
T *aptr; // To point to the allocated array
int arraySize; // Number of elements in the array
void memError(); // Handles memory allocation errors
void subError(); // Handles subscripts out of range
public:
// Default constructor
SimpleVector()
{ aptr = 0; arraySize = 0;}
// Constructor declaration
SimpleVector(int);
// Copy constructor declaration
SimpleVector(const SimpleVector &);
// Destructor declaration
~SimpleVector();
//Adding and subtracting from the Vector
void push_front(T);
void push_back(T);
T pop_front();
T pop_back();
// Accessor to return the array size
int size() const
{ return arraySize; }
// Accessor to return a specific element
T getElementAt(int position);
// Overloaded [] operator declaration
T &o ...
Start with the inclusion of libraries#include iostream .docxMARRY7
// Start with the inclusion of libraries
#include <iostream> //The library of io functions
#include <fstream> //The library of external stream functions
#include <cstdlib> //The library for external errors
#include <string> //The library for string functions
#include <cmath> //The library of C math functions
#include <iomanip> //Allows setting widths, etc. for I/O
#include <stdlib.h>
#include <stdio.h>
#include<vector>
using namespace std;
// Define all of the prototypes for functions used in the program
// Counts the number of unique letters seen
int countunique(int *array, int size);
// Creates the input file and formats it for use by the cipher section.
void createinput(string ifile, string ofile);
// Creates the encoded input file
void createcipher(int key, string ifile, string ofile);
// Finds and counts the number of digrams
int digram(int *pointer, string ifile);
// Counts the letter frequency in the encoded input file
int lettercount(int*, string ifile, string ofile);
// Finds the highest count in the singlton (or any other) array
int singleton(int*, int size);
// Trims an input file to the right size starting at an offset
void trimfile(string ifile, string ofile, int offset, int size);
// Begin the main function for testing
int main(int argc, char* argv[])
{
int count = 0;
int second = 0;
int singlefreq[26];
int *single = singlefreq;
int delta;
int loop; //The loop counter for arguments
int final = 0;
int totalcnt;
int key = -1; //Sets the key value
int len = 0; //The length to investigate for testing
int off; //Holds the offset into the file
double m; //Holds the metric error value
char loopletter;
float percent;
string ifile1 = "";
string ofile1 = "";
string deflt = "c:\\dissertation\\ShiftandSubcipherC++files\\clean.txt";
string ifile2 = "";
string ofile2 = ""; //Holds selected file path names
string cmdarg; //Holds the command line argument
string stop = "l"; //Gives the stop condition, assumes l
string reportfile = "c:\\dissertation\\test\\report.txt";
ofstream outs; //Declare an output stream for reporting
int digramc[676]; //Set up the digram array
int *two = digramc; //Point to the digram array
int dicount = 0; //Holds the count of the number of digrams
int total = 0; //Counts the total number of letters seen for analysis
for (loop = 1; loop<argc; loop++) //Decide if we have arguments or must use defaults
{
if (!argv[1])
{
// cout << "No argument found.\n";
ifile1 = deflt;
}
else
{
cmdarg = argv[loop];
if (cmdarg == "-k")
{
loop++;
key = atoi(argv[loop]);
cout << "key = " << key << endl;
}
if (cmdarg == "-l")
{
loop++;
len = atoi(argv[loop]);
cout << "Run for " << len << " characters.\n";
}
if (cmdarg == "-m")
{
loop++;
m = atof(argv[loop]);
cout << "Run until and error of " << m << "\n";
}
if (cmdarg == "-off")
{
loop++;
off = atoi(argv[loop]);
cout << ...
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxcurwenmichaela
New folder/jsjf/ArrayStack.classpackage jsjf;
publicsynchronizedclass ArrayStack implements StackADT {
privatestaticfinal int DEFAULT_CAPACITY = 100;
private int top;
private Object[] stack;
public void ArrayStack();
public void ArrayStack(int);
public void push(Object);
private void expandCapacity();
public Object pop() throws exceptions.EmptyCollectionException;
public Object peek() throws exceptions.EmptyCollectionException;
public int size();
public boolean isEmpty();
public String toString();
}
New folder/jsjf/ArrayStack.javaNew folder/jsjf/ArrayStack.javapackage jsjf;
import jsjf.exceptions.*;
import java.util.Arrays;
// -------------------------------------------------------
// Author: Yifu Wu
// Date: 03/10/16
// Source Name: ArrayStack<T>
// Due date: 03/10/16
// Description:
/**
* An array implementation of a stack in which the bottom of the
* stack is fixed at index 0.
*
* @author Java Foundations
* @version 4.0
*/
publicclassArrayStack<T>implementsStackADT<T>
{
privatefinalstaticint DEFAULT_CAPACITY =100;
privateint top;
private T[] stack;
/**
* Creates an empty stack using the default capacity.
*/
publicArrayStack()
{
this(DEFAULT_CAPACITY);
}
/**
* Creates an empty stack using the specified capacity.
* @param initialCapacity the initial size of the array
*/
publicArrayStack(int initialCapacity)
{
top =0;
stack =(T[])(newObject[initialCapacity]);
}
/**
* Adds the specified element to the top of this stack, expanding
* the capacity of the array if necessary.
* @param element generic element to be pushed onto stack
*/
publicvoid push(T element)
{
if(size()== stack.length)
expandCapacity();
stack[top]= element;
top++;
}
/**
* Creates a new array to store the contents of this stack with
* twice the capacity of the old one.
*/
privatevoid expandCapacity()
{
//stack = Arrays.copyOf(stack, stack.length * 2);
System.out.println("Expanding stack capacity\n");
T[] temp =(T[])(newObject[2*top]);
for(int i=0; i< top; i++)
temp[i]= stack[i];
stack = temp;
}
/**
* Removes the element at the top of this stack and returns a
* reference to it.
* @return element removed from top of stack
* @throws EmptyCollectionException if stack is empty
*/
public T pop()throwsEmptyCollectionException
{
if(isEmpty())
thrownewEmptyCollectionException("stack");
top--;
T result = stack[top];
stack[top]=null;
return result;
}
/**
* Returns a reference to the element at the top of this stack.
* The element is not removed from the stack.
* @return element on top of stack
* @throws EmptyCollectionException if stack is empty
*/
public T peek()throwsEmptyCollectionException
{
if(isEmpty())
thrownewEmptyCollectionException("stack");
return stack[top-1];
}
/**
* Returns the number of elements in ...
Given the following ADT definition of a stack to use stack .docxshericehewat
Given the following ADT definition of a stack to use:
/** stack (base class)
* The basic definition of the Stack Abstract Data Type (ADT)
* and stack operations. All declared functions here are
* virtual, they must be implemented by concrete derived
* classes.
*/
template <class T>
class Stack
{
public:
/** clear
* Method to clear out or empty any items on stack,
* put stack back to empty state.
* Postcondition: Stack is empty.
*/
virtual void clear() = 0;
/** isEmpty
* Function to determine whether the stack is empty. Needed
* because it is undefined to pop from empty stack. This
* function will not change the state of the stack (const).
*
* @returns bool true if stack is empty, false otherwise.
*/
virtual bool isEmpty() const = 0;
/** push
* Add a new item onto top of stack.
*
* @param newItem The item of template type T to push on top of
* the current stack.
*/
virtual void push(const T& newItem) = 0;
/** top
* Return the top item from the stack. Note in this ADT, peeking
* at the top item does not remove the top item. Some ADT combine
* top() and pop() as one operation. It is undefined to try and
* peek at the top item of an empty stack. Derived classes should
* throw an exception if this is attempted.
*
* @returns T Returns the top item from stack.
*/
virtual T top() const = 0;
/** pop
* Remove the item from the top of the stack. It is undefined what
* it means to try and pop from an empty stack. Derived classes should
* throw an exception if pop() from empty is attempted.
*/
virtual void pop() = 0;
/** size
* Accessor method to provide the current size of the stack.
*
* @returns int The current size (number of items) on the stack.
*/
virtual int size() const = 0;
};
perform the following tasks by writing code that uses a stack to accomplish the task. You will
need to create a stack of the needed type, then use the methods of the stack abstraction (push,
top, pop, etc.) to solve the given task asked for.
Question 7 (5 points)
Given a stack of integers, calculate the sum of the integer values. Also, the stack should still be
unchanged after you have calculated the sum Hint: take the items off the stack to sum them up
and keep them on a second temporary stack so you can put them all back on after you have
calculated the sum.
ANSWER FOR NUMBER 7:
int sumStackOfIntegers(Stack<int> currentStack) {
Stack<int> tempStack;
int sum = 0;
while(!currentStack.isEmpty()) {
int temp = currentStack.top();
tempStack.push(temp);
currentStack.pop();
sum += temp;
}
while(!tempStack.isEmpty()) {
int temp = tempStack.top();
currentStack.push(temp);
tempStack.pop();
}
return sum;
}
Stack Implementation
Given the following linked list implementation of a Stack ADT (this is the same implementation
you used in Assignment 10), add the asked for additional member methods to the linked list stack
implementation.
/** Node
* A basic node contaning an item and a link to t ...
StackInterface An interface for the ADT stack. Do not modif.pdfARCHANASTOREKOTA
StackInterface
/**
An interface for the ADT stack.
Do not modify this file
*/
package PJ2;
public interface StackInterface
{
/** Gets the current number of data in this stack.
@return the integer number of entries currently in the stack*/
public int size();
/** Adds a new data to the top of this stack.
@param aData an object to be added to the stack */
public void push(T aData);
/** Removes and returns this stack\'s top data.
@return either the object at the top of the stack or,
if the stack is empty before the operation, null */
public T pop();
/** Retrieves this stack\'s top data.
@return either the data at the top of the stack or
null if the stack is empty */
public T peek();
/** Detects whether this stack is empty.
@return true if the stack is empty */
public boolean empty();
/** Removes all data from this stack */
public void clear();
} // end StackInterface
SimpleLinkedStack.java
/**
A class of stacks whose entries are stored in a chain of nodes.
Implement all methods in SimpleLinkedStack class using
the inner Node class.
Main Reference : text book or class notes
Do not change or add data fields
Do not add new methods
You may access Node object fields directly, i.e. data and next
*/
package PJ2;
public class SimpleLinkedStack implements StackInterface
{
// Data fields
private Node topNode; // references the first node in the chain
private int count; // number of data in this stack
public SimpleLinkedStack()
{
// add stataments
} // end default constructor
public void push(T newData)
{
// add stataments
} // end push
public T peek()
{
// add stataments
return null;
} // end peek
public T pop()
{
// add stataments
return null;
} // end pop
public boolean empty()
{
// add stataments
return false;
} // end empty
public int size()
{
// add stataments
return -1;
} // end isEmpty
public void clear()
{
// add stataments
} // end clear
public String toString()
{
// add stataments
// note: data class in stack must implement toString() method
// return a list of data in Stack, separate them with \',\'
return \"\";
}
/****************************************************
private inner node class
Do not modify this class!!
you may access data and next directly
***************************************************/
private class Node
{
private T data; // entry in list
private Node next; // link to next node
private Node (T dataPortion)
{
data = dataPortion;
next = null; // set next to NULL
} // end constructor
private Node (T dataPortion, Node nextNode)
{
data = dataPortion;
next = nextNode; // set next to refer to nextNode
} // end constructor
} // end Node
/****************************************************
Do not modify: Stack test
****************************************************/
public static void main (String args[])
{
System.out.println(\"\ \"+
\"*******************************************************\ \"+
\"Sample Expected output:\ \"+
\"\ \"+
\"OK: stack is empty\ \"+
\"Push 3 data: 10, 30, 50\ \"+
\"Print stack [50,30,10,]\ \"+
\"OK: sta.
package algs13;
import stdlib.*;
import java.util.Iterator;
import java.util.NoSuchElementException;
/* ***********************************************************************
* Compilation: javac Queue.java
* Execution: java Queue < input.txt
* Data files: http://algs4.cs.princeton.edu/13stacks/tobe.txt
*
* A generic queue, implemented using a linked list.
*
* % java Queue < tobe.txt
* to be or not to be (2 left on queue)
*
*************************************************************************/
/**
* The <tt>Queue</tt> class represents a first-in-first-out (FIFO)
* queue of generic items.
* It supports the usual <em>enqueue</em> and <em>dequeue</em>
* operations, along with methods for peeking at the top item,
* testing if the queue is empty, and iterating through
* the items in FIFO order.
* <p>
* All queue operations except iteration are constant time.
* <p>
* For additional documentation, see <a href="http://algs4.cs.princeton.edu/13stacks">Section 1.3</a> of
* <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne.
*/
public class Queue<T> implements Iterable<T> {
private int N; // number of elements on queue
private Node<T> first; // beginning of queue
private Node<T> last; // end of queue
// helper linked list class
private static class Node<T> {
public Node() { }
public T item;
public Node<T> next;
}
/**
* Create an empty queue.
*/
public Queue() {
first = null;
last = null;
N = 0;
}
/**
* Is the queue empty?
*/
public boolean isEmpty() {
return first == null;
}
/**
* Return the number of items in the queue.
*/
public int size() {
return N;
}
/**
* Return the item least recently added to the queue.
* @throws java.util.NoSuchElementException if queue is empty.
*/
public T peek() {
if (isEmpty()) throw new NoSuchElementException("Queue underflow");
return first.item;
}
/**
* Add the item to the queue.
*/
public void enqueue(T item) {
Node<T> oldlast = last;
last = new Node<>();
last.item = item;
last.next = null;
if (isEmpty()) first = last;
else oldlast.next = last;
N++;
}
/**
* Remove and return the item on the queue least recently added.
* @throws java.util.NoSuchElementException if queue is empty.
*/
public T dequeue() {
if (isEmpty()) throw new NoSuchElementException("Queue underflow");
T item = first.item;
first = first.next;
N--;
if (isEmpty()) last = null;
return item;
}
/**
* Return string representation.
*/
public String toString() {
StringBuilder s = new StringBuilder();
for (T item : this)
s.append(item + " ");
return s.toString();
}
// check internal invariants
private static <T> boolean check(Queue<T> that) {
int N = that.N;
Queue.Node<T> first = that.first;
Queue.Node<T> last = that.last;
if (N == 0) {
if (first != null) return false;
if (last != null) return false;
}
else if (N == 1) {
if (f.
Why do you believe money laundering is a difficult fraud to investig.pdffsenterprises
Why do you believe money laundering is a difficult fraud to investigate
Solution
Money laundering is mostly a difficult situation to Investigate as sometimes it miss the clue
chain for tracking Criminals, Sometimes Criminals not have a identity/social security to trace
and the funds moved through offshore accounts is still unavailable for accessing any kind of
information to whom transferred and whom to be transferred.
It is very difficult to trace when governmental authority or Person or Agent or Agency of
authority support / help such kinds of frauds or Money laundering situations. They are looting
and transferring the money within seconds and closing the accounts for unidentity.
Sometimes It may not be difficult to investigate but difficult to gather the evidence We all know
facts so happened but difficult to get evidence and prove in the court of law as because of
unauthorised way of activity and transaction, If it is authorised then all documents are available.
Every Country may not follow transparency rather they follow their own rules and regulations
depending upon the situations it is facing around the world. some of the countries indirectly
encouraging by not laying appropriate controls by way of regulations.
Most of the Money Laundering happening in the united states are belonging too or linked to
another country which results in gathering the evidence from other countries which is so risky
and lot of intrications are involved and very tricky situations. Some of the countries still
following anonymous way to open bank account and close the same, The country indirectly
promoting money laundering thereby terrorism thereby harming world economy and peace.
Bitcoin is one of the example , is it authorised to issue such kind of currency or paper, where
funds are unknowly investing thereby increasing the value of bitcoin and realised gains are
transferring as a real earned Money.
The rules and Regulations and dual economy business treaty which always impact the
investigation in many ways which results in lack of evidence thereby relieving the case without
any proper action and prosecutions..
Which of the following is a characteristic of Baroque instrumental m.pdffsenterprises
Which of the following is a characteristic of Baroque instrumental music?
a. use of the direct ancestors of modern instruments
b. development of the orchestra
c. use of multi-movement works
d. all of the abovea.b.c.d.
Solution
Answer:
D.All of the above given characterize the Baroque instrumental music.
It uses direct ancestors of modern instruments with multi-movement works there were
development of the orchestra..
What was the energy that was not passed on to the next trophic le.pdffsenterprises
What was the energy that was not passed on to the next trophic level used for?
What was the energy that was not passed on to the next trophic level used for?
Solution
The energy is used for the various metabolic reactions occuring in the body such as digestion,
respiration and other metabolic reactions and so at each level some energy is lost..
What sort of religious ideas does the megalith Stonehenge suggest A.pdffsenterprises
What sort of religious ideas does the megalith Stonehenge suggest? Are these religious ideas
similar to or different from those of Egypt and Mesopotamia? Are Egypt and Mesopotamia
similar or different in their cultural ideas? What accounts for these similarities or differences?
Include examples and evidence to support your conclusions.
Solution.
What are successful approaches to forecasting and creating a needed .pdffsenterprises
What are successful approaches to forecasting and creating a needed public sector budget? How
much should we train personnel in budget forecasting and creation?
Solution
The successful approaches of forecasting and creating public sector budget are as follows:
The personnel training is necessary for the budget forecast.
What are the major challenges for managing health care information t.pdffsenterprises
What are the major challenges for managing health care information technology in the context of
health care reform? How should existing and future health care information technology be
managed?
Solution
Tha Major Challenges :
There are Mainly 5 Information Technology Challenges Faced by Healthcare Organizations
Healthcare is among the economic sectors facing the most significant challenges in
implementing effective IT solutions.
Chief information officers in healthcare settings must balance strict privacy and security
requirements with the need to constantly improve IT infrastructure and performance. From small
doctor’s offices to major hospitals, the healthcare IT environment is increasingly complex and, if
not managed appropriately, can negatively impact patient care.
A Growing Flood of Data
Healthcare data usage is growing at an exponential pace for a variety of reasons. Digital imaging
technologies, electronic medical records, and resource-taxing applications are placing a strain on
existing data infrastructures. Mobile applications and a growing use of telemedicine technologies
also are increasing data generation and the need for its secure storage and management.
Federal HIPAA Privacy Requirements
The Health Insurance Portability and Accountability Act, or HIPAA, requires medical providers
to safeguard patients’ private medical information. The federal law requires stringent procedures
for backing up data along with recovering data in disaster and emergency situations. The Health
Information Technology for Economic and Clinical Health act, or HITECH, strengthened
HIPAA and increased penalties and requirements for mandatory notifications when data
breaches occur.
Inadequate Data Storage Capacity
Data storage needs for healthcare double approximately every 18 months, largely due to
regulatory pressure to keep patient information indefinitely. Forward-thinking medical
organizations have begun implementing strategic, multi-tiered storage plans that include on-site,
off-site and virtual storage. But improving overall storage capacity also requires more efficient
software solutions for managing the massive and growing amounts of data that now exist in
diverse medical environments.
Lack of Communication among Healthcare Systems
Only in the past few years have electronic medical records become the standard, and data
systems that smoothly interface between all medical providers remain years away. While the
industry regularly rolls out innovations to improve patient care and facility operations, the
advances often have limited capability to “talk” to each other. This lack of ability to interface
across systems restricts the ability to automate processes and to capture and use data effectively,
decreasing the return on investment for technology.
Increasing Costs of IT Projects in Healthcare
Healthcare organizations are facing rapidly increasing IT costs from a number of drivers,
including government regulations, growing energy needs and pressure t.
Using the Tustin equivalence with the prewarping method, fnd the dis.pdffsenterprises
Using the Tustin equivalence with the prewarping method, fnd the discrete equivalent of the
following H(s): H s s s s s ( ) = + + + + 2 5 7 3 8 2 2 With h = 0.5, conduct a Bode plot
comparison of continuous, Tustin equivalent, and backward differences.
Solution
Tustin Approximation
The Tustin or bilinear approximation yields the best frequency-domain match between the
continuous-time and discretized systems. This method relates the s-domain and z-domain
transfer functions using the approximation:
z=esTs1+sTs/21sTs/2.
In c2d conversions, the discretization Hd(z) of a continuous transfer function H(s) is:
Hd(z)=H(s),s=2Tsz1z+1
Similarly, the d2c conversion relies on the inverse correspondence
H(s)=Hd(z),z=1+sTs/21sTs/2
When you convert a state-space model using the Tustin method, the states are not preserved. The
state transformation depends upon the state-space matrices and whether the system has time
delays. For example, for an explicit (E = I) continuous-time model with no time delays, the state
vector w[k] of the discretized model is related to the continuous-time state vector x(t) by:
w[kTs]=(IATs2)x(kTs)Ts2Bu(kTs)=x(kTs)Ts2(Ax(kTs)+Bu(kTs)).
Ts is the sample time of the discrete-time model. A and B are state-space matrices of the
continuous-time model.
Tustin Approximation with Frequency Prewarping
If your system has important dynamics at a particular frequency that you want the transformation
to preserve, you can use the Tustin method with frequency prewarping. This method ensures a
match between the continuous- and discrete-time responses at the prewarp frequency.
The Tustin approximation with frequency prewarping uses the following transformation of
variables:
Hd(z)=H(s),s=tan(Ts/2)z1z+1
This change of variable ensures the matching of the continuous- and discrete-time frequency
responses at the prewarp frequency , because of the following correspondence:
H(j)=Hd(ejTs)
Tustin Approximation for Systems with Time Delays
You can use the Tustin approximation to discretize SISO or MIMO continuous-time models with
time delays.
By default, the Tustin method rounds any time delay to the nearest multiple of the sample time.
Therefore, for any time delay tau, the integer portion of the delay, k*Ts, maps to a delay of k
sampling periods in the discretized model. This approach ignores the residual fractional delay,
tau - k*Ts.
You can to approximate the fractional portion of the delay by a discrete all-pass filter (Thiran
filter) of specified order. To do so, use the FractDelayApproxOrder option ofc2dOptions.
To understand how the Tustin method handles systems with time delays, consider the following
SISO state-space model G(s). The model has input delay i, output delay o, and internal delay .
The following figure shows the general result of discretizing G(s) using the Tustin method.
By default, c2d converts the time delays to pure integer time delays. The c2d command
computes the integer delays by rounding each time delay to the nearest multiple o.
Use Java programming Thank you very much Programing requirement for.pdffsenterprises
Use Java programming Thank you very much Programing requirement for: Safety Alert System
Version 01 I. Project and class name Create a new project name: yourfirst lastname program01
(you must include your name in the project name) Create a new class name: Safety Alert V0 1 II.
Requirement i. Input Prompt appropriate messages that asking use to enter: city name, season,
temperature, and raining. Input validation: your program has to valid the user input and prompt
specific message when user enter invalid input. Base on following validation: City name: only
can be string of letters, not containing number. Maximum length is 20 Season: only can be either
SUMMER or WINTER Temperature is in double Raining is in integer number if the program
found an invalid input, prompt a specific message that tell which input is invalid and what is the
correction format ofthat input should be, then STOP the program. That Page 2 of 4
Solution
import java.util.*;
class Safety_Alert_VO_1
{
private static double CONST_MIN_TEMP_WINTER = -20;
private static double CONST_MAX_TEMP_SUMMER = 127;
public static void main (String[] args)
{
Scanner scan = new Scanner(System.in);
boolean road_ice,call_for_help,flood,tminchange,tmaxchange;
road_ice = false;
call_for_help = false;
tminchange = false;
tmaxchange = false;
String stay_inside = \"no\";
System.out.println(\"Enter city name \");
String city = scan.next();
if ((city.contains(\"[a-zA-Z]+\") == true) || (city.length() > 20))
{
System.out.println(\"Error: city name should be a string with not more than 20
characters\");
System.exit(0);
}
System.out.println(\"Enter season : \");
String season = scan.next();
if(!(season.equals(\"WINTER\") || season.equals(\"SUMMER\")))
{
System.out.println(\"Error Season can be SUMMER or WINTER\");
System.exit(0);
}
System.out.println(\"Enter temperature : \");
double temp = scan.nextDouble();
System.out.println(\"Enter raining : \");
int rain = scan.nextInt();
switch(season)
{
case \"WINTER\": if((temp < 32)&&(rain > 0))
road_ice = true;
if((temp < 5)||(rain>250))
stay_inside = \"yes\";
else
stay_inside = \"no\";
if((temp<-15)||(rain>500))
call_for_help = true;
if(temp350)
flood = true;
if((temp>120)||(rain>250))
stay_inside = \"yes\";
else
stay_inside = \"no\";
if((temp>125)||(rain>500))
call_for_help = true;
if(temp>CONST_MAX_TEMP_SUMMER)
{
CONST_MAX_TEMP_SUMMER =
Math.max(temp,CONST_MAX_TEMP_SUMMER);
tmaxchange = true;
}
}
System.out.println(\"CS103 Spring 2017\");
System.out.println(\"Student : first and last name \");
System.out.println(\"Index Number : \");
System.out.println(\"The Cities Safety Alert System V01\");
System.out.println(\"City Name : \"+city);
System.out.println(\"Season : \"+season);
System.out.println(\"Temperature : \"+temp+ \" Raining : \"+rain);
System.out.println(\"Road icing : \"+road_ice+\" Stay inside : \"+stay_inside);
if(tminchange == true)
System.out.println(\"This is the new minimum temperature record\");
if(tmaxchange == true)
System.out.println(\"This is.
Translate the following C++ code segment into Mic-1 IJVM machine lan.pdffsenterprises
Translate the following C++ code segment into Mic-1 IJVM machine language, assuming i, j,
and k are the first, the second and third local variables, respectively.
i=i-j; if (i==8) ksiEEJ; =1 else k=i | j; k-1 | | j; ji&- fk1k
Solution
step 1 :first declare the variables i,j,k in the main section.
Here we assumed that i,j,k have values initially. Otherwise we need to push the value onto the
stack and store it in the variables before starting the operations.
step 2: write the code after ending the variables declaration section
step3: write halt before ending main
.main
.var
i
j
k
.end-var
ILOAD i
ILOAD j
ISUB
ISTORE i
ILOAD i
BIPUSH 8
IF_ICMPEQ L1 // if(i==8)
ILOAD i
ILOAD j
IOR // k=i||j
ISTORE k
GOTO L2
L1: ILOAD i
ILOAD j
IAND // k=i&&j
ISTORE k
L2:
HALT
.end-main.
Transactions On September 1 of the current year, Joy Tucker estab.pdffsenterprises
Transactions
On September 1 of the current year, Joy Tucker established a business to manage rental
property. She completed the following transactions during September:
Required:
1. Indicate the effect of each transaction and the balances after each transaction:
For those boxes in which no entry is required, leave the box blank.
For those boxes in which you must enter subtractive or negative numbers use a minus sign.
(Example: -300)
2. Stockholders\' equity is the right of stockholders\' to the assets of the business. These rights are
increased by issuing common stock and revenues and decreased by dividends and expenses.
3. Determine the net income for September.
$
4. How much did September\'s transactions (a-j) increase or decrease retained earnings?
Increased by $Assets=Liabilities+Stockholders\' EquityItemCash+Accounts
Receivable+Supplies=Accounts Payable+Common Stock-Dividends+Fees Earned-Rent
Expense-Sal. Expense-Supp. Expense-Auto Expense-Misc. ExpenseItem a. a. b. b. Bal. Bal.
c. c. Bal. Bal. d. d. Bal. Bal. e. e. Bal. Bal. f. f. Bal. Bal. g. g. Bal. Bal. h. h. Bal.
Bal. i. i. Bal. Bal. j. j. Bal. Bal.
Solution.
To correct the vision of a person who is nearR sighted, we use a div.pdffsenterprises
To correct the vision of a person who is nearR sighted, we use a diverging lens to cause the rays
from the distant object to diverge slightly, as if they were coming from a closer object, allowing
the eye to focus the image on the retina. In this example, a nearRsighted eye has near and far
points of 12 cm and 17 cm, respectively. Assume that the prescribed lens is 2.0 cm from the eye.
a) What lens power is needed for this person to see a distant object clearly? For a distant object,
the lens must put the image at the far point of the eye so that the person can focus
on it.
i) What is the object distance?
ii) What is the image distance?
iii) Now you can use the thin lens equation to find the focal length of the lens that must be
prescribed:
iv) What is the power of the lens?
Solution
i) Object distance is u= infinity
ii) Now the image from the lens should be at the far point. Since the image is in front of the lens,
it is negative
Image distance is v= -15cm
iii) Thin lens equation => 1/f=1/u+1/v
=>1/f=1/inf+1/(-15)
=>f=-15cm
iv) Power =1/f(in m)=-1/0.15=-6.67D.
The height of the water in the tank pictured below 7 ft. The tank is.pdffsenterprises
The height of the water in the tank pictured below 7 ft. The tank is emptied from a pump at the
top of the tank. Set up an integral to determine how much work is done by the pump. dont need
to evaluate.
Solution
there is no picture displayed ( picture mentioned in the question).. please post again
with the picture...
Suppose that a classroom has 4 light bulbs. The probability that eac.pdffsenterprises
Suppose that a classroom has 4 light bulbs. The probability that each individual light bulbs work
is 0.6. Suppose that each light bulb works independently of the other light bulbs. What is the
probability that none of the 4 light bulbs work?
Solution
Probabiltiy that bulb lights=0.6
probability that bulb doesnot light=1-0.6=0.4
P(None works)=0.4*0.4*0.4*0.4=0.0256.
Security Standards Please respond to the following A number of .pdffsenterprises
\"Security Standards\" Please respond to the following: A number of organizations exist to define
information security standards. Explain the importance of standards organizations with regard to
both information systems and information systems security. Provide a rationale for your
response. Determine two (2) specific concerns that you believe exist for cloud deployments, and
ascertain whether or not data breaches, such as the Snowden Incident have heightened concerns.
Justify your answer.
Solution
Information security for information systems are key for sustaining the organization and its
identity in the information technology environment. As per the continues improvement on
sustaining system, information systems security standardization was created huge importance to
secure the organization information and to maintain certain guidelines to mitigate problems.
The following standard organizations provide guidelines and required certifications for business
organizations to ensure the security of information systems.
American National Standards Institute (ANSI)
Global Engineering Documents
British Standards Institute (BSi)
British Standard 7799 (BS7799)
Center for Internet Security (CIS)
Institute of Electrical and Electronic Engineers (IEEE)
IEEE standards that relate to Security
International Information Systems Security Certification Consortium, Inc. (ISC)2
International Organization for Standardization (ISO)
ISO/IEC 17799:2000
ISO 17799 Community Forum
Internet Architecture Board (IAB)
Internet Assigned Numbers Authority (IANA)
National Institute of Standards and Technology (NIST)
Computer Security Resource Center (CSRC)
Guide to NIST Information Security Documents
Federal Information Processing Standard 200 (FIPS 200)
Federal Information Processing Standard 201 (FIPS 201-1)
Guide for Developing Security Plans for Federal Information Systems
Federal Desktop Core Configuration (FDCC)
National Security Agency (NSA)
Rationale: It is always recommend to apply at least to follow any of the applicable
standardization guidelines, in order to keep sustainable information systems in organization.
Standardization always says and improves the security and controls on allowing security
breaches to our MIS.
Recent times could computing has become the predominant growth for small and medium scale
organization to mitigate the cost of implementation on information systems. Security of the same
and allowing access to external agents is so critical which is directly granting access to important
data. Like the above standard guidelines tell us to maintain the NDAs, system access controls..
Real Estate Finance essay questionWhy did observers at first belie.pdffsenterprises
Real Estate Finance essay question
Why did observers at first believe that the damage from the impending subprime mortgage crisis
would be too small to cause a recession?
Solution
Subprime lending is the loan\'s, given by the banks to the people based on there creditworthiness,
banks initially thought that they will earn high profits by giving loans at higher rate of interest to
the people, in case if they fail to deposit the loaned amount back, the bank will profit by selling
the land/home, they assumed that real state prices will rise with respect to time. Sooner the
borrowers started to default on there EMI\'s, as well the availability of houses increased at such a
level that nobody seemed to be interested, thus this asset is called toxic asset or the bubble burst
has occured in the economy.
Initially, it is beleived that this subprime crisis would be too small to cause a recession because
the market was on the peak, real state prices are high, investors worldwide are investing in USA,
mortgage backed securities to stronghold securitization process, governments supportive policies
etc are some of the factors that led to this mirage like situation.
As the borrowers defaulted, the creditors lost there confidence in the american banking system,
soon the stocks crashed, people started taking there money back from the banks, the liquidity
disbalanced, also it lead to the cascading effect, other european economies also affected as
investors from this countries also occured big losses, in order to sustain this shock, there is high
unemployement, cost cutting etc which further elevated the problems..
Provide your key points of Setup Reducation Provide your key points.pdffsenterprises
Provide your key points of Setup Reducation? Provide your key points of Kanban? Provide
how a Kaizen event works? What are the benefts?
Solution
Key points for setup reduction
1.Documentation of the setup
2.Divide events into internal and external events
3.Convert internal to external events
4.Streamline internal events by simplifying,reducing and eliminating.
Please help. C++ The program is an interactive program th.pdffsenterprises
Please help. C++
The program is an interactive program that reads input from the keyboard. Several instructions
(listed below) may be entered by the user. For each input, the program will give a short response
printed to cout. Each response to cout is followed by a single endl.
Important: The program must not try to store all the numbers in a single big array. In fact, it is
outlawed by the CSI police that you have any array that is larger than 100 elements. Instead, you
should create a frequency array which has indexes from [0] to [99]. A location, such as
frequency[i], tells you how many times the number i has occurred in the input. This frequency
array should be initialized to all zeros, and each time a number is read, the program will add one
to the corresponding array location. For example, frequency[42] begins at zero. When one 42 is
read, frequency[42] is increased to one. If another 42 is read, frequency[42] is increased to two,
and so on. All of the statistics that you need to calculate can be computed based on the frequency
array (so that you don\'t need to store all those numbers separately).
• Input: The letter N followed by an integer in the range 0 to 99. The biggest possible input
number is 99. The specification does not care what the program does for numbers that are
outside of the legal range.
Output: The word \"OK\".
• Input: The letter S.
Output: The output is the SUM of all the input numbers read so far. This output is 0 if there has
not yet been any numbers read by the program.
• Input: The letter A.
Output: The output is the AVERAGE of all the input numbers read so far, calculated as a double
number. For example, if there have been four input numbers 2, 2, 6 and 5, then the average is
3.75. If there has not yet been any input numbers, then the program should print the word
\"ERROR\" instead of an average.
• Input: The letter B.
Output: The output is the BIGGEST of all the input numbers read so far, For example, if there
have been four input numbers 2, 2, 6 and 5, then the biggest is 6. If there has not yet been any
input numbers, then the program should print the word \"ERROR\" instead of a number.
• Input: The letter F.
Output: The output is the most FREQUENT of all the input numbers read so far--in other words,
the number that has been read most often (also called the \"mode\"). If there are several numbers
that are equally often, then the smallest number is printed. For example, if there have been four
input numbers 2, 2, 6 and 5, then the most frequent is 2. If there has not yet been any input
numbers, then the program should print the word \"ERROR\" instead.
• Input: The letter H.
Output: The output is a count of HOW MANY numbers have been input so far. This could be as
small as zero.
• Input: The letter M.
Output: The output is the MEDIAN of all the input numbers read so far. The median is a number
that has no more than half of the input numbers below it and no more than half the input numbers
above it. For example.
please answer this case using down picturein business ethics emplo.pdffsenterprises
please answer this case using down picture
in business ethics employee benefits CASE 4: Richard and Conway are talking in the hallway
about the program. Conway, who has had some recent financial trouble, explains to Richard how
the benefits program has a loophole that will allow him to receive some financial assistance that
he really needs to help pay health care costs for his mother. Cathy, a fellow worker, overhears
the conversation. Later, Cathy is approached by her supervisor who says he heard a rumor that
some people were Ataking advantage of the company benefits program
Solution
1. The ethical issue or problem in this case is that Conway has found a loophole in the employee
benefits program. Cathy overheard the conversation between Conway and Richard and the
ethical issue that she is facing her is that should she inform her supervisor that Conway has
found a loophole and thus violate Conway\'s rights or should she keep quiet about the issue and
let the employees take advantage of the program.
2. The facts that have most bearing on the case are: Conway had told Richard about his financial
troubles. Conway\'s mother\'s health, and the possibility of the company losing money due to the
loophole are the factors that have a bearing on the case.
3. Conway will be affected if Cathy informs the supervisor and he may get fired. In this case
Cathy will get an award. Richard can also be fired as he has the information and selects not to
pass on this information to his supervisor.
4. Conway would expect that the supervisor is not informed so that he can use the financial
assistance for the treatment of his mother. Cathy would expect an award for informing about the
loophole. Richard was just a listener and will expect nothing from me.
5. 3 alternatives (i) Inform the supervisor about the loophole. In this case, the best case scenario
is that the supervisor will plug the loophole and award Cathy for the information. As Conway
was in real need of money for his mother\'s treatment, he will not be punished and will be let off
with a warning. The worst case scenario is that Conway will be fired.
(ii) do not inform the supervisor about the loophole but confront Conway so as to not take any
unwarranted advantage of this loophole in future. The best case scenario is that Conway will use
the loophole to get his mother\'s treatment and the loophole will not be abused by him in future.
The worst case is that Conway and Richard start abusing the loophole for their personal
advantage. (iii) The last alternative is to do nothing. The best case scenario is that Conway will
use the loophole to get his mother\'s treatment and the loophole will not be abused by him in
future. The worst case is that Conway and Richard start abusing the loophole for their personal
advantage.
6. The course of action determined by me is to plug the loopholes. This will ensure that the
company does not lose money in future. However, Conway should be allowed by HR to take
some financial a.
Al has three times as much money as Bill. Bill has two times as much.pdffsenterprises
Al has three times as much money as Bill. Bill has two times as much money as Charlie. If
Charlie has $5.89, how much money does Al have?
A. $11.78
B. $19.79
C. $29.24
D. $35.34
Solution
D. Create equations to solve this problem.
Al=3(Bill)
Bill = 2(Charlie)
Charlie=$5.98
Solve for Al. Substitute what you know into the formulas.
Bill = 2($5.89)
Bill = $11.78
To find Al, substitute what you know about Bill.
Al = 3($11.78)
Al = $35.34.
A SURVEY is a tool used to collect information about a population. L.pdffsenterprises
A SURVEY is a tool used to collect information about a population. List 2 strengths and 2
weaknesses of this tool.
Solution
Surveys are economical
They collect huge amount of data.with simple means like proper questionnaire.and not needing
any advanced equipment,
They help in providing overall idea regarding any issue
But they are time consuming
and the outcome depends on the effectivenes of the questions, approach to the people and their
response...So any communication gap leads to inaccurate studies..
How to Create Map Views in the Odoo 17 ERPCeline George
The map views are useful for providing a geographical representation of data. They allow users to visualize and analyze the data in a more intuitive manner.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Basic phrases for greeting and assisting costumers
Were writing code for a project that dynamically allocates an arra.pdf
1. We're writing code for a project that dynamically allocates an array stack. My other code works,
but my Min(), Max(), and Peek() functions fail. I've provided my code for those functions at the
end of the post.
main.cpp
_________________________________________
#include
#include
#include
#include
#include "stack.h"
using namespace std;
int main(int argc, char* argv[])
{
ifstream inputs; // Input file for commands
char op; // Hold operation and optional char input
int value; // Value input from file
string comment; // Holds comment from file
Stack* sPtr = NULL; // Will point to TemplateQ object
// Output usage message if one input file name is not provided
if (argc != 2)
{
cout << "Usage: project03 ";
return 1;
}
// Attempt to open input file -- terminate if file does not open
inputs.open(argv[1]);
if (!inputs)
{
cout << "Error - unable to open input file" << endl;
return 1;
}
// Input and echo header comment from file
getline(inputs, comment); // Input and echo the comment appearing in the test file
2. cout << endl << '#' << comment << endl;
// Process commands from input file
inputs >> op; // Attempt to input first command
while (inputs)
{
switch (op) // Process operation input from file
{
case '#': // Test file comment
getline(inputs, comment); // Input and echo the comment appearing in the test
file
cout << '#' << comment << endl;
break;
case 'c': // Parameterized Constructor
inputs >> value;
cout << endl << "Stack(" << value << ")";
try
{
sPtr = new Stack(value); // Attempt to create a stack object with array size
value
cout << " -- completed" << endl;
}
catch ( std::bad_alloc )
{
cout << "Failed : Terminating now..." << endl;
return 1;
}
break;
case '+': // Push
inputs >> value;
cout << "Push(" << value << ") -- ";
try
{
sPtr->Push(value);
cout << "completed";
8. inputs >> op; // Attempt to input next command
}
return 0;
} // End main()
_______________________________________________________________
stack.h
_________________________________
//
// The comments have been updated, but there have been no changes to the code.
//
// Specification file for Stack class, a stack of integers implemented
// as an array whose size can be increased to store more data.
//
// ***** DO NOT MODIFY OR SUBMIT THIS FILE *****
//
#include
using namespace std;
#ifndef STACK_H
#define STACK_H
class StackEmpty
{
// Exception class - throw an object of this type when stack is empty
// Hint: there is no code for exception classes
};
class StackFull
{
// Exception class - throw an object of this type when stack is full
};
class StackInvalidPeek
{
// Exception class - throw an object of this type when invalid peek position is used
};
9. class Stack // Models stack of integers ADT implemented as a dynamically allocated
array
{
private:
int* array; // Points to the stack array
int num; // Holds max number of elements that may be stored in stack array
int top; // Holds the index of the top data value stored on the stack
void Resize(int n); // Attempts to increase size of stack array to 2*num and then push n onto
stack
// If unable to resize, throw StackFull exception
public:
Stack(int n); // Parameterized constructor dynamically allocates an empty stack array
// that may hold no more than n elements and initializes other private variables
~Stack(); // Destructor deallocates all dynamically-allocated memory
// associated with the object
void Push(int n); // Pushes integer n onto top of stack. If stack is full, attempts to
// resize stack and then push n. If unable to resize, throws StackFull exception.
void Pop(); // Removes top integer from stack
// If stack is empty, throws StackEmpty exception
bool IsEmpty() const; // Returns true if stack is empty; false otherwise
bool IsFull() const; // Returns true if stack is full; false otherwise
void MakeEmpty(); // Removes all items from stack leaving an empty, but usable stack
with capacity num
// If stack is already empty, MakeEmpty() does nothing
int Top() const; // Returns value of top integer on stack WITHOUT modifying the stack
// If stack is empty, throws StackEmpty exception
int Size() const; // Returns number of items on stack WITHOUT modifying the stack
int Max() const; // Returns value of largest integer on stack WITHOUT modifying the
stack
// If stack is empty, throws StackEmpty
10. int Min() const; // Returns value of smallest integer on stack WITHOUT modifying the
stack
// If stack is empty, throws StackEmpty
int Peek(unsigned int n) const; // Returns stack value n levels down from top of stack. Peek(0)
= Top()
// If position n does not exist, throws StackInvalidPeek
int Capacity() const; // Returns total num of elements that maybe stored in stack array
/******* DO NOT MODIFY ANY OF THE CODE FOR PRINT() *******/
/****** DO NOT PLACE A COPY OF PRINT() CODE IN STACK.CPP!!! *******/
void Print() const // Writes stack contents to stdout, separated by a space, followed by endl
{
int index = top;
cout << "Top { ";
while (index != -1)
{
cout << array[index] << " ";
index--;
}
cout << "} Bottom" << endl;
} // End Print()
}; // End Class Stack
#endif
_____________________________________________________________
.txt file
______________________________
# p03input3.txt -- Test Min(), Max(), Peek(...)
# Test Min() and Max()
c 8
<
>
+ 5
11. + 30
+ 15
+ 20
+ 50
+ 10
p
<
>
+ 20
+ 50
+ 5
p
<
>
-
-
-
p
<
>
-
-
-
p
<
>
d
# Test Peek(n)
c 8
? 0
+ 5
+ 30
+ 15
+ 20
+ 50
13. ? 3
? 4
? 5
d
____________________________________________________________
Error Messages
_________________________________________________________
Here's my code.
stack.cpp start of p3input3.txt Min ( ) -- Min ( ) -- Min ( ) -- Min() -- | Min) -- 5 in) -5 | Min() -- 5
Min) -- 5 FAILED Incorrect outputs PASSED No memory leak detected FAILED p031nput3.txt
End of p31nput3.txt
Solution
#include
#include
#include
#include
#include "stack.h"
using namespace std;
int main(int argc, char* argv[])
{
ifstream inputs; // Input file for commands
char op; // Hold operation and optional char input
int value; // Value input from file
string comment; // Holds comment from file
Stack* sPtr = NULL; // Will point to TemplateQ object
// Output usage message if one input file name is not provided
if (argc != 2)
{
cout << "Usage: project03 ";
return 1;
}
14. // Attempt to open input file -- terminate if file does not open
inputs.open(argv[1]);
if (!inputs)
{
cout << "Error - unable to open input file" << endl;
return 1;
}
// Input and echo header comment from file
getline(inputs, comment); // Input and echo the comment appearing in the test file
cout << endl << '#' << comment << endl;
// Process commands from input file
inputs >> op; // Attempt to input first command
while (inputs)
{
switch (op) // Process operation input from file
{
case '#': // Test file comment
getline(inputs, comment); // Input and echo the comment appearing in the test
file
cout << '#' << comment << endl;
break;
case 'c': // Parameterized Constructor
inputs >> value;
cout << endl << "Stack(" << value << ")";
try
{
sPtr = new Stack(value); // Attempt to create a stack object with array size
value
cout << " -- completed" << endl;
}
catch ( std::bad_alloc )
{
cout << "Failed : Terminating now..." << endl;
return 1;