Use JAVA BASICS classes, aggregation and manipulating arrays of objects.
I DO NOT WANT THE SAME SOLUTION WHICH ALREADY EXISTS ON CHEG.
DO NO USE ARRAY LIST
Scenario:
A dog shelter would like a simple system to keep track of all the dogs that pass through the facility.
The system must record for each dog:
dogId (int) - must be unique
name (string)
age (double) - cannot be less than 0 or more than 25
breed (string)
sex (char) – m for male, f for female
foundHome (bool) - true means the dogs has been places in a home false otherwise.
You must create an object oriented solution with a text based menu as summarized on the next page. The system must check that valid data is entered. For example, the menu has four items so only 1 to 5 must be allowed as input from the menu.
Summary of Operations
System Menu:
Overview:
Add Dog:
When a dog is added to the system, you must check that the dogId is not already used in the system. All new dogs have no home as yet (foundHome = false).
View all Dogs:
This menu option shows all dogs in the system. This includes dogs that have a home and those that do not.
View all available dogs:
Shows all dogs in the system, that have no homes as yet.
View dog:
Asks the user for a dogId and then displays the dog information if found and “There is no dog with that id..” if it is not found.
Update dog home status:
Asks the user for a dogId. If a dog with that id is found, the “foundHome” status is changed to true and the dog information is to be displayed. If the dog is not found the message “There is no dog with that id..” should be displayed.
In: Computer Science
Python Programming- 9.11 S80 MT Practice1
#This is a template for practicing mutability and
conversion
#Create and assign the following list of numbers to a list data
type and variable name: 88.5, 90, 75, 70, 85.6
#convert the list to a tuple and assign the tuple a different
variable name
#Ask the user for a grade and convert it to a float type (no
prompt) and assign it to a new variable name
#append the user entered grade to the list
#update the tuple to reflect the user entered grade (Tip, replace
the entire tuple with the list converted to a tuple)
#compute the current average grade using the tuple
#Display the average that you calculated in the previous line using
the following format:
#Your average score is [calculated average]. (Tip: use the +
concatenator and convert the average to a string)
#Ask the user for another grade (no prompt), convert it to an
integer and assign it to a new variable name
#replace the third grade in the list with the most recently entered
grade (Tip, you'll need to use the index)
#remove the second grade from the list (Tip, you'll need to use the
index and the pop method)
#update the tuple to reflect these recent changes to the list (Tip:
replace the entire tuple with the converted list)
#compute the current average grade using the tuple (Tip: divide the
tuple sum by the tuple length)
#Display the latest average that you calculated in the previous
line using the following format:
#Your updated score is: [calculated average]. (Tip: use the +
concatenator and convert the average to a string)
#Display the following statement using the + concatenator using the
latest values for sum, length and average:
#(Tip: make sure all the three variables have been converted to
strings)
#With a total of [sum of tuple] for [length of tuple] assignments
your average score is [tuple average]!
In: Computer Science
For this assignment, you are going to build upon several skills that you've learned:
Set up
Create the assignment in a "week6" folder with the typical files:
This is the standard structure that we'll use in all assignments.
Here is the HTML to use for this assignment. Change the meta author tag to include your name!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Working with Objects and NodeLists</title>
<meta name="description" content="We want to update an HTML page with information from a data object.">
<meta name="author" content="C SCI 212 Student">
<!-- link to external CSS file -->
<link rel="stylesheet" href="css/styles.css?v=1.0">
</head>
<body>
<!-- Content of the page goes here. -->
<h1>Introduction</h1>
<section class="intro">
<h2>Introduction</h2>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
</section>
<section class="student-info">
<h2>Student Information</h2>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
</section>
<!-- link to external JS file -->
<script src="js/scripts.js"></script>
</body>
</html>
The Problem
We have a JavaScript object that contains student information.
We want to update the HTML page with information from the JavaScript object.
Instructions
In: Computer Science
def seq3np1(n):
""" Print the 3n+1 sequence from n, terminating when it reaches 1. args: n (int) starting value for 3n+1 sequence return: None """
while(n != 1):
print(n)
if(n % 2) == 0: # n is even
n = n // 2 else: # n is odd
n = n * 3 + 1
print(n) # the last print is 1
def main():
seq3np1(3)
main()
Using the provided code, alter the function as follows:
First, delete the print statements in the function
Now we will need a local variable to keep track of the count.
It would make sense to call it count.
It will need to be initialized to 0 before we begin the loop.
Once inside the loop, we will need to update count by 1 (increment), so that we can keep track of the number of iterations.
When the loop terminates (we get to 1), return the value of count.
This demonstrates an important pattern of computation called a counter (note that it is a type of accumulator). The variable count is initialized to 0 and then incremented each time the loop body is executed. When the loop exits, count contains the result — the total number of times the loop body was executed.
Since the function now returns a value, we will need to call the function inside of a print statement or save the result in a variable for later printing in order to see the result.
Now that we have a function that can return the number of iterations required to get to 1, we can use it to check a wide range of starting values. In fact, instead of just doing one value at a time, we can call the function iteratively in our main, each time passing in a new value. The algorithm for your main is as follows:
Ask the user for a value to use for the upper bound of your range
You must verify that the value is positive, since your function will not work on negative values. If the value is not positive, you should END the program.
Create a for loop using an iteration variable called start that provides values from 1 up to (and including) the user supplied upper bound.
Call the seq3np1 function once for each value of start.
Write a print statement that prints the value of start and the number of iterations.
Part B
Next we will write a new function (not in the main) that will take an upper bound value and use the turtle graphics library to a line graph the number of iterations, where the x axis is the upper bound and the y axis is the number of iterations. This provides an interesting visual that allows you to see the relative number of iterations for each value. You will need to:
Use a variable to keep track of the maximum number of iterations
Use the turtle library’s Screen command setworldcoordinates
You can use the command to resize the window and make your graph re-scale according to the values you are graphing.
Use a turtle to write out the largest number of iterations required to get to 1 in the sequence so far.
Scanning this list of results causes us to ask the following question: What is the longest sequence? The easiest way to compute this is to keep track of the largest count seen so far. Each time we generate a new count, we check to see if it is larger than what we think is the largest. If it is greater, we update our largest so far and go on to the next count. At the end of the process, the largest seen so far is the largest number of iterations we used to generate a sequence.
We can also use this value to update the y axis of the world coordinate. You can initialize your world coordinates to (0, 0, 10, 10), but then update them each time you get a new x value and new y value that is greater than the current max. You will need to update the graph using setworldcoordinates on every iteration (review the documentation before proceeding):
positive x axis should be the current value of the loop iterator + 10
we are just adding +10 to give a little room so we can see our results more easily
The positive y axis should be the max_so_far value + 10
The negative x and y values should both be 0
In other words, the world coordinates should grow with your graph. Below is the basic algorithm:
The number of iterations (the upper limit) should be a parameter to your function
Create a turtle and a window.
Create an additional turtle object to write out the maximum data
You will have two turtle objects, each completing their own task
Set the world coordinates to (0,0,10,10)
Create a variable call max_so_far and initialize it to zero
place this initialization outside the for loop so that it only happens once
Write a for loop using the number of iterations (the upper limit) that was passed as a parameter
Now, inside the for loop, save the result of the seq3np1 function in a variable called result
Then we can check result to see if it is greater than max_so_far
If so, update max_so_far with the new, greater value
Using your writer turtle, clear the previous text if necessary
Add a label, “Maximum so far: <iteration>, <result>” using the turtles write() command to write the iteration and result in the upper left corner of the screen (you can just use the max_so_far value as the y coordinate for your label)
Set the world coordinates of the screen to the current iteration + 10 and the max_so_far + 10 values.
Make sure you review the turtle’s write() command. It doesn’t work the same as print. You will have to create a single string before writing.
Graph the result with your turtle. Hint: you are graphing on an x,y coordinate plane. You are trying to make a graph of the max number of iterations that the seqn3p1() function runs for. What do you think would make good x and y values for a graph of this data?
In: Computer Science
QUESTION 2
Classique Household Furnishings & Appliances is a family-owned furniture store. You are the management accountant of the concern and have been given the task of preparing the cash budget for the business for the quarter ending September 30, 2018. Your data collection has yielded the following:
i) Extracts from the sales and purchases budgets are as follows:
|
Month |
Cash Sales |
Sales On Account |
Purchases On Account |
|
May |
$50,000 |
$480,000 |
$390,000 |
|
June |
$65,000 |
$600,000 |
$360,000 |
|
July |
$43,400 |
$720,000 |
$450,000 |
|
August |
$52,800 |
$640,000 |
$400,000 |
|
September |
$56,750 |
$800,000 |
$500,000 |
ii) An analysis of the records shows that trade receivables (accounts receivable) for sales on account are settled according to the following credit pattern, in accordance with the credit terms 5/30, n90:
50% in the month of sale
35% in the first month following the sale
15% in the second month following the sale
iii) Accounts payable are settled as follows, in accordance with the credit terms – 4/30, n60:
70% in the month in which the inventory is purchased
30% in the following month
iv) Monthly rental is received from a tenant for storage space rented to him by Classique Household Furnishings & Appliances. The rental is $840,000 per annum and is received quarterly in advance. Rental relating to the quarter under review becomes due on July 1.
v) Computer equipment, which is estimated to cost $350,000, will be acquired for cash in August. The manager has made arrangements with the seller to make a cash deposit of 50% of the amount upon signing of the agreement in August, with the balance to be settled in four equal monthly instalments, starting in September 2018.
vi) An investment instrument purchased by the company with a face value of $480,000 will mature on July 20, 2018 and will be liquidated on that date. At the same time, quarterly interest computed at a rate of 8⅓ % per annum will also be collected.
vii) Fixed operating expenses, which accrue evenly throughout the year, are estimated to be $1,920,000 per annum [including depreciation on non-current assets of $42,000 per month] and are settled monthly.
viii) Wages and salaries are expected to be $2,304,000 per annum and will be paid monthly.
ix) Other operating expenses are expected to be $144,000 per quarter and are settled monthly.
x) In the month of August, furniture & fixtures, which cost $455,000, will be sold to an employee at a loss of $20,000. Accumulated depreciation on the furniture & fixtures at that time is expected to be $305,000. The employee will be allowed to pay a deposit equal to 60% of the selling price in August with the balance settled in two equal amounts in September & October.
xi) As part of its investing activities, the management of Classique Household Furnishings & Appliances is in the process of completing a major addition to the business property which is estimated to cost $1,200,000, and which is being funded by external borrowing. $460,000 of the principal, along with interest of $18,000 is due to be paid on July 15, 2018.
xii) The cash balance on September 30, 2018 is expected to be an overdraft of $264,000.
Required:
(a) The business needs to have a sense of its future cashflows and therefore requires the preparation of the following:
(b) Upon receipt of the budget the team manager has now informed you that all companies in the industry in which Classique Household Furnishings operates are required to maintain a minimum cash balance of $140,000 each month. Based on the budget prepared, will the business be meeting this requirement? The business is already heavily indebted, so management does not wish to borrow any additional funds from outside sources. Suggest four (4) internal strategies that the business may employ in order to improve the organization’s monthly cash flow. Each strategy must be fully explained.
In: Accounting
QUESTION 2
Classique Household Furnishings & Appliances is a family-owned furniture store. You are the management accountant of the concern and have been given the task of preparing the cash budget for the business for the quarter ending September 30, 2018. Your data collection has yielded the following:
i) Extracts from the sales and purchases budgets are as follows:
|
Month |
Cash Sales |
Sales On Account |
Purchases On Account |
|
May |
$50,000 |
$480,000 |
$390,000 |
|
June |
$65,000 |
$600,000 |
$360,000 |
|
July |
$43,400 |
$720,000 |
$450,000 |
|
August |
$52,800 |
$640,000 |
$400,000 |
|
September |
$56,750 |
$800,000 |
$500,000 |
ii) An analysis of the records shows that trade receivables (accounts receivable) for sales on account are settled according to the following credit pattern, in accordance with the credit terms 5/30, n90:
50% in the month of sale
35% in the first month following the sale
15% in the second month following the sale
iii) Accounts payable are settled as follows, in accordance with the credit terms – 4/30, n60:
70% in the month in which the inventory is purchased
30% in the following month
iv) Monthly rental is received from a tenant for storage space rented to him by Classique Household Furnishings & Appliances. The rental is $840,000 per annum and is received quarterly in advance. Rental relating to the quarter under review becomes due on July 1.
v) Computer equipment, which is estimated to cost $350,000, will be acquired for cash in August. The manager has made arrangements with the seller to make a cash deposit of 50% of the amount upon signing of the agreement in August, with the balance to be settled in four equal monthly instalments, starting in September 2018.
vi) An investment instrument purchased by the company with a face value of $480,000 will mature on July 20, 2018 and will be liquidated on that date. At the same time, quarterly interest computed at a rate of 8⅓ % per annum will also be collected.
vii) Fixed operating expenses, which accrue evenly throughout the year, are estimated to be $1,920,000 per annum [including depreciation on non-current assets of $42,000 per month] and are settled monthly.
viii) Wages and salaries are expected to be $2,304,000 per annum and will be paid monthly.
ix) Other operating expenses are expected to be $144,000 per quarter and are settled monthly.
x) In the month of August, furniture & fixtures, which cost $455,000, will be sold to an employee at a loss of $20,000. Accumulated depreciation on the furniture & fixtures at that time is expected to be $305,000. The employee will be allowed to pay a deposit equal to 60% of the selling price in August with the balance settled in two equal amounts in September & October.
Continued.......................................
Question 2 Continued.......................................
xi) As part of its investing activities, the management of Classique Household Furnishings & Appliances is in the process of completing a major addition to the business property which is estimated to cost $1,200,000, and which is being funded by external borrowing. $460,000 of the principal, along with interest of $18,000 is due to be paid on July 15, 2018.
xii) The cash balance on September 30, 2018 is expected to be an overdraft of $264,000.
Required:
(a) The business needs to have a sense of its future cashflows and therefore requires the preparation of the following:
(b) Upon receipt of the budget the team manager has now informed you that all companies in the industry in which Classique Household Furnishings operates are required to maintain a minimum cash balance of $140,000 each month. Based on the budget prepared, will the business be meeting this requirement? The business is already heavily indebted, so management does not wish to borrow any additional funds from outside sources. Suggest four (4) internal strategies that the business may employ in order to improve the organization’s monthly cash flow. Each strategy must be fully explained. (5½ marks)
In: Accounting
Classique Household Furnishings & Appliances is a family-owned furniture store. You are the management accountant of the concern and have been given the task of preparing the cash budget for the business for the quarter ending September 30, 2018. Your data collection has yielded the following:
i) Extracts from the sales and purchases budgets are as follows:
|
Month |
Cash Sales |
Sales On Account |
Purchases On Account |
|
May |
$50,000 |
$480,000 |
$390,000 |
|
June |
$65,000 |
$600,000 |
$360,000 |
|
July |
$43,400 |
$720,000 |
$450,000 |
|
August |
$52,800 |
$640,000 |
$400,000 |
|
September |
$56,750 |
$800,000 |
$500,000 |
ii) An analysis of the records shows that trade receivables (accounts receivable) for sales on account are settled according to the following credit pattern, in accordance with the credit terms 5/30, n90:
50% in the month of sale
35% in the first month following the sale
15% in the second month following the sale
iii) Accounts payable are settled as follows, in accordance with the credit terms – 4/30, n60:
70% in the month in which the inventory is purchased
30% in the following month
iv) Monthly rental is received from a tenant for storage space rented to him by Classique Household Furnishings & Appliances. The rental is $840,000 per annum and is received quarterly in advance. Rental relating to the quarter under review becomes due on July 1.
v) Computer equipment, which is estimated to cost $350,000, will be acquired for cash in August. The manager has made arrangements with the seller to make a cash deposit of 50% of the amount upon signing of the agreement in August, with the balance to be settled in four equal monthly instalments, starting in September 2018.
vi) An investment instrument purchased by the company with a face value of $480,000 will mature on July 20, 2018 and will be liquidated on that date. At the same time, quarterly interest computed at a rate of 8⅓ % per annum will also be collected.
vii) Fixed operating expenses, which accrue evenly throughout the year, are estimated to be $1,920,000 per annum [including depreciation on non-current assets of $42,000 per month] and are settled monthly.
viii) Wages and salaries are expected to be $2,304,000 per annum and will be paid monthly.
ix) Other operating expenses are expected to be $144,000 per quarter and are settled monthly.
x) In the month of August, furniture & fixtures, which cost $455,000, will be sold to an employee at a loss of $20,000. Accumulated depreciation on the furniture & fixtures at that time is expected to be $305,000. The employee will be allowed to pay a deposit equal to 60% of the selling price in August with the balance settled in two equal amounts in September & October.
Continued.......................................
Question 2 Continued.......................................
xi) As part of its investing activities, the management of Classique Household Furnishings & Appliances is in the process of completing a major addition to the business property which is estimated to cost $1,200,000, and which is being funded by external borrowing. $460,000 of the principal, along with interest of $18,000 is due to be paid on July 15, 2018.
xii) The cash balance on September 30, 2018 is expected to be an overdraft of $264,000.
Required:
(a) The business needs to have a sense of its future cashflows and therefore requires the preparation of the following:
(b) Upon receipt of the budget the team manager has now informed you that all companies in the industry in which Classique Household Furnishings operates are required to maintain a minimum cash balance of $140,000 each month. Based on the budget prepared, will the business be meeting this requirement? The business is already heavily indebted, so management does not wish to borrow any additional funds from outside sources. Suggest four (4) internal strategies that the business may employ in order to improve the organization’s monthly cash flow. Each strategy must be fully explained. (5½ marks)
In: Accounting
Theoretical Problem
A government employee can exert effort e ? [0,1] to produce a good. Effort has a cost ce2/2 and is unobservable. The probability that the good is produced is e and each citizen gets ?(?) utility for an arbitrary, given ? if the good is produced but 0 otherwise. One citizen is a monitor who can a cost ?m2/2 to observe whether the good was produced or not, and the monitor can successfully determine whether or not the good was produced with the probability ?. If he is successful, he pays a cost s to share the information with everyone else. If the government employee does not produce the good and the monitor informs everyone else, the government employee gets punished and has to pay ?. The timing of this game goes as follows:
Which type of good is a common-pool resource (a fishing area is an example of a common-pool resource)?
Which type of good is a private good?
Now suppose that p is a function of n and u(n)=10 and p(n)=n. This set-up provides information to suggest that the good is mostly likely:
In: Economics
1. Is the Capital Asset Pricing Model a good description of the way financial markets work during a global crisis? Justify your answer and explain why or why not.
2. Barber and Odean, in their 2002 Journal of Finance paper entitled “Trading Is Hazardous to Your Wealth: The Common Stock Investment Performance of Individual Investors” state that:
“Our most dramatic empirical evidence supports the view that overconfidence leads to excessive trading. On one hand, there is very little difference in the gross performance of households that trade frequently (with monthly turnover in excess of 8.8 percent) and those that trade infrequently. In contrast, households that trade frequently earn a net annualized geometric mean return of 11.4 percent, and those that trade infrequently earn 18.5 percent.” Attempt to explain these findings using the behavioural finance theory.
In: Economics
At Burnt Mesa Pueblo, archaeological studies have used the method of tree-ring dating in an effort to determine when prehistoric people lived in the pueblo. Wood from several excavations gave a mean of (year) 1256 with a standard deviation of 41 years. The distribution of dates was more or less mound-shaped and symmetrical about the mean. Use the empirical rule to estimate the following.
(a) a range of years centered about the mean in which about 68%
of the data (tree-ring dates) will be found
between and A.D.
(b) a range of years centered about the mean in which about 95% of
the data (tree-ring dates) will be found
between and A.D.
(c) a range of years centered about the mean in which almost all
the data (tree-ring dates) will be found
between and A.D.
In: Statistics and Probability