In this lab, using C++, you will create two data structures: a stack and a queue. You will use STL containers to demonstrate basic ADTs.
Queue
For the queue, you will simulate a buffer. Remember it is
first-in-first-out. The user will enter a number for the number of
rounds to run your simulation. You need one function that randomly
generates a number. You will also have a user specified percentage,
and the function uses this percentage to randomly put the generated
number in the buffer. For example, if the user enters 25, then
there is a 25% chance of the randomly generated number been put
into the queue. You will have another user specified percentage,
which is the chance of a value being removed from the buffer. For
example, if the user enters 50, then there is a 50% chance of the
number in the buffer been removed in this round.
You need to record the length of the queue in each round. After
each round of the simulation, calculate and display the average
length of the queue. Equation to calculate the average length would
be: ALi = (ALi-1 * (i-1) + Li ) / i, where ALi and ALi-1 are the
average length in the ith and i-1th round and Li is queue length in
the ith round. Does your buffer behave as expected, i.e. get longer
if the input chance is greater, and get shorter if the removing
chance is greater? Your program needs to handle the situation when
the queue is empty and still try to remove a value. You can start
the simulation with a queue of certain length.
Stack
Use a stack to create a function that creates a palindrome, i.e. a
string that is the same forwards and backwards. It does not need to
be an actual word. The function will receive a string from user
input and it will return the string with the palindrome. For
example, if you enter a string “abc”, your program will return
“abccba”.
Testing program
Create a menu program for the user to test your buffer and to
create a palindrome. For the queue, prompt the user to enter the
two chances and the total number of rounds. Display the results to
the screen in each round. For the stack, prompt them to enter a
string. Create the palindrome and then display it. You can
determine how this menu program should look like as long as it test
the queue and stack properly
What to submit
Code to implement your stack, both header and source files
Code to implement your queue, both header and source files
Code to test the operation of your stack and queue.
In: Computer Science
For each of the hypotheticals, you should prepare an analysis for each situation explaining what business organization form the business should use. You should define and explain key terms and concepts. Your combined responses on the two business situations should be between about 650 to 850 words. Include a word count in your submission.
You should study Chapters 19 & 20 before working on this assignment and rely on specific information from the text to support your analysis. Detailed analysis is required for this assignment.
Business Situation No.1
Joe operates a local gardening and tree trimming business. Joe also does some light landscaping work for a few of his commercial accounts. Joe is very successful and has enough clients to keep him busy, along with at least three workers, working six days a week. Occasionally, a client rents a piece of equipment from Joe’s business. Clients sometime take their time paying for Joe’s services and, therefore, Joe is sometimes late paying his bills.
Joe’s capital is only about $25,000, most of which consists of his new $20,000 truck and his assortment of lawnmowers, chainsaws, edgers, and gardening equipment. Joe’s wife handles the books, yet is not involved in actual business operations. Should Joe continue to operate his gardening and tree trimming business as a sole proprietorship? Explain.
Business Situation No. 2
As a part of a course assignment, a group of graduate students from JSU have developed a prototype for a new microchip to power the next generation of personal computers. The students have received assurances from venture capitalists to provide whatever financing the students will need to manufacture the chip, provided they receive 51% of the equity. The venture capitalists do not want to interfere in the business operations and have agreed to allow the students to control the operations, provided certain financial objective are achieved. The students and the venture capitalists expect to begin manufacturing of the chip within two years. Based on outside evaluations, the chip should be a success. The students/venture capitalists expect to go public within five years.
What type of business entity should be formed by these graduate students to manufacture and develop the chip (and to conduct further research and development)? Consider whether more than one company should be formed. Explain.
In: Finance
In this assignment students will demonstrate their understanding
of the distribution of means doing all steps of hypothesis
testing.
For each problem students will write out all steps of hypothesis
testing including populations, hypotheses, cutoff scores, and all
relevant calculations. Assignments will be typed and uploaded in a
word document to blackboard.
1.A nationwide survey in 1995 revealed that U.S. grade-school children spend an average of µ = 8.4 hours per week doing homework. The distribution is normal with σ = 3.2. Last year, a sample of n = 100 grade-school children was given the same survey. For this sample, the mean number of homework hours was 7.1. Has there been a significant change in the homework habits of grade-school children? Test with α = .05.
2.On the basis of her newly developed technique, a student believes she can reduce the amount of time schizophrenics spend in an institution. As director of training at a nearby institution, you agree to let her try her method on 20 schizophrenics, randomly sampled from your institution. The mean duration that schizophrenics stay at your institution is 85 weeks, with a standard deviation of 15 weeks. The scores are normally distributed. The results of the experiment show that patients treated by the student stay at the institution a mean duration of 78 weeks. What do you conclude about the student’s technique? Use α = .05.
3.A psychologist has developed a standardized test for measuring the vocabulary skills of 4-year-old children. The scores on the test form a normal distribution with μ = 60 and σ = 10. A researcher would like to use this test to investigate the idea that children who grow up with no siblings develop vocabulary skills at a different rate than children in large families. A sample of n = 25 children is obtained, and the mean test score for this sample is 63. On the basis of this sample, can the researcher conclude that vocabulary skills for children with no siblings are significantly different from those of the general population? Test at the .01 level of significance.
4.The average age for licensed drivers in a county is 42.6, with a standard deviation of 12, and the distribution is approximately normal. A county police officer was interested in whether the average age of those receiving speeding tickets is less that the average age of the population who has a license. She obtained a sample of 16 drivers with speeding tickets. The average age for this sample was 34.4. Do all the steps of hypothesis testing using the 0.01 significance level.
In: Statistics and Probability
Tables:
Create table Item( &nbs...
Bookmark
Tables:
Create table Item(
ItemId char(5) constraint itmid_unique primary key,
Decription varchar2(30),
Unitcost number(7,2));
Create table Customer(
custID char(5) constraint cid.unique primary key,
custName varchar2(20),
address varchar2(50));
Create table Orderdata(
orderID char(5) constraint oid_uniq primary key,
orderdate date,
shipdate date,
ItemId char(5) references Item.ItemId,
No_of_items number(4),
Unitcost number(7,2),
Order_total number(7,2),
custID char(5) references customer.custID);
Insert Into Item values(‘A123’,’Pencil’,2.5);
Insert Into Item values(‘B123’,’Pen’,15);
Insert Into Customer(‘C123’,’ABC Gen stores’,’Sanfransico’);
Insert Into Customer(‘C132’,’XYZ stores’,’California’);
Insert into Orderdata(‘o123’,’12-aug-2016’,’12-aug-2016’,’A123’,5,2.5,12.5,’c123’);
Insert into Orderdata(‘o124’,’14-aug-2016’,’14-aug-2016’,’B123’,5,15,75,’c132’);
_____________________________________________________________
Enhance your Module 5 CT database table structures, via your selected RDBMS, as you wish.
, using SQL and an SQL script file, create and execute advanced queries of your choice that demonstrate each of the following:
The use of a GROUP BY clause, with a HAVING clause, and one or more group functions
The use of UNION operator
The use of a subquery
The use of an outer join
Then create and execute at least one SQL UPDATE and at least one SQL DELETE query.
Finally, create and use an SQL view and in a SELECT query.
Submit the following outputs of your SQL script file processing, in this order and appropriately labeled, in a single Word file:
The SQL and results of your INSERT statements to further populate your tables
The SQL and results of your 4 advanced SELECT queries
The SQL and results of your UPDATE and DELETE queries
The SQL and results of your view creation and its use in a SELECT query
You must show all of your SQL as it executed in Management Studio or other development environments. This includes the results returned by your selected RDBMS.
(((((((((((Note)))))))))))))))): you must populate any other tables and show the execution of your SQL statements as required.
Use a SELECT statement using the UNION operator.
create a view and use it in a SELECT query...
In: Computer Science
c++
Create a class named EvolutionTree which will hold a list of species and their expected age, and allow a user to search for a particular species or an age.
EvolutionTree should have private data members:
EvolutionTree should have a default constructor which should initialize the species array to empty strings ("") and initialize the speciesAges array to 0's and the following public methods:
LoadTree should read in a filename where each line is the name of a species and its expected age, separated by a comma. The method should read the file and put the appropriate data into species and speciesAges. LoadTree should return -1 for invalid filenames, and it should return 0 for valid filenames. Each species and species age will only appear once. The last line may or may not end in '\n'.
Few lines from the file to be loaded:
Human,82 Asian elephants,86 Dog,7 Cat,10
SearchForSpecies will search for a particular species' name, and return the index where that name is located. It should return -1 if the name is not found.
GetSpecies will take in an age and return the corresponding species name. It should return an empty string ("") if the age is not found.
You only need to write the class definition and any code that is required for that class. Place all code within the class definition. Our code will create and test your class.
NOTE: We have provided a function that may make the parsing easier:
int split(string s, char sep, string words[], int max_words);
int split(string phrase, char delimer, string result[],
int length)
{
//add one more delimer in the end
phrase += delimer;
//introduce variables
string partHolder = "";
int partCounter = 0;
int phraseLength = phrase.length();
for (int i = 0; i < phraseLength; i++)
{
//if we do not need to split,
if (phrase[i] != delimer)
{
//store result in the correct position
partHolder += phrase[i];
}
else
{
//make postion and holder ready for a new word, store part in
result string, and count a part
if (partCounter < length && partHolder != "") //accounts
for double delimer
{
result[partCounter] = partHolder;
partCounter++;
partHolder = "";
}
}
}
C++
In: Computer Science
Imagine that you are preparing taxes for a local tax service provider. A married couple named Judy and Walter Townson have come to you to seeking assistance with their federal income taxes. During your meeting with the Townsons, you gather the following information: They are both 55 years of age. They have two daughters and one son. One daughter (age 25) is married with children. One daughter (age 20) is living at home and attending college. Their son (age 16) is a junior in high school. They are currently paying for their college-student daughter to attend school full time. Judy is employed as a teacher and makes $60,000 a year. She used $500 of her personal funds to purchase books and other supplies for her classroom. Walter is employed as a CPA and makes $100,000 a year. They provided you a 1099-INT which reported $4,500 in interest of which $500 was savings bond interest. They provided you a 1099-DIV which reported $300 in dividends. They received a state tax refund last year of $385. They provided you a list of expenses including: Doctor’s bills, $800 Prescriptions, $400 New glasses, $2000 Dental bills, $560 Braces, $5000 Property taxes for their two cars of $800, which included $50 in decal fees Real estate taxes of $4500 Mortgage interest of $12,000 Gifts to charities, $1000 GoFundMe contribution to local family in need, $100 Tax Preparation Fees for last year’s taxes, $400 Consider the most beneficial way for Judy and Walter to file their federal income tax return. Prepare a brief written summary that addresses the following: Estimated taxable income for Judy and Walter (please show computations!) Summary of tax return, including any suggestions or tax planning considerations Explain how you determined the filing status, dependents, and use of standard/itemized deduction. Note: The summary should be no more than 500 words and should be uploaded as a Word document with a cover page via the Blackboard assignment tab in Week 5. The specific course learning outcomes associated with this assignment are: Review tax authorities and sources of tax law. Assess the concepts of gross income and strategies to minimize gross income. Examine deductions from income, limitations on those deductions, and strategies for maximizing deductions.
In: Accounting
Solve the follwing Problem.
First create an Accounting Equation Grid. Then, Income statement, Retained Earning statment and Balance Sheet.
On August 1, 2018, Brooke Kline established Western Realty. Brooke completed the following transactions during the month of August.
| A. | Opened a business bank account with a deposit of $22,000 in exchange for common stock. |
| B. | Paid rent on office and equipment for the month, $2,500. |
| C. | Paid automobile expenses (including rental charge) for month, $1,350, and miscellaneous expenses, $500. |
| D. | Purchased office supplies on account, $1,150. |
| E. | Earned sales commissions, receiving cash, $18,000. |
| F. | Paid creditor on account, $650. |
| G. | Paid office salaries, $2,900. |
| H. | Paid dividends, $3,000. |
| I. | Determined that the cost of supplies on hand was $400; therefore, the cost of supplies used was $750. |
| Required: | |
|---|---|
| 1. | Indicate the effect of each transaction and the balances after each transaction, using the tabular headings in the exhibit below. In each transaction row (rows indicated by a letter), you must indicate the math sign (+ or -) in columns affected by the transaction. You will not need to enter math signs in the balance rows (rows indicated by Bal.). Entries of 0 (zero) are not required and will be cleared if entered. |
| Assets | = Liabilities + | Stockholders’ Equity | ||||||||
| Accounts | Common | Sales | Salaries | Rent | Auto | Supplies | Miscellaneous | |||
| Cash | + Supplies | = Payable | + Stock | - Dividends | + Commissions | - Expense | - Expense | - Expense | - Expense | - Expense |
| 2. a. Prepare an income statement for August. If a net loss has been incurred, enter that amount as a negative number using a minus sign. Refer to the list of Labels, Accounts and Amount Descriptions for the exact wording of the answer choices for text entries. Be sure to complete the statement heading. You will not need to enter colons (:) on the income statement. | |
| 2. b. Prepare a retained earnings statement for August. Refer to the list of Labels, Accounts and Amount Descriptions for the exact wording of the answer choices for text entries. Be sure to complete the statement heading. If a net loss is incurred or dividends were paid, enter that amount as a negative number using a minus sign. The word “Less” or “Add” is not needed in the Retained Earnings Statement. If an amount is zero, enter "0". | |
| 2. c. Prepare a balance sheet as of August 31. Refer to the list of Labels, Accounts and Amount Descriptions for the exact wording of the answer choices for text entries. Be sure to complete the statement heading. |
In: Accounting
Lets use Excel to simulate rolling two 8-sided dice and finding the rolled sum.
• Open a new Excel document.
• Click on cell A1, then click on the function icon fx and select Math&Trig, then select RANDBETWEEN.
• In the dialog box, enter 1 for bottom and enter 8 for top.
• After getting the random number in the first cell, click and hold down the mouse button to drag the lower right corner of this first cell, and pull it down the column until 25 cells are highlighted. When you release the mouse button, all 25 random numbers should be present.
• Repeat these four steps for the second column, starting in cell B1.
• Put the rolled sum of two dice in the third column: Highlight the first two cells in the first row and click on AutoSum icon. Once you receive the sum of two values in the third cell, drag the lower right corner of this cell, C1, down to C25. This will copy the formula for all 25 rows. We now have 25 trials of our experiment.
Once these steps are completed, attach a screenshot of your Excel file to your assignment.
(a) Find the theoretical probability that the rolled sum of both dice is 8.
(b) Based on the results of our experiment of 25 trials, obtain the relative frequency approximation to the probability found in (a). You can do so in Excel in two different ways: i) create the histogram of the third column data, then scroll the mouse over the relevant bar - this will give you the frequency with which you can determine the relative frequency; or ii) in a cell, type the function COUNTIF(C1:C25,8)
(c) Generate the frequency distribution histogram of your experiment of 25 trials, and copy it to a Word document. Make sure to add a title to your histogram.
(d) Repeat the simulation for 100 and 1000 trials, and calculate the relative frequency for each, and create the frequency distribution histogram - resize the 3 histograms so that all 3 fit beside each other in a row.
(e) Identify which of the 3 relative frequencies for ’8’ is the closest value to the theoretical probability found in (a). Briefly explain how these experiments demonstrate the Law of Large Numbers.
(f) Identify the shape of the probability distribution (uniform, bell-curved, right-skewed or left-skewed).
In: Math
Assignment:
Create data file consisting of integer, double or String values.
Create unique Java application to read all data from the file echoing the data to standard output. After all data has been read, display how many data were read. For example, if 10 integers were read, the application should display all 10 integers and at the end of the output, print "10 data values were read"
My issue is displaying how many integers were read and how many strings were read.
Here's my code:
/*
* File: ReadDateFile.java
* Author: Mia Robinson
* Date: 10/7/2020
* Purpose: This program will read data from a file
* and will echo the data to standard output
*/
package readdatafile;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
/**
*
* @author mrsar
*/
public class ReadDataFile {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner scannerIn = null;
FileInputStream in = null;
BufferedReader inputStream = null;
// int equivalent of the char
int fileChar;
String fileLine;
int intCount=0; // Initialize integer and word counter
String stringCount =0;
try {
in = new FileInputStream("Read.txt");
System.out.println("Fun with integers");
// Read one char at a time
while ((fileChar = in.read()) != -1) {
int length = String.valueOf(fileChar).length();
intCount += String.valueOf(fileChar).length();
// convert int to char
System.out.print((char) fileChar);
}
// Print the number or string values read to the console
System.out.println("\n\n" + intCount + " data values were read!");
// Separate the file output
System.out.println(" \n");
// Use of Scanner and BufferedReader
inputStream = new BufferedReader(new FileReader("ReadStrings.txt"));
System.out.println("We've reached the end:");
// Read one Line using BufferedReader
while ((fileLine = inputStream.readLine() ) != null) {
System.out.println(fileLine);
}
// Print the number or string values read to the console
System.out.println("\n" + stringCount + " string values were read!");
} catch (IOException io) {
System.out.println("File IO exception" + io.getMessage());
} finally {
// Need another catch for closing
// the streams
try {
// Close the streams
if (in != null) {
in.close();
}
if (inputStream != null) {
inputStream.close();
}
} catch (IOException io) {
System.out.println("Issue closing the Files" +
io.getMessage());
}
}
}
}
In: Computer Science
1) Download the file Assign2.asm. Read it and make sure it can be compiled and executed in Mars.
Assign2.asm
.data
Array: .word 43, -5, 11, 12, 64, -7, 14, 71, 70, 13, -27
string1: .asciiz "Please input the flag: \n"
string2: .asciiz "Sorted Result: \n"
# Tranfer the C code of selection sort to MIPS code. Please do not modify the existing code.
.text
main:
# write your code here to ask the user to input a flag (int number)
la $t0, Array
li $t1, 0
li $t7,11 # array length n=11
mul $t7, $t7, 4 # 4*n, end of inner loop
subi $t8, $t7, 4 # 4*(n-1), end of outer loop
OuterLoop:
add $t2, $t1, 4 # i is in $t1 and j is in $t2
# write your code here for Selection Sort with flag checking
# write your code here to print the sorted result
# exit
addi $v0, $zero, 10
syscall
2) Write code to finish all the tasks listed in Assign2.asm. In Assign2.asm, an array ‘a’of ‘n’=11integers are given at the beginning (make sure do not change these integers):
43, -5, 11, 12, 64, -7, 14, 71, 70, 13, -27
The finished Assign2.asm should be filled with your MIPS code in the specified space to implement the given C code for Selection Sort:
for (int i=0; i<n-1;i++) {
for(int j=j+1; j<n;j++) {
if a[i] > a[j] {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
This above code will generate the sorted result from minimum to maximum.
3) Your code will ask the user to input a flag (int number). If the flag is 1, your code outputs the sorting result from minimum to maximum; otherwise, your code outputs the sorting result from maximum to a minimum.
Here is an example output:
--------------------------------------------
Please input the flag: # user inputs 1
Sorted Result:
-27
-7
-5
11
12
13
14
43
64
70
71
---------------------------------------------
Please input the flag: # user inputs 0
Sorted Result:
71
70
64
43
14
13
12
11
-5
-7
Note: MIIPS code
In: Computer Science