This is a Java program
Problem Description
Write an application that inputs five digits from the user, assembles the individual digits into a five-digit integer number (the first digit is for one’s place, the second digit is for the ten’s place, etc.) using arithmetic calculations and prints the number. Assume that the user enters enough digits.
Sample Output
Enter five digits: 1 2 3 4 5
The number is 54321
Problem-Solving Tips
Project1_ AssembleDigits_YourName.java
Project1_Answers_YourName.docx.
Follow-Up Questions and Activities
Problem Description
Write an application that inputs five digits from the user, assembles the individual digits into a five-digit integer number (the first digit is for one’s place, the second digit is for the ten’s place, etc.) using arithmetic calculations and prints the number. Assume that the user enters enough digits.
Sample Output
Enter five digits: 1 2 3 4 5
The number is 54321
Problem-Solving Tips
Project1_ AssembleDigits_YourName.java
Project1_Answers_YourName.docx.
Follow-Up Questions and Activities
In: Computer Science
In: Operations Management
```please convert this code to make only using for loop not while loop
#include
#include
#define MAX_SIZE 500
int main()
{
char str[MAX_SIZE];
char tosearch[MAX_SIZE];
char part1[100];
char part2[100];
int cursor = 0, i, cnt1 = 0, cnt2 = 0, cnt = 0;
int j = 0;
int a = 0;
int b = 0;
int total = 0;
printf("Enter any string: ");
gets(str);
printf("Enter word to search occurrences: ");
gets(tosearch);
for (i = 0; i < strlen(tosearch); i++)
{
if (tosearch[i] == '*')
{
for (j = 0; j < i; j++)
{
part1[j] = tosearch[j];
}
a = j;
}
}
for (j = 0; j < strlen(tosearch) - a; j++)
{
part2[j] = tosearch[a + j + 1];
}
for (j = 0; j < a; j++)
{
printf("%c", part1[j]);
}
printf("\n");
for (j = 0; j < strlen(tosearch) - a - 1; j++)
{
printf("%c", part2[j]);
}
printf("\n");
b = strlen(part2);
while (cursor < strlen(str)) { // while the cursor is smaller
than length of main string while loop goes on
while (cnt1 != a) { // if the cnt1 is smaller than the part1
length the while loop goes on
if (str[cursor] == part1[0]) { // if the str[cursor] is correspond
to the first word of part1 go to for loop
for (i = 0; i < a; i++) {
if (str[cursor + i] == part1[i])
{
cnt1++; // count the number of matching letter of part1 and main
string
}
else { // else the cnt1 goes to 0 again and cursor goes
forward
cnt1 = 0;
cursor++;
break;
}
}
}
if (cursor > strlen(str) || cnt1 == a)
{
break;
}
cursor++; // cursor goes to the next letter
}
cursor += a; printf("the value of cursor %d ", cursor);
while (cnt2 != b) { // if cnt2 is less than the length of part2 the while loop goes on
if (str[cursor] == part2[0]) { // if the str[cursor] correspond
with part2[0] for loop goes on
for (i = 0; i < b; i++) {
if (str[cursor + i] == part2[i])
{
cnt2++; // count the matching letter of str and part2
}
else {
cnt2 = 0; // else cnt2 goes to 0 and cursor move on break free from
the for loop
cursor++;
break;
}
}
}
if (cursor > strlen(str) || cnt2 == b) // if the cursor is
larger than the strlen or cnt2 == (the length of part2) break
free
break;
cursor++; // move on to the next letter of the main string
}
if (cursor + b > strlen(str))
break;
cnt++;
cnt1 = 0;
cnt2 = 0;
}
printf("tot %d\n", cnt);
}
In: Computer Science
```please convert this code to make only using for loop not while loop
#include
#include
#define MAX_SIZE 500
int main()
{
char str[MAX_SIZE];
char tosearch[MAX_SIZE];
char part1[100];
char part2[100];
int cursor = 0, i, cnt1 = 0, cnt2 = 0, cnt = 0;
int j = 0;
int a = 0;
int b = 0;
int total = 0;
printf("Enter any string: ");
gets(str);
printf("Enter word to search occurrences: ");
gets(tosearch);
for (i = 0; i < strlen(tosearch); i++)
{
if (tosearch[i] == '*')
{
for (j = 0; j < i; j++)
{
part1[j] = tosearch[j];
}
a = j;
}
}
for (j = 0; j < strlen(tosearch) - a; j++)
{
part2[j] = tosearch[a + j + 1];
}
for (j = 0; j < a; j++)
{
printf("%c", part1[j]);
}
printf("\n");
for (j = 0; j < strlen(tosearch) - a - 1; j++)
{
printf("%c", part2[j]);
}
printf("\n");
b = strlen(part2);
while (cursor < strlen(str)) { // while the cursor is smaller
than length of main string while loop goes on
while (cnt1 != a) { // if the cnt1 is smaller than the part1
length the while loop goes on
if (str[cursor] == part1[0]) { // if the str[cursor] is correspond
to the first word of part1 go to for loop
for (i = 0; i < a; i++) {
if (str[cursor + i] == part1[i])
{
cnt1++; // count the number of matching letter of part1 and main
string
}
else { // else the cnt1 goes to 0 again and cursor goes
forward
cnt1 = 0;
cursor++;
break;
}
}
}
if (cursor > strlen(str) || cnt1 == a)
{
break;
}
cursor++; // cursor goes to the next letter
}
cursor += a; printf("the value of cursor %d ", cursor);
while (cnt2 != b) { // if cnt2 is less than the length of part2 the while loop goes on
if (str[cursor] == part2[0]) { // if the str[cursor] correspond
with part2[0] for loop goes on
for (i = 0; i < b; i++) {
if (str[cursor + i] == part2[i])
{
cnt2++; // count the matching letter of str and part2
}
else {
cnt2 = 0; // else cnt2 goes to 0 and cursor move on break free from
the for loop
cursor++;
break;
}
}
}
if (cursor > strlen(str) || cnt2 == b) // if the cursor is
larger than the strlen or cnt2 == (the length of part2) break
free
break;
cursor++; // move on to the next letter of the main string
}
if (cursor + b > strlen(str))
break;
cnt++;
cnt1 = 0;
cnt2 = 0;
}
printf("tot %d\n", cnt);
}
In: Computer Science
Sensation and perception are critical to survival and are separate events that, from the vantage point of the perceiver, feel like one single process. A sensation is a simple awareness that results from stimulation of a sense organ, whereas perception organizes, identifies, and interprets sensation at the level of the brain in order to form a mental representation. All sensory modalities depend on the process of transduction, which converts physical signals from the environment into neural signals carried by sensory neurons into the central nervous system.
In the 19th century, researchers developed psychophysics, an approach to studying perception that measures the strength of a stimulus and an observer’s sensitivity to that stimulus. These researchers developed procedures for measuring an observer’s absolute threshold, or the smallest intensity needed to just barely detect a stimulus, and the just noticeable difference (JND), or the smallest change in a stimulus that can just barely be detected. Signal detection theory represents a refinement of these basic approaches and allows researchers to distinguish between an observer’s perceptual sensitivity to a stimulus and criteria for making decisions about the stimulus. Sensory adaptation occurs because sensitivity to lengthy stimulation tends to decline over time. This process illustrates that the perceptual system is more sensitive to changes in stimulation than to constant levels of stimulation.
Sensory Adaptation in your life exercise:
■ You will need TWO (2) same size drinking glass, ONE containing a strong solution of water and sugar (4 tablespoons of water and1 1/2 tablespoon of sugar mixture), another ONE containing pure water.
■ First, take a sip of the sugar water and swirl it around in your mouths without swallowing. After a few seconds, the solution should taste less sweet. You can then swallow the concoction or spit it back in the original cup.
■ Next, you should drink from the cup containing fresh water.
After you have completed the exercise, answer the following item.
1. Describe how the freshwater taste in your mouth.
2. Explain how sensory adaption has occurred.
3. Come up with ONE exercise to demonstrate Sensory Adaption. Provide necessary steps to completing the exercise.
*** Provide information from one or more scholarly sources with an in-text citation and match referencing to support your discussion. Wikipedia is not a scholarly source. Discussion without a source will receive zero (0) point.
*** Responses to Discussion Question should be 200 words or more and substantive-this does not include assignment or references. A good practice to produce a response in Word Document to monitor word count, copy and paste into the message area. Please be sure to include proper APA an in-text citation and reference for all information.
In: Psychology
Part I: Between-Groups Design
In the between-groups design, researchers were interested in whether cholesterol levels would differ depending on diet. Twenty participants were randomly assigned to one of two different groups. Group A was assigned a diet rich in fruits and vegetables and with no trans fats. Group B participants were asked to follow their normal diets, which contained varying levels of trans fats depending on the individual. After one month, blood samples were drawn and the following levels of cholesterol were obtained:
|
Participant |
Blood Cholesterol |
Diet |
|
1 |
129 |
Healthy |
|
2 |
98 |
Healthy |
|
3 |
150 |
Healthy |
|
4 |
75 |
Healthy |
|
5 |
135 |
Healthy |
|
6 |
175 |
Healthy |
|
7 |
115 |
Healthy |
|
8 |
103 |
Healthy |
|
9 |
156 |
Healthy |
|
10 |
143 |
Healthy |
|
11 |
239 |
Normal |
|
12 |
500 |
Normal |
|
13 |
350 |
Normal |
|
14 |
468 |
Normal |
|
15 |
198 |
Normal |
|
16 |
213 |
Normal |
|
17 |
225 |
Normal |
|
18 |
175 |
Normal |
|
19 |
560 |
Normal |
|
20 |
289 |
Normal |
In 2 to 3 sentences in a Microsoft Word document, answer the following questions:
Part II: Within-Subjects Design
In the within-subjects design, researchers were interested in whether participants could lower their cholesterol levels by changing from a diet higher in trans fats to one with no trans fats. Ten research participants were selected. A baseline measure of cholesterol was taken from each. They were then put on a diet rich in fruits and vegetables and devoid of trans fats for one month. At the end of that month, blood cholesterol was again measured and the following results were obtained:
|
Participant |
Blood Cholesterol |
Diet |
|
1 |
129 |
Baseline |
|
1 |
98 |
Healthy |
|
2 |
150 |
Baseline |
|
2 |
75 |
Healthy |
|
3 |
175 |
Baseline |
|
3 |
135 |
Healthy |
|
4 |
115 |
Baseline |
|
4 |
103 |
Healthy |
|
5 |
156 |
Baseline |
|
5 |
143 |
Healthy |
|
6 |
500 |
Baseline |
|
6 |
450 |
Healthy |
|
7 |
468 |
Baseline |
|
7 |
350 |
Healthy |
|
8 |
198 |
Baseline |
|
8 |
213 |
Healthy |
|
9 |
225 |
Baseline |
|
9 |
175 |
Healthy |
|
10 |
560 |
Baseline |
|
10 |
481 |
Healthy |
In 2 to 3 sentences in a Microsoft Word document, answer the
following questions:
In: Math
uide to marks: 20 marks – 12 for a, 2 for b, 6 for c
Tully Tyres sells cheap imported tyres. The manager believes its profits are in decline. You have just been hired as an analyst by the manager of Tully Tyres to investigate the expected profit over the next 12 months based on current data.
•Monthly demand varies from 100 to 200 tyres – probabilities
shown in the partial section of the spreadsheet below, but you have
to insert formulas to ge the cumulative probability distribution
which can be used in Excel with the VLOOKUP command.
•The average selling price per tyre follows a discrete uniform
distribution ranging from $160 to $180 each. This means that it can
take on equally likely integer values between $160 and $180 – more
on this below.
•The average profit margin per tyre after covering variable costs
follows a continuous uniform distribution between 20% and 30% of
the selling price.
•Fixed costs per month are $2000.
(a)Using Excel set up a model to simulate the next 12 months to determine the expected average monthly profit for the year. You need to have loaded the Analysis Toolpak Add-In to your version of Excel. You must keep the data separate from the model. The model should show only formulas, no numbers whatsoever except for the month number.
You can use this partial template to guide you:
| Ajax Tyres | |||||||
| DATA | |||||||
| Prob | Cummulative prob | Demand | Selling | Price | $160 | $180 | |
| 0.05 | 100 | Monthly | Fixed cost | $2,000 | |||
| 0.10 | 120 | Profit | Margin | 20% | 30% | ||
| 0.20 | 140 | ||||||
| 0.30 | 160 | ||||||
| 0.25 | 180 | ||||||
| 0.10 | 200 | ||||||
| 1.00 | |||||||
| MODEL | |||||||
| Selling | Profit | Fixed | |||||
| Month | RN1 | Demand | Price | RN2 | Margin | Costs | Profit |
| 1 | 0.23297 | #N/A | $180 | 0.227625 | 0.2 |
The first random number (RN 1) is to simulate monthly demands
for tyres.
•The average selling price follows a discrete uniform distribution
and can be determined by the function =RANDBETWEEN(160,180) in this
case. But of course you will not enter (160,180) but the data cell
references where they are recorded.
•The second random number (RN 2) is used to help simulate the
profit margin.
•The average profit margin follows a continuous uniform
distribution ranging between 20% and 30% and can be determined by
the formula =0.2+(0.3-0.2)*the second random number (RN 2). Again
you do not enter 0.2 and 0.3 but the data cell references where
they are located. Note that if the random number is high, say 1,
then 0.3-0.2 becomes 1 and when added to 0.2 it becomes 0.3. If the
random number is low, say 0, then 0.3-0.2 becomes zero and the
profit margin becomes 0.2.
•Add the 12 monthly profit figures and then find the average
monthly profit.
Show the data and the model in two printouts: (1) the results, and (2) the formulas. Both printouts must show the grid (ie., row and column numbers) and be copied from Excel and pasted into Word. See Spreadsheet Advice in Interact Resources for guidance.
(b)Provide the average monthly profit to Ajax Tyres over the 12-month period.
(c)You present your findings to the manager of Ajax Tyres. He thinks that with market forces he can increase the average selling price by $40 (ie from $200 to $220) without losing sales. However he does suggest that the profit margin would then increase from 22% to 32%.
He has suggested that you examine the effect of these changes and report the results to him. Change the data accordingly in your model to make the changes and paste the output in your Word answer then write a report to the manager explaining your conclusions with respect to his suggestions. Also mention any reservations you might have about the change in selling prices.
The report must be dated, addressed to the Manager and signed
off by you.
(Word limit: No more than 150 words)
In: Statistics and Probability
Monte Carlo Simulation
Tully Tyres sells cheap imported tyres. The manager believes its profits are in decline. You have just been hired as an analyst by the manager of Tully Tyres to investigate the expected profit over the next 12 months based on current data.
•Monthly demand varies from 100 to 200 tyres – probabilities
shown in the partial section of the spreadsheet below, but you have
to insert formulas to ge the cumulative probability distribution
which can be used in Excel with the VLOOKUP command.
•The average selling price per tyre follows a discrete uniform
distribution ranging from $160 to $180 each. This means that it can
take on equally likely integer values between $160 and $180 – more
on this below.
•The average profit margin per tyre after covering variable costs
follows a continuous uniform distribution between 20% and 30% of
the selling price.
•Fixed costs per month are $2000.
(a)Using Excel set up a model to simulate the next 12 months to determine the expected average monthly profit for the year. You need to have loaded the Analysis Toolpak Add-In to your version of Excel. You must keep the data separate from the model. The model should show only formulas, no numbers whatsoever except for the month number.
You can use this partial template to guide you:
| Tully Tyres | |||||||
| Data | |||||||
| Probability | Cumulative probability | Demand | Selling price | $160 | $180 | ||
| 0.05 | 100 | Monthly fixed cost | $2000 | ||||
| 0.1 | 120 | Profit margin | 20% | 30% | |||
| 0.2 | 140 | ||||||
| 0.3 | 160 | ||||||
| 0.25 | 180 | ||||||
| 0.1 | 200 | ||||||
| 1 | |||||||
| Model | |||||||
| Month | Random number1 | Demand | Selling price | Random number 2 | Profit margin | Fixed cost | Profit |
| 1 | 0.23297 | #N/A | $180 | 0.227625 | 0.2 | ||
The first random number (RN 1) is to simulate monthly demands
for tyres.
•The average selling price follows a discrete uniform distribution
and can be determined by the function =RANDBETWEEN(160,180) in this
case. But of course you will not enter (160,180) but the data cell
references where they are recorded.
•The second random number (RN 2) is used to help simulate the
profit margin.
•The average profit margin follows a continuous uniform
distribution ranging between 20% and 30% and can be determined by
the formula =0.2+(0.3-0.2)*the second random number (RN 2). Again
you do not enter 0.2 and 0.3 but the data cell references where
they are located. Note that if the random number is high, say 1,
then 0.3-0.2 becomes 1 and when added to 0.2 it becomes 0.3. If the
random number is low, say 0, then 0.3-0.2 becomes zero and the
profit margin becomes 0.2.
•Add the 12 monthly profit figures and then find the average
monthly profit.
Show the data and the model in two printouts: (1) the results, and (2) the formulas. Both printouts must show the grid (ie., row and column numbers) and be copied from Excel and pasted into Word. See Spreadsheet Advice in Interact Resources for guidance.
(b)Provide the average monthly profit to Tully Tyres over the 12-month period.
(c)You present your findings to the manager of Ajax Tyres. He thinks that with market forces he can increase the average selling price by $40 (ie from $200 to $220) without losing sales. However he does suggest that the profit margin would then increase from 22% to 32%.
He has suggested that you examine the effect of these changes and report the results to him. Change the data accordingly in your model to make the changes and paste the output in your Word answer then write a report to the manager explaining your conclusions with respect to his suggestions. Also mention any reservations you might have about the change in selling prices.
The report must be dated, addressed to the Manager and signed
off by you.
(Word limit: No more than 150 words)
In: Math
Directions of assignment:
- Create an array of words of size 10.
- Prompt the User to enter the 10 integers. Populate the array with the integers as they are entered.
- You MUST use indexed addressing to traverse through the array.
- Determine the maximum and the minimum values contained within the array and print them out.
Can you see what I am doing wrong here, the last part (to find the min and max) I can't seem to get right. Can you point me in the right direction. we need to use MIPS ASSEMBLY language, here is my code.
.text
.globl main
main:
li $t0,
0
# initilize array index value to 0
li $t1,
10
# size of array is 10 (0 - 9)
li $t3,
0
# initialize counter to zero
#Populate the array
while:
la $a0,
intPrompt
# prompt for integer
li
$v0,4
# a0 = address of string
syscall
# v0 = 4, indicates display a String
li
$v0,5
# enter input -> v0
syscall
# 5 is sys call for read int
move $t2,
$v0
# store word int to a[i]
sw $t2, array($t0)
add
$t0,$t0,4
# move pointer ahead to next array element
add
$t3,$t3,1
# increment counter
blt
$t3,$t1,while
# branch to while if counter < size of array
# End While to populate the array
wend:
la
$a0,title
# Display "Array: "
li
$v0,4
# a0 = address of message
syscall
# Loop to print array values
li $t0,
0
# initilize array index value back to 0
li $t3,
0
# initilize size counter back to
zero
startPrint:
lw
$t2,array($t0)
# load word a[i] into temp (t2)
move $a0,
$t2
# move a[i] to a0 for display
li
$v0,1
# display a[i]
syscall
la
$a0,comma
# Display ", "
li
$v0,4
# a0 = address of message
syscall
# v0 = 4 which indicates display a
string
add
$t0,$t0,4
# move pointer ahead to next array element
add $t3, $t3,
1
# increment counter
blt
$t3,$t1,startPrint
# branch to startPrint if counter < size of array
endPrint:
# End loop to print array
values
la
$a0,crlf
# Display "cr/lf"
li
$v0,4
# a0 = address of message
syscall
# v0 = 4 which indicates display a
string
# min and max loop
li $t0,
0
# initilize array index value back to 0
li $t3,
0
# initilize size counter back to
zero
sw
$t5,array($t0)
# t5 = min = a[0] (init)
sw
$t6,array($t0)
# t6 = max = a[0] (init)
newLoop:
lw
$t2,array($t0)
# loads into t2 the first input
bge $t5,$t2,
notMin
# if t5 >= t2 goto notMin
move $t5,
$t2
# move t2 to t5 if false
j
notMax
# jump to notMax
notMin: ble
$t6,$t2,notMax # if t6
<= t2 goto notMax
move
$t6,$t2
# move t2 to t6
notMax: add
$t0,$t0,4
# move pointer ahead to next array element
add $t3, $t3,
1
# increment counter
bnez $t0,newLoop
la
$a0,p1
# Display "The minimum number is "
li
$v0,4
# a0 = address of message
syscall
# v0 = 4 which indicates display a string
move
$a0,$t2
# Display the minimum number
li $v0,1
syscall
la
$a0,p2
# Display "The maximum number is "
li
$v0,4
# a0 = address of message
syscall
# v0 = 4 which indicates display a string
move
$a0,$t3
# Display the maximum number
li $v0,1
syscall
li
$v0,10
# End Of Program
syscall
.data
p1:
.asciiz "The minimum number is "
p2:
.asciiz "\nThe maximum number is "
intPrompt: .asciiz "Enter an Integer: " #
hold the prompt message for each int in the array
title: .asciiz "\nArray:
"
crlf: .asciiz
"\n"
comma: .asciiz ", "
array: .word 40 # 10 words
In: Computer Science
AugRealElectronics is a midsized electronics manufacturer. The company president is Shelly Couts, who inherited the company. The company originally repaired radios and other household appliances when it was founded over 70 years ago. Over the years, the company has expanded, and it is now a reputable manufacturer of various specialty electronic items. You, a recent business school graduate, have been hired by the company in its finance department.
One of the major revenue-producing items manufactured by AugReal is a smart phone. AugReal currently has one smart phone model on the market and sales have been excellent. The smart phone is a unique item in that it comes in a variety of tropical colors and is preprogrammed to play Jimmy Buffett music. However, as with any electronic item, technology changes rapidly, and the current smart phone has limited features in comparison with newer models. AugReal spent $750,000 to develop a prototype for a new smart phone that has all the features of the existing one but adds new features such as Pokémonluring and capturing. The company has spent a further $200,000 for a marketing study to determine the expected sales figures for the new smart phone.
AugReal can manufacture the new smart phone for $205 each in variable costs. Fixed costs for the operation are estimated to run $5.1 million per year. The estimated sales volume is 64,000, 106,000, 87,000, 78,000, and 54,000 per year for the next five years, respectively, and no sales after the fifth year. The unit price of the new smart phone will be $485. The necessary equipment can be purchased for $34.5 million and will be depreciated on a seven-year MACRS schedule (see Table 6.3, p. 175). It is believed the value of the equipment in five years will be $5.5 million.
Net working capital for the smart phones will be 20 percent of sales and will occur with the timing of the cash flows for the year (i.e., there is no initial outlay for NWC). Changes in NWC will thus first occur in Year 1 with the first year's sales. AugReal has a 35 percent corporate tax rate and a required return of 12 percent.
Shelly has asked you to prepare a report that answers the following questions:
QUESTIONS
REPORT STYLE
Remember that your boss is a smart business person, but she is not a financial analyst like you. You should lead her through the logic of your analysis to your conclusions. Be sure your report is accurate and professional: your job (grade) is on the line!
The report should be single-spaced within paragraphs and double spaced between paragraphs. Use headings for major sections. Include page numbers. Use Times 12-point font. Pay attention to grammar and writing style. Write your report in third person, active voice. Include Excel Worksheet Objects as tables in the body of your report that show the numbers involved in your analysis. Include a memo to your boss as the cover/transmittal page. The memo should present your primary conclusions in a bullet list.
Your submission should be a single Word document (maximum of 6 pages) uploaded into Canvas. I will use the attached rubric in the grading process. “Paste object” to put your cash flows from Excel into your Word file. This allows me to simply click on your tables to see the match behind your calculations. DO NOT USE EXCEL LIKE A TYPEWRITER. That is, let Excel do the calculations. Don’t do the calculations with pen and paper or a calculator and then simply type in the numbers into an Excel sheet. I want to see that you can use Excel for this assignment and that you understand the concept of pasting an object rather than a picture from Excel to Word. Failure to use Excel in the manner described will result in a significant grade penalty (50%?) even if your numbers are technically correct.
In: Accounting