C++ Lexicographical Sorting
Given a file of unsorted words with mixed case: read the entries in the file and sort those words lexicographically. The program should then prompt the user for an index, and display the word at that index. Since you must store the entire list in an array, you will need to know the length. The "List of 1000 Mixed Case Words" contains 1000 words.
You are guaranteed that the words in the array are unique, so you don't have to worry about the order of, say, "bat" and "Bat."
For example, if the array contains ten words and the contents are
cat Rat bat Mat SAT Vat Hat pat TAT eat
after sorting, the word at index 6 is Rat
You are encouraged to use this data to test your program.
In: Computer Science
1.
Test Company reported the following income statement for the most recent period.
|
Sales (6,000 units) |
$120,000 |
|
Variable expenses |
72,000 |
|
Contribution margin |
48,000 |
|
Fixed expenses |
30,000 |
|
Operating income |
$18,000 |
Determine the breakeven point in units.
Note: Give your answer using commas. Do not include the word “units.”
Example: 12,345
2. Determine the number of units Test Company must sell to earn operating income of $20,000. Note: Give your answer using commas. Do not include the word “units.”
3.
Determine the breakeven point in dollars.
Note: Give your answer using dollar signs and commas but not decimal points (cents).
Example: $12,345
4.
Determine the sales revenue Test Company must generate to earn operating income of $30,000.
Note: Give your answer using dollar signs and commas but not decimal points (cents).
5.
Determine the margin of safety in dollars.
Note: Give your answer using dollar signs and commas but not decimal points (cents).
6.
Determine the margin of safety in units.
Note: Give your answer using commas. Do not include the word “units.”
Example: 12,345
7.
Test Company’s sales manager proposed holding a Holiday Sale. Prices would be discounted 5% and an additional $1,000 would be used for advertising to promote the event. Determine the number of units Test Company must sell during the promotion to continue earning $18,000.
Note: Give your answer using commas. Do not include the word “units.”
Example: 12,345
8.
Test Company reported sales of $250,000, variable expenses of $190,000 and fixed expenses of $48,000. Determine the sales revenue needed to break even.
Note: Give your answer using dollar signs and commas but not decimal points (cents).
Example: $12,345
In: Accounting
|
Problem Set 1: Based on Craik and Lockhart (1972)’s levels of processing theory, a teacher wanted to see if the levels of processing impact memory performance in third grade children. All children participated in all conditions (which were counterbalanced) by studying 10 words in each condition. In one condition, the children were simply asked to judge the physical characteristics of each printed word (physical), in another condition the children were asked about the sound of each word (sound), in a third condition, children were required to process the meaning of each word (meaning), and in the fourth condition, the children were required to relate the word to themselves. After going through their weekly list of words, they were given a surprise memory test where they had to write down the words they had been practicing that week. The number of correctly recalled words for each type of processing is shown in the table below. Did level of processing affect recall?
Paste appropriate SPSS output. Paste appropriate SPSS graph, formatted in APA. Write an APA-style Results section based on your analysis. It should include the statistical statement within a complete sentence that mentions the type of test conducted, whether the test was significant, and if relevant, effect size and/or post hoc analyses. Don’t forget to include a decision about the null hypothesis and refer the reader to your Figure 1. |
In: Statistics and Probability
class Arrays1{
public int getSumOfValues(int[] arr){
// return the sum of values of array elements
int sum = 0;
int i;
for(i = 0; i < arr.length; i++){
sum += arr[1];
}
return sum;
}
public int getAverageValueInArray(int[] arr){
// return the average value of array elements
int value = 0;
for(int i = 0; i < arr.length; i++){
double average = value/ arr.length;
}
return value;
}
public int getNumberOfEvens(int[] arr){
//return the number of even values found in the array
int even = 0;
for(int i = 0; i < arr.length; i++){
if(i % 2 == 0){
}
}
return even;
}
public int getNumberOfOdds(int[] arr){
// return the number of odd vsalues found in the array
int odd = 0;
for(int i = 0; i < arr.length; i++){
if(i % 2 != 0){
}
}
return odd;
}
public int maxValue(int[] arr){
// return max value in array
int maxValue = arr[0];
for(int i = 1; i < arr.length; i++){
if(arr[i] > maxValue){
maxValue = arr[i];
}
}
return maxValue;
}
public int minValue(int[] arr){
// return min value in array
int minValue = arr[0];
for(int i = 1; i < arr.length; i++){
if(arr[i] < minValue){
minValue = arr[i];
}
}
return minValue;
}
public boolean arrayContainsWord(String[] arr, String word){
// return true if array contains specific word, false
otherwise
for(int i = 0; i < arr.length; i++){
if(arr[i].equals(word));
return true;
}
return false;
}
public int getIndexOfWord(String[] arr, String word){
// if found, return the index of word, otherwise return -1
for(int i = 0; i < arr.length; i++){
if(arr[i].equals(word)){
return i;
}
}
return -1;
}
public boolean areArrays(int[] arr1, int[] arr2){
// 1. initial check: both arrays need to have the same length,
return false if not the same
// 2. return true if both given arrats are equals(same values in
the same indices), false otherwise
if(arr1.length != arr2.length){
return false;
}
for(int i = 0; i < arr1.length; i++){
if(arr1[i] != arr2[i]){
}
}
return true;
}
public boolean areArraysEqual(String[] arr1, String[] arr2){
// 1. initial check: both arrays need to have the same length,
return false if not the same
// 2. return true if both given arrays are equals(same values in
the same indices), false otherwise
if(arr1.length != arr2.length){
return false;
}
for(int i = 0; i < arr1.length; i++){
if(arr1[i].equals(arr2[i])){
}
}
return false;
}
}
Write ArraysDriver (similar design to LoopsDriver):
In this assignment, you will pass arrays as arguments to these methods. You may declare and initialize these arrays before the loop and reuse them throughout your application. For this assignment, use arrays of 5 elements. You will need 2 int[] arrays and 2 String[] arrays to be declared and initialized before the main loop. You may use arbitrary values for each item/element in the arrays.
The only input you will need from the user (other than the menu option selected) is a word to use for arrayContainsWord and getIndexOfWord.
In: Computer Science
Problem:
Given: Words.dat – a binary file consisting of all the words in War and Peace
Goal: Read the words in from the binary file and figure out how many times each word appears in the file. Display the results to the user.
Use a HashMap with the word as a key (String) and an Integer as the value. For each word, first check to see if it already exists in the Map. If not, add the word as key with a value of 1 for the Integer value.
If it does, get the current value and increment by 1 – replace the old key,value with the new key, value.
After all the words are processed and the HashMap is complete. Iterate through the Hash map and display the results in a user -friendly fashion. Tell me which option you chose in the Assignment box when you submit the homework
Display Options: (Choose one not all)
Example:
Word Count
A 190
Apple 6
Etc
C. Create a text file with the data formatted similar to the console
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
/**
* This file is intended to show how the binary file words.dat was
created
*This is not intended to be used only to
* demonstrate how the file was written so it can be read
properly
*cjohns25
*/
public class CreateBinaryFile
{
public static void main(String[] args)
{
// step 1 - read in all the words
from war and peace into an arrayList
ArrayList words = new
ArrayList();
Scanner in;
try
{
in = new
Scanner(new File("war-and-peace.txt"));
// Use any
characters other than a-z or A-Z as delimiters
in.useDelimiter("[^a-zA-Z]+");
while
(in.hasNext())
{
words.add(in.next().toLowerCase());
}
in.close();
} catch (FileNotFoundException
e)
{
// TODO
Auto-generated catch block
e.printStackTrace();
}
// write to words.dat in binary
format
// open a binary file with
ObjectOutputStream for writing
try
{
// Create an
output stream for file words.data
ObjectOutputStream output = new ObjectOutputStream(new
FileOutputStream("words.dat", true));
// Write
arrayList to the object output stream one string at a time
for (String w :
words)
{
output.writeObject(w);
}
output.close();
} catch (Exception e)
{
e.printStackTrace(); // provide this to see where problem
occurred
System.out.println("Problem encountered writing file"); // provide
this for user
}
}
}
*My CODE*
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.HashMap;
public class HashMapWords {
public static void main(String[] args) throws Exception {
HashMap<String, Integer> map = new HashMap<String,
Integer>();
try (ObjectInputStream datFile = new ObjectInputStream(new
FileInputStream("words.dat"))) {
while (true) {
try {
String key = datFile.readUTF();
if (!map.containsKey(key)) {
map.put(key, 0);
}
map.put(key, map.get(key) + 1);
} catch (Exception ex) {
break;
}
}
}
System.out.println("Word\t\tCount");
for (String key : map.keySet()) {
System.out.println(key + "\t\t" + map.get(key));
}
}
}
*OUTPUT*
Word Count
*HAVING TROUBLE MAKING THIS WORK REALLY NEED SOME HELP, TELL ME WHAT IM DOING WRONG. THANK YOU FOR THE HELP *
In: Computer Science
Part 3
Imagine that the economy is experiencing inflation and that the Reserve Bank of Australia (RBA) decides to implement a contractionary monetary policy or 'tight money' to return inflation to its target level.
a) What type of open market operations (OMOs) will the RBA undertake consistent with a contractionary monetary policy approach?
b) How will the money supply be affected?
c) Explain how the three stages of transmission process from a contractionary monetary policy link a change in interest rates with a change in an economy’s equilbrium level of output.
d) Using the IS-LM curve diagram, illustrate the impact of a contractionary monetary policy. Make sure to clearly indicate the new equilibrium position including the interest rate and output level.
At the end of your answer to Part 3 state the word count for sub-part c. Your answer to Part 3 sub part c should not exceed 100 words. (Note: answers to sub-parts a and b while written should be no longer than 1 sentence each and hence are excluded from the word count requirement).
(0.5 marks for sub-parts a and b, 3 marks for sub-part c, 2 marks for sub-part d plus 0.25 marks for satisfying the word count requirements - Part 3 worth 6.25 marks)
In: Economics
Question 7
The profit figure is an objective measure with some subjective estimates. It has been argued that it does not reflect current value. For example in a period of high inflation, Casi Plc decided to use replacement cost accounting. Closing inventory was purchased for £35 per unit. The general price increases during the period meant the purchase price had increased by 30% by the end of the period.
The Finance manager of Casi Plc is interested in how Positive accounting, Normative accounting, Public interest and Capture theories impact on the accounting theory.
Caspi Plc has implemented IAS 36 impairment of assets. All the assets were reviewed for impairment where appropriate and the impairment loss has been included within the financial statements.
Requirement:
iii) Explain the following in relation to accounting theory.
(maximum word count 160)
iv) Describe what is meant by ‘impairment’ and briefly explain the procedures that must be followed when performing an impairment review. (maximum word count 220)
In: Accounting
in assemby, please share code and output - thanks
1. First clear all your general purpose registers by moving the value “0” into them. Initialize a variable for a BYTE, WORD, DWORD storage size each with any desired value in the data segment. Initialize another variable called Result with the size of a DWORD and make the value as an uninitialized value. In the code segment, create a label called L1 that moves the variables in the appropriate sized register and making sure NOT to overwrite them in the process. After, create another label L2 that adds all these values together and at the end of your program make sure your ECX register contains the final value. Call the DUMPREGS instruction to display your register values and move the final result into the Result variable.
2. Use the following code below as a template and follow the instructions written in the comments ;Assume I have the following data segment written: .data val1 BYTE 10h val2 WORD 8000h val3 DWORD 0FFFFh val4 WORD 7FFFh ;1. Write an instruction that increments val2. ;2. Write an instruction that subtracts val3 from EAX. ;3. Write instructions that subtract val4 from val2. .code ;Write your instructions here
In: Computer Science
In: Computer Science
In: Operations Management