SlideShare a Scribd company logo
1 of 23
Program 1 – CS 344
This assignment asks you to write a bash shell script to compute
statistics. The purpose
is to get you familiar with the Unix shell, shell programming,
Unix utilities, standard
input, output, and error, pipelines, process ids, exit values, and
signals.
What you’re going to submit is your script, called stats.
Overview
NOTE: For this assignment, make sure that you are using Bash
as your shell (on Linux,
/bin/sh is Bash, but on other Unix O/S, it is not). This is
because the Solaris version of
Bourne shell has some annoying bugs that are really brought out
by this script. Bash can
execute any /bin/sh script.
In this assignment you will write a Bourne shell script to
calculate averages and medians
from an input file of numbers. This is the sort of calculation I
might do when figuring
out the grades for this course. The input file will have whole
number values separated by
tabs, and each line of this file will have the same number of
values. (For example, each
row might be the scores of a student on assignments.) Your
script should be able to
calculate the average and median across the rows (like I might
do to calculate an
individual student's course grade) or down the columns (like I
might do to find the
average score on an assignment).
You will probably need commands like these, so please read up
on them: sh, read, expr,
cut, head, tail, wc, and sort.
Your script will be called stats. The general format of the stats
command is
stats {-rows|-cols} [input_file]
Note that when things are in curly braces separated by a vertical
bar, it means you should
choose one of the things; here for example, you must choose
either -rows or -cols. The
option -rows calculates the average and median across the rows;
the option -cols
calculates the average and median down the columns. When
things are in square braces
it means they are optional; you can include them or not, as you
choose. If you specify an
input_file the data is read from that file; otherwise, it is read
from standard input.
Here is a sample run of what your script might return, using an
input file called test_file
(this particular one can be downloaded here , note that in
Windows, the newline
characters may not display as newlines. Move this to your
UNIX account, without
opening and saving it in Windows, and then cat it out: you'll see
the newlines there):
% cat test_file
1 1 1 1 1
9 3 4 5 5
6 7 8 9 7
3 6 8 9 1
3 4 2 1 4
6 4 4 7 7
% stats -rows test_file
Average Median
1 1
5 5
7 7
5 6
3 3
6 6
% cat test_file | stats –c
Averages:
5 4 5 5 4
Medians:
6 4 4 7 5
% echo $?
0
% stats
Usage: stats {-rows|-cols} [file]
% stats -r test_file nya-nya-nya
Usage: stats {-rows|-cols} [file]
% stats -both test_file
Usage: stats {-rows|-cols} [file]
% chmod -r test_file
% stats -columns test_file
stats: cannot read test_file
% stats -columns no_such_file
stats: cannot read no_such_file
% echo $?
1
Specifications
You must check for the right number and format of arguments
to stats. You should allow
users to abbreviate -rows and -cols; any word beginning with a
lowercase r is taken to be
rows and any word beginning with a lowercase c is taken to be
cols. So, for example,
you would get averages and medians across the rows with -r, -
rowwise and
-rumplestiltskin, but not -Rows. If the command has too many
or two few arguments or
if the arguments of the wrong format you should output an error
message to standard
error. You should also output an error message to standard error
if the input file is
specified, but it is not readable.
You should output the statistics to standard output in the format
shown above. Be sure
all error messages are sent to standard error and the statistics
are sent to standard
output. If there is any error, the exit value should be 1; if the
stats program runs
successfully the exit value should be 0.
Your stats program should be able to handle files with any
reasonable number of rows or
columns. You can assume that each row will be less than 1000
bytes long (because Unix
utilities assume that input lines will not be too long), but don't
make any assumptions
about the number of rows. Think about where in your program
the size of the input file
matters. You can assume that all rows will have the same
number of values; you do not
have to do any error checking on this.
You will probably need to use temporary files. For this
assignment, the temporary files
should be put in the current working directory. (A more
standard place for temporary
files is in /tmp but don't do that for this assignment; it makes
grading easier if they are in
the current directory.) Be sure the temporary file uses the
process id as part of its name,
so that there will not be conflicts if the stats program is running
more than once. Be sure
you remove any temporary files when your stats program is
done. You should also use
the trap command to catch interrupt, hangup, and terminate
signals to remove the
temporary files if the stats program is terminated unexpectedly.
All values and results are and must be whole numbers. You may
use the expr command
to do your calculations, or any other bash shell scripting
method, but you may not do the
calculations by dropping into another language, like awk, perl,
python, or any other
language. You may certainly use these other languages for all
other parts of the
assignment. Note that expr only works with whole numbers.
When you calculate the
average you should round to the nearest whole number, where
half values round up (i.e.
7.5 rounds up to 8). This is the most common form of rounding.
You can learn more
about rounding methods here (see Half Round Up):
http://www.mathsisfun.com/numbers/rounding-methods.html
(链接到外部网站。)
To calculate the median, sort the values and take the middle
value. For example, the
median of 97, 90, and 83 is 90. The median of 97, 90, 83, and
54 is still 90 - when there
are an even number of values, choose the larger of the two
middle values.
http://www.mathsisfun.com/numbers/rounding-methods.html
Your script, stats, must be entirely contained in that file. Do not
split this assignment into
multiple files or programs.
To make it easy to see how you're doing, you can download the
actual grading script
here:
p1gradingscript
This script is the very one that will be used to assign your script
a grade. To compare
yours to a perfect solution, you can download here a completely
correct run of my stats
script that shows what you should get if everything is working
correctly:
p1cleantestscript
The p1gradingscript itself is a good resource for seeing how
some of the more complex
shell scripting commands work, too.
Hints
One problem that will be especially challenging is to read in the
values from a specified
file. The read command is exactly what you need (see the man
page for read). However,
read is meant to read from standard input and the input file is
not necessarily standard
input to the stats command. You will have to figure out how to
get read to read from a
file. The man page for sh has the information you need to figure
this out.
Another problem will be calculating the median. There is a
straight forward pipelined
command that will do this, using cut, sort, head, and tail. Maybe
you can figure out
other ways, too. Experiment!
The expr command and the shell can have conflicts over special
characters. If you try
expr 5 * ( 4 + 2 ), the shell will think * is a filename wild card
and the parentheses mean
command grouping.
You have to use backslashes, like this: expr 5 * ( 4 + 2 )
Near the top of your program you're going to want to do a
conditional test: is the
data being passed in as a file, or via stdin? One easy way to
check for this is to examine
the number of parameters used when the script is ran. Once you
know, you can store or
otherwise process the data correctly, and then pass it onto the
calculation parts of your
script. In other words, doing the conditional test first, then
massaging the data in either
form into place in your data structures or temporary files,
allows you to write just one
version of the calculation, instead of two entirely different
blocks of statements!
I HIGHY recommend that you develop this program directly on
the eos-class server.
Doing so will prevent you from having problems transferring
the program back and forth,
which can cause compatibility issues.
If you do see ^M characters all over your files, try this
command:
% dos2unix bustedFile
Grading
142 points are available from successfully passing the grading
script, while the final 18
points will be based on your style, readability, and commenting.
Comment well, often,
and verbosely: we want to see that you are telling us WHY you
are doing things, in
addition to telling us WHAT you are doing.
Program 1 – CS 344OverviewSpecifications HintsGrading
Executive Summary
Apple’s IPhone was the creative baby of Steve Jobs in
Mid-2007. It was the first mobile phone to have capabilities of a
computer, camera, and phone all in one. It quickly gained
popularity and became one of the most well-known phone
brands of all time. Despite rising competition like Samsung,
Motorola, and LG, Apple has developed a revolutionary piece of
technology that is continuing to change the way we think, act,
and live. Going into a new venture with the latest generation of
IPhone, Apple has extended itself to be user-friendly to anyone
despite their race, gender, nationality, or age.
Market Summary
Apple knows its market very well and aims to please its
customers. This information will be used to understand who the
IPhone is targeted to, what their needs are, and how this product
can better serve them in their day to day lives. The IPhone has
no set demographic. It is designed to be used by anyone. The
IPhone provides the mobile technology world a new and
exciting way to interact with your phone and with each other
wirelessly. The company wants to provide the latest technology
and design along with innovative software to bring the most life
like experience on your mobile device. The trend of the market
is constantly evolving as electronics and technology evolve.
IPhone is meeting that evolution head on and breaking barriers
by being a trendsetter instead of a follower. With the want and
need to have the latest technological advancement, the growth
will continuously go up for the product unless so newer form of
communication is developed that can rival the cellular phone.
SWOT Analysis
The SWOT Analysis for Apple both domestic and international
have great strengths because they have a high increase in gained
market shares as demand continues to grow. As one of the
leading companies in the markets, Apple has some of the best
programmers who continue to improve and offer downloadable
software for customers to install and use for free as it is
included in the original purchase price of the IPhone.
Weaknesses
The software updates can be viewed as a weakness as many
consumers do not like mandatory update in order to keep their
phone current. With most of the updates, comes changes to a lot
of the applications and require separate downloadable patches
that fixes bugs caused by the required iso updates. Apple must
be careful as it is easy to infringe on other companies patents
and proprietary applications. Another weakness that needs to be
considered is the lack of updates on software for older model
phones which could cause discontinued devises as not all
customers want to purchase new iPhones on a regular basis.
According to (Scientific America, 2013) “Americans buy new
phones, on average, about every 22 months”.
Opportunities
There are many opportunities for Apple as they continue to
improve models and have raising sales, they continue to gain
market shares by providing better cutting edge products to
consumers and expanding throughout the global market. By
offering a trade in policy that will allow consumers to trade
their current non Apple phone in for a discounted rebate on a
new Apple iPhone purchase will expand sales and capture more
of the market.
Threats
The threats that Apple must be cautious about are ensuring
that their new iPhone is appealing to all demographics of
consumers. The limitations on designs and software cannot be
too confusing to non-technological consumers as there are much
cheaper phones for them to purchase that does not require much
knowledge or skills to operate. Having too much technology on
the devise can be just as damaging to the launching of the new
product just as much as not having enough technology.
Competition
With modern technology advancement and electronic
companies expanding the cell phone competition is fierce.
Consumers want the best possible product for the lowest prices.
There are many options for consumers to choose from when
deciding to purchase or upgrading their cell phone. Besides
Apple, some of the options consumers have to choose from are
Samsung and Motorola.
Product Offering
Many manufactures have the same type of product and
services so it is important for Apple to distinguish themselves
apart from competitors. What sets Apple products apart from the
other cell phone manufacturing companies is that the new
iPhone will offer a 5.5 inch LED-backlit widescreen Multi
Touch display with IPS technology and Retina HD display. The
phone has a 1920-by-1080-pixel resolution at 401 ppm,
Fingerprint-resistant coating on front, support for
Successful Launching
The key to a successful launching of the new iPhone will be
getting consumers educated about the different applications and
latest technology on the iPhone and showing them the
importance of having the ability to do more with their phone
compared to the regular cellphone offered by other companies.
Apple will need to hire teams that will give demonstrations and
allow customers to view, test and see the new iPhone in action
to get the full effect of the importance of owning an Apple
IPhone compared to other leading brands.
Critical Areas of Interest
Some of the critical areas of interest are ensuring all glitches
are worked out on the different applications on the iPhone,
make sure all the software is up to date and there are plenty of
demonstration sites available that covers a wide range of
demographics, targeting all consumers alike. The demonstration
sites will also give consumers the ability to preorder the new
iPhone and fill out surveys. This will allow Apple to get
feedback from customers about what they like and don’t like
about the product which will help the development team make
improvements to future products and upgrades. Also by
allowing preordering, Apple will have statistics as to what the
demographics of their customers are and help the marketing
team determine where they need to focus that will target
potential new customers.
Mission
Bringing the world closer together through our technology with
giving our users the ability to use applications for almost every
task.
Marketing Objectives
Making our products easy to use right out of the box, and
having knowledgeable staff to provide customer service to help
them understand as to how to use the products, and how to add
content and applications to our products. Manufacture the
IPhone to meet the needs of the people, and provide enough
hard drive space to meet everyone’s personal needs.
Financial Objectives
After the current third quarter of 2015, the Apple Company is
looking to improve revenue by an additional 15% for the
following years, and a 3% increase by next quarter though the
sales of the IPhone. The quarter gave 49.6 billion dollars in
revenue as a company with IPhone taking the lead in the amount
of revenue made. We are looking to improve all of our products
to increase overall revenue as well as the market shares.
Positioning
While the IPhone will be marketed even in those of the same
markets as other competitor’s, the ability to make the phones
more user friendly and meet the needs of the customer will help
to set us apart from that of the other companies.
Strategies
The company’s product mix needs to make sure that the
products that the company produces are equal to the demand in
not just the targeted market, but also in regards to the financial
ability of those that live in the communities of using the right
marketing tools by which to offer products within each
communities price ranges as well.
Marketing Program
Pricing is a necessity to be able to get customers to choose the
products over that of the competitors, and coming up with new
ways for a customer to be able to purchase the items with a
payment plan or an incentive, will draw customers in and boost
additional sales. The placement of the products, also need to be
taken into consideration as to not just offer them in the areas by
which the products sell, but also to bring the product to areas to
where the competitor might be taking the market shares of in
possibly drawing customers to buying an IPhone.
Marketing Research
The ability of using information from previous model sales, will
allow for the company to be able to evaluate the company’s
strong and weak points in regards to their sales and their
products. It will also allow for the research of making sure
whether or not a market is strong enough to continue to offer
the products or to create a new product mix in the area. Also,
using information of selected locations of the sales of the
company’s products and that of the competitors, will help in
knowing as to how to improve on design and use and to get an
edge over the competitor.
Financial Analysis
The break-even analysis indicates that $9,623,000 will be
required in quarterly sales revenue to reach the break-even
point.
Break-Even Analysis (Huguet, 2015)
Break-Even Analysis:
Quarterly Units Break-Even
14827
Quarterly Sales Break-Even
$9,623,000
Assumptions:
Average Per-Unit Revenue
$359
Average Per-Unit Variable Cost
$227
Estimated Quarterly Fixed Costs
$3,600,000
Sales Forecast (in billions)
Apple feels that sales will continue to increase with over the
next year with the introduction of the IPhone 7 in 2016. Apple
has continually increased it marketing budget to be more
competitive with Samsung. (Adnan, 2015) Apple is very
conservative with only seeking a 15 percent increase for the
upcoming years.
Table Sales Forecast
Sales Forecast
2015
2016
2017
Sales
207.70
241.15
277.33
Direct Cost of Sales
117.56
123.44
129.61
Gross Income
90.14
117.71
147.72
Marketing Expense Budget
Apple has steadily increased the marketing expense budget to
stay competitive. Apple over the last three years has only
increased the marketing expense budget by 10% each year.
“Apple only spends about 1 percent of total sales on
advertising.” (Ovidijus, 2015) This means Apple’s marketing
strategy yields a greater return without the necessity of
increased spending. (Ovidijus, 2015)
Table Marketing Expense Budget (in Billions)
Marketing
2015
2016
2017
Total Marketing
1.3
1.4
1.5
Controlled Test Marketing of the iPhone
The company with the new product specifies the number of
stores and geographic locations it wants to test (Kotler &
Keller, 2012, pg. 596). Apple, Inc. controls iPhones through
stores and pricing, positioning, and promotions. This action
exposed the iPhones and its features to their smartphones
competitor’s for scrutiny.
The five types of marketing controls used by Apple, Inc.
Types
Responsibility
Purpose
Tactics
I. Yearly
Top and
Middle management
Examine results
Sales
Market projections
Expense
Financials
II. Profits/Losses
Controllers
Examine profits and losses
Profits:
Products
Territories
Customers
III. Efficiency
Controllers and salespersons
Evaluate improvements and spending
Efficiency of:
Sales force
Advertising
Sales promotion
Distribution
IV. Strategy
Top management
And auditors
Examine opportunities within channels
Effectiveness
Audit
Reviews
Ethics
Test Markets
Apple, Inc.
iPhone
Test cities?
Five to ten cities
Which cities?
Small, medium and large cities
Length of test?
Three - twelve months
What information to collect?
Consumers brand loyalty. Surveys attitudes and satisfaction
What action to take?
Launch iPhones globally
Implementation
The effective implementation and control of the iPhone provide
the marketing plan that defines the progress towards the goals
are measured. Managers typically use budgets, schedules, and
marketing metrics for monitoring and evaluating results (Kotler
& Keller, 2012, pg. A-2). The forecasted measurements
concerning the iPhone will be used as a tool for corrections and
control of the implementation process.
Marketing Organization
FUNCTIONAL
Functional specialists report to the marketing vice president.
GEOGRAPHIC
National sales manager, regional sales managers, zone
managers, district sales managers, and salespeople.
PRODUCT
Long-term goals and strategies.
MARKET
Development managers, market and industry specialists.
MATRIX
Provide information to top management
PROS
CONS
Complete organizational leadership throughout Apple, Inc. to
the support the iPhone brand and increase revenue for the
company.
Development of a national strategy.
Contingency Planning
The process of developing such a plan involves convening a
team representing all sectors of the organization, identifying
critical resources and functions and establishing a plan for
recovery based on how long the company can function without
specific functions. The plan must be documented and tested
until it works effectively.
Difficulties and Risks of iPhone
Worst-Case Risks of iPhone
Visibility
Competitors
Financial problems
Problems with iPhones/Recalls
References
Adnan, M. (2015, October 5). Tech Grape Vine. Retrieved from
Iphone 7 Release Date, Features, Price, Rumors, Concepts
Images: http://www.itechwhiz.com/2011/08/apple-iphone-7-
release-date-and-price.htm
Huguet, K. (2015, January 27). Apple Library. Retrieved from
Apple.com: http://www.apple.com/pr/library/2015/01/27Apple-
Reports-Record-First-Quarter-Results.html
Ovidijus, J. (2015, April 18). Strategic Management Insight.
Retrieved from Apple SWOT Analysis 2015:
http://www.strategicmanagementinsight.com/products/swot-
analyses/apple-swot-analysis-2014.html
https://www.apple.com/pr/library/2015/07/21Apple-Reports-
Record-Third-Quarter-Results.html
Kotler, P., & Keller, K. L. (2012). Marketing Management (14th
ed.). Upper Saddle River, NJ: Pearson Prentice Hall.
Scientific America, (August 20, 2013), Should You Upgrade
Your Phone Every Year?—Not Anymore, Scientific
America.com, retrieved from:
http://www.scientificamerican.com/article/should-you-upgrade-
your-phone-every-year-not-anymore/

More Related Content

Similar to Program 1 – CS 344This assignment asks you to write a bash.docx

Compiler_Project_Srikanth_Vanama
Compiler_Project_Srikanth_VanamaCompiler_Project_Srikanth_Vanama
Compiler_Project_Srikanth_VanamaSrikanth Vanama
 
Bioinformatics p4-io v2013-wim_vancriekinge
Bioinformatics p4-io v2013-wim_vancriekingeBioinformatics p4-io v2013-wim_vancriekinge
Bioinformatics p4-io v2013-wim_vancriekingeProf. Wim Van Criekinge
 
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docxCS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docxfaithxdunce63732
 
Comp 122 lab 6 lab report and source code
Comp 122 lab 6 lab report and source codeComp 122 lab 6 lab report and source code
Comp 122 lab 6 lab report and source codepradesigali1
 
"PHP from soup to nuts" -- lab exercises
"PHP from soup to nuts" -- lab exercises"PHP from soup to nuts" -- lab exercises
"PHP from soup to nuts" -- lab exercisesrICh morrow
 
Data Science - Part II - Working with R & R studio
Data Science - Part II -  Working with R & R studioData Science - Part II -  Working with R & R studio
Data Science - Part II - Working with R & R studioDerek Kane
 
C interview-questions-techpreparation
C interview-questions-techpreparationC interview-questions-techpreparation
C interview-questions-techpreparationKushaal Singla
 
cs3157-summer06-lab1
cs3157-summer06-lab1cs3157-summer06-lab1
cs3157-summer06-lab1tutorialsruby
 
cs3157-summer06-lab1
cs3157-summer06-lab1cs3157-summer06-lab1
cs3157-summer06-lab1tutorialsruby
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfrajeshjangid1865
 
(4) cpp automatic arrays_pointers_c-strings_exercises
(4) cpp automatic arrays_pointers_c-strings_exercises(4) cpp automatic arrays_pointers_c-strings_exercises
(4) cpp automatic arrays_pointers_c-strings_exercisesNico Ludwig
 
Reaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdfReaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdffashionbigchennai
 
Python Programming - II. The Basics
Python Programming - II. The BasicsPython Programming - II. The Basics
Python Programming - II. The BasicsRanel Padon
 
Questions4
Questions4Questions4
Questions4hccit
 

Similar to Program 1 – CS 344This assignment asks you to write a bash.docx (20)

Compiler_Project_Srikanth_Vanama
Compiler_Project_Srikanth_VanamaCompiler_Project_Srikanth_Vanama
Compiler_Project_Srikanth_Vanama
 
Computation Chapter 4
Computation Chapter 4Computation Chapter 4
Computation Chapter 4
 
Bioinformatics p4-io v2013-wim_vancriekinge
Bioinformatics p4-io v2013-wim_vancriekingeBioinformatics p4-io v2013-wim_vancriekinge
Bioinformatics p4-io v2013-wim_vancriekinge
 
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docxCS 23001 Computer Science II Data Structures & AbstractionPro.docx
CS 23001 Computer Science II Data Structures & AbstractionPro.docx
 
Comp 122 lab 6 lab report and source code
Comp 122 lab 6 lab report and source codeComp 122 lab 6 lab report and source code
Comp 122 lab 6 lab report and source code
 
"PHP from soup to nuts" -- lab exercises
"PHP from soup to nuts" -- lab exercises"PHP from soup to nuts" -- lab exercises
"PHP from soup to nuts" -- lab exercises
 
Data Science - Part II - Working with R & R studio
Data Science - Part II -  Working with R & R studioData Science - Part II -  Working with R & R studio
Data Science - Part II - Working with R & R studio
 
Bitstuffing
BitstuffingBitstuffing
Bitstuffing
 
GE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_NotesGE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_Notes
 
C interview-questions-techpreparation
C interview-questions-techpreparationC interview-questions-techpreparation
C interview-questions-techpreparation
 
cs3157-summer06-lab1
cs3157-summer06-lab1cs3157-summer06-lab1
cs3157-summer06-lab1
 
cs3157-summer06-lab1
cs3157-summer06-lab1cs3157-summer06-lab1
cs3157-summer06-lab1
 
Bioinformatica 27-10-2011-p4-files
Bioinformatica 27-10-2011-p4-filesBioinformatica 27-10-2011-p4-files
Bioinformatica 27-10-2011-p4-files
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdf
 
(4) cpp automatic arrays_pointers_c-strings_exercises
(4) cpp automatic arrays_pointers_c-strings_exercises(4) cpp automatic arrays_pointers_c-strings_exercises
(4) cpp automatic arrays_pointers_c-strings_exercises
 
Reaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdfReaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdf
 
Python Programming - II. The Basics
Python Programming - II. The BasicsPython Programming - II. The Basics
Python Programming - II. The Basics
 
Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
 
C question
C questionC question
C question
 
Questions4
Questions4Questions4
Questions4
 

More from wkyra78

Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docx
Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docxMelissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docx
Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docxwkyra78
 
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docx
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docxMelissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docx
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docxwkyra78
 
Meiner, S. E., & Yeager, J. J. (2019). Chapter 17Chap.docx
Meiner, S. E., & Yeager, J. J. (2019).    Chapter 17Chap.docxMeiner, S. E., & Yeager, J. J. (2019).    Chapter 17Chap.docx
Meiner, S. E., & Yeager, J. J. (2019). Chapter 17Chap.docxwkyra78
 
member is a security software architect in a cloud service provider .docx
member is a security software architect in a cloud service provider .docxmember is a security software architect in a cloud service provider .docx
member is a security software architect in a cloud service provider .docxwkyra78
 
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docx
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docxMelissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docx
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docxwkyra78
 
Melissa is a 15-year-old high school student. Over the last week.docx
Melissa is a 15-year-old high school student. Over the last week.docxMelissa is a 15-year-old high school student. Over the last week.docx
Melissa is a 15-year-old high school student. Over the last week.docxwkyra78
 
Measurement  of  the  angle  θ          .docx
Measurement  of  the  angle  θ          .docxMeasurement  of  the  angle  θ          .docx
Measurement  of  the  angle  θ          .docxwkyra78
 
Measurement of the angle θ For better understanding .docx
Measurement of the angle θ     For better understanding .docxMeasurement of the angle θ     For better understanding .docx
Measurement of the angle θ For better understanding .docxwkyra78
 
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docx
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docxMeaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docx
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docxwkyra78
 
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docx
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docxMBA6231 - 1.1 - project charter.docxProject Charter Pr.docx
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docxwkyra78
 
Medication Errors Led to Disastrous Outcomes1. Search th.docx
Medication Errors Led to Disastrous Outcomes1. Search th.docxMedication Errors Led to Disastrous Outcomes1. Search th.docx
Medication Errors Led to Disastrous Outcomes1. Search th.docxwkyra78
 
Meet, call, Skype or Zoom with a retired athlete and interview himh.docx
Meet, call, Skype or Zoom with a retired athlete and interview himh.docxMeet, call, Skype or Zoom with a retired athlete and interview himh.docx
Meet, call, Skype or Zoom with a retired athlete and interview himh.docxwkyra78
 
Medication Administration Make a list of the most common med.docx
Medication Administration Make a list of the most common med.docxMedication Administration Make a list of the most common med.docx
Medication Administration Make a list of the most common med.docxwkyra78
 
media portfolio”about chapter 1 to 15 from the book  Ci.docx
media portfolio”about chapter 1 to 15 from the book  Ci.docxmedia portfolio”about chapter 1 to 15 from the book  Ci.docx
media portfolio”about chapter 1 to 15 from the book  Ci.docxwkyra78
 
MediationNameAMUDate.docx
MediationNameAMUDate.docxMediationNameAMUDate.docx
MediationNameAMUDate.docxwkyra78
 
Media coverage influences the publics perception of the crimina.docx
Media coverage influences the publics perception of the crimina.docxMedia coverage influences the publics perception of the crimina.docx
Media coverage influences the publics perception of the crimina.docxwkyra78
 
Media Content AnalysisPurpose Evaluate the quality and value of.docx
Media Content AnalysisPurpose Evaluate the quality and value of.docxMedia Content AnalysisPurpose Evaluate the quality and value of.docx
Media Content AnalysisPurpose Evaluate the quality and value of.docxwkyra78
 
Mayan gods and goddesses are very much a part of this text.  Their i.docx
Mayan gods and goddesses are very much a part of this text.  Their i.docxMayan gods and goddesses are very much a part of this text.  Their i.docx
Mayan gods and goddesses are very much a part of this text.  Their i.docxwkyra78
 
Media and SocietyIn 1,100 words, complete the followingAn.docx
Media and SocietyIn 1,100 words, complete the followingAn.docxMedia and SocietyIn 1,100 words, complete the followingAn.docx
Media and SocietyIn 1,100 words, complete the followingAn.docxwkyra78
 
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docx
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docxMBA 5110 – Business Organization and ManagementMidterm ExamAns.docx
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docxwkyra78
 

More from wkyra78 (20)

Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docx
Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docxMelissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docx
Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docx
 
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docx
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docxMelissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docx
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docx
 
Meiner, S. E., & Yeager, J. J. (2019). Chapter 17Chap.docx
Meiner, S. E., & Yeager, J. J. (2019).    Chapter 17Chap.docxMeiner, S. E., & Yeager, J. J. (2019).    Chapter 17Chap.docx
Meiner, S. E., & Yeager, J. J. (2019). Chapter 17Chap.docx
 
member is a security software architect in a cloud service provider .docx
member is a security software architect in a cloud service provider .docxmember is a security software architect in a cloud service provider .docx
member is a security software architect in a cloud service provider .docx
 
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docx
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docxMelissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docx
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docx
 
Melissa is a 15-year-old high school student. Over the last week.docx
Melissa is a 15-year-old high school student. Over the last week.docxMelissa is a 15-year-old high school student. Over the last week.docx
Melissa is a 15-year-old high school student. Over the last week.docx
 
Measurement  of  the  angle  θ          .docx
Measurement  of  the  angle  θ          .docxMeasurement  of  the  angle  θ          .docx
Measurement  of  the  angle  θ          .docx
 
Measurement of the angle θ For better understanding .docx
Measurement of the angle θ     For better understanding .docxMeasurement of the angle θ     For better understanding .docx
Measurement of the angle θ For better understanding .docx
 
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docx
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docxMeaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docx
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docx
 
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docx
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docxMBA6231 - 1.1 - project charter.docxProject Charter Pr.docx
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docx
 
Medication Errors Led to Disastrous Outcomes1. Search th.docx
Medication Errors Led to Disastrous Outcomes1. Search th.docxMedication Errors Led to Disastrous Outcomes1. Search th.docx
Medication Errors Led to Disastrous Outcomes1. Search th.docx
 
Meet, call, Skype or Zoom with a retired athlete and interview himh.docx
Meet, call, Skype or Zoom with a retired athlete and interview himh.docxMeet, call, Skype or Zoom with a retired athlete and interview himh.docx
Meet, call, Skype or Zoom with a retired athlete and interview himh.docx
 
Medication Administration Make a list of the most common med.docx
Medication Administration Make a list of the most common med.docxMedication Administration Make a list of the most common med.docx
Medication Administration Make a list of the most common med.docx
 
media portfolio”about chapter 1 to 15 from the book  Ci.docx
media portfolio”about chapter 1 to 15 from the book  Ci.docxmedia portfolio”about chapter 1 to 15 from the book  Ci.docx
media portfolio”about chapter 1 to 15 from the book  Ci.docx
 
MediationNameAMUDate.docx
MediationNameAMUDate.docxMediationNameAMUDate.docx
MediationNameAMUDate.docx
 
Media coverage influences the publics perception of the crimina.docx
Media coverage influences the publics perception of the crimina.docxMedia coverage influences the publics perception of the crimina.docx
Media coverage influences the publics perception of the crimina.docx
 
Media Content AnalysisPurpose Evaluate the quality and value of.docx
Media Content AnalysisPurpose Evaluate the quality and value of.docxMedia Content AnalysisPurpose Evaluate the quality and value of.docx
Media Content AnalysisPurpose Evaluate the quality and value of.docx
 
Mayan gods and goddesses are very much a part of this text.  Their i.docx
Mayan gods and goddesses are very much a part of this text.  Their i.docxMayan gods and goddesses are very much a part of this text.  Their i.docx
Mayan gods and goddesses are very much a part of this text.  Their i.docx
 
Media and SocietyIn 1,100 words, complete the followingAn.docx
Media and SocietyIn 1,100 words, complete the followingAn.docxMedia and SocietyIn 1,100 words, complete the followingAn.docx
Media and SocietyIn 1,100 words, complete the followingAn.docx
 
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docx
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docxMBA 5110 – Business Organization and ManagementMidterm ExamAns.docx
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docx
 

Recently uploaded

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 

Recently uploaded (20)

TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 

Program 1 – CS 344This assignment asks you to write a bash.docx

  • 1. Program 1 – CS 344 This assignment asks you to write a bash shell script to compute statistics. The purpose is to get you familiar with the Unix shell, shell programming, Unix utilities, standard input, output, and error, pipelines, process ids, exit values, and signals. What you’re going to submit is your script, called stats. Overview NOTE: For this assignment, make sure that you are using Bash as your shell (on Linux, /bin/sh is Bash, but on other Unix O/S, it is not). This is because the Solaris version of Bourne shell has some annoying bugs that are really brought out by this script. Bash can execute any /bin/sh script. In this assignment you will write a Bourne shell script to calculate averages and medians from an input file of numbers. This is the sort of calculation I might do when figuring
  • 2. out the grades for this course. The input file will have whole number values separated by tabs, and each line of this file will have the same number of values. (For example, each row might be the scores of a student on assignments.) Your script should be able to calculate the average and median across the rows (like I might do to calculate an individual student's course grade) or down the columns (like I might do to find the average score on an assignment). You will probably need commands like these, so please read up on them: sh, read, expr, cut, head, tail, wc, and sort. Your script will be called stats. The general format of the stats command is stats {-rows|-cols} [input_file] Note that when things are in curly braces separated by a vertical bar, it means you should choose one of the things; here for example, you must choose either -rows or -cols. The option -rows calculates the average and median across the rows;
  • 3. the option -cols calculates the average and median down the columns. When things are in square braces it means they are optional; you can include them or not, as you choose. If you specify an input_file the data is read from that file; otherwise, it is read from standard input. Here is a sample run of what your script might return, using an input file called test_file (this particular one can be downloaded here , note that in Windows, the newline characters may not display as newlines. Move this to your UNIX account, without opening and saving it in Windows, and then cat it out: you'll see the newlines there): % cat test_file 1 1 1 1 1 9 3 4 5 5 6 7 8 9 7 3 6 8 9 1 3 4 2 1 4 6 4 4 7 7
  • 4. % stats -rows test_file Average Median 1 1 5 5 7 7 5 6 3 3 6 6 % cat test_file | stats –c Averages: 5 4 5 5 4 Medians: 6 4 4 7 5 % echo $? 0 % stats Usage: stats {-rows|-cols} [file]
  • 5. % stats -r test_file nya-nya-nya Usage: stats {-rows|-cols} [file] % stats -both test_file Usage: stats {-rows|-cols} [file] % chmod -r test_file % stats -columns test_file stats: cannot read test_file % stats -columns no_such_file stats: cannot read no_such_file % echo $? 1 Specifications You must check for the right number and format of arguments to stats. You should allow users to abbreviate -rows and -cols; any word beginning with a lowercase r is taken to be rows and any word beginning with a lowercase c is taken to be cols. So, for example,
  • 6. you would get averages and medians across the rows with -r, - rowwise and -rumplestiltskin, but not -Rows. If the command has too many or two few arguments or if the arguments of the wrong format you should output an error message to standard error. You should also output an error message to standard error if the input file is specified, but it is not readable. You should output the statistics to standard output in the format shown above. Be sure all error messages are sent to standard error and the statistics are sent to standard output. If there is any error, the exit value should be 1; if the stats program runs successfully the exit value should be 0. Your stats program should be able to handle files with any reasonable number of rows or columns. You can assume that each row will be less than 1000 bytes long (because Unix utilities assume that input lines will not be too long), but don't make any assumptions about the number of rows. Think about where in your program the size of the input file
  • 7. matters. You can assume that all rows will have the same number of values; you do not have to do any error checking on this. You will probably need to use temporary files. For this assignment, the temporary files should be put in the current working directory. (A more standard place for temporary files is in /tmp but don't do that for this assignment; it makes grading easier if they are in the current directory.) Be sure the temporary file uses the process id as part of its name, so that there will not be conflicts if the stats program is running more than once. Be sure you remove any temporary files when your stats program is done. You should also use the trap command to catch interrupt, hangup, and terminate signals to remove the temporary files if the stats program is terminated unexpectedly. All values and results are and must be whole numbers. You may use the expr command to do your calculations, or any other bash shell scripting method, but you may not do the
  • 8. calculations by dropping into another language, like awk, perl, python, or any other language. You may certainly use these other languages for all other parts of the assignment. Note that expr only works with whole numbers. When you calculate the average you should round to the nearest whole number, where half values round up (i.e. 7.5 rounds up to 8). This is the most common form of rounding. You can learn more about rounding methods here (see Half Round Up): http://www.mathsisfun.com/numbers/rounding-methods.html (链接到外部网站。) To calculate the median, sort the values and take the middle value. For example, the median of 97, 90, and 83 is 90. The median of 97, 90, 83, and 54 is still 90 - when there are an even number of values, choose the larger of the two middle values. http://www.mathsisfun.com/numbers/rounding-methods.html Your script, stats, must be entirely contained in that file. Do not split this assignment into
  • 9. multiple files or programs. To make it easy to see how you're doing, you can download the actual grading script here: p1gradingscript This script is the very one that will be used to assign your script a grade. To compare yours to a perfect solution, you can download here a completely correct run of my stats script that shows what you should get if everything is working correctly: p1cleantestscript The p1gradingscript itself is a good resource for seeing how some of the more complex shell scripting commands work, too. Hints One problem that will be especially challenging is to read in the values from a specified file. The read command is exactly what you need (see the man page for read). However, read is meant to read from standard input and the input file is not necessarily standard
  • 10. input to the stats command. You will have to figure out how to get read to read from a file. The man page for sh has the information you need to figure this out. Another problem will be calculating the median. There is a straight forward pipelined command that will do this, using cut, sort, head, and tail. Maybe you can figure out other ways, too. Experiment! The expr command and the shell can have conflicts over special characters. If you try expr 5 * ( 4 + 2 ), the shell will think * is a filename wild card and the parentheses mean command grouping. You have to use backslashes, like this: expr 5 * ( 4 + 2 ) Near the top of your program you're going to want to do a conditional test: is the data being passed in as a file, or via stdin? One easy way to check for this is to examine the number of parameters used when the script is ran. Once you know, you can store or otherwise process the data correctly, and then pass it onto the
  • 11. calculation parts of your script. In other words, doing the conditional test first, then massaging the data in either form into place in your data structures or temporary files, allows you to write just one version of the calculation, instead of two entirely different blocks of statements! I HIGHY recommend that you develop this program directly on the eos-class server. Doing so will prevent you from having problems transferring the program back and forth, which can cause compatibility issues. If you do see ^M characters all over your files, try this command: % dos2unix bustedFile Grading 142 points are available from successfully passing the grading script, while the final 18 points will be based on your style, readability, and commenting. Comment well, often, and verbosely: we want to see that you are telling us WHY you are doing things, in addition to telling us WHAT you are doing.
  • 12. Program 1 – CS 344OverviewSpecifications HintsGrading Executive Summary Apple’s IPhone was the creative baby of Steve Jobs in Mid-2007. It was the first mobile phone to have capabilities of a computer, camera, and phone all in one. It quickly gained popularity and became one of the most well-known phone brands of all time. Despite rising competition like Samsung, Motorola, and LG, Apple has developed a revolutionary piece of technology that is continuing to change the way we think, act, and live. Going into a new venture with the latest generation of IPhone, Apple has extended itself to be user-friendly to anyone despite their race, gender, nationality, or age. Market Summary Apple knows its market very well and aims to please its customers. This information will be used to understand who the IPhone is targeted to, what their needs are, and how this product can better serve them in their day to day lives. The IPhone has no set demographic. It is designed to be used by anyone. The IPhone provides the mobile technology world a new and exciting way to interact with your phone and with each other wirelessly. The company wants to provide the latest technology and design along with innovative software to bring the most life like experience on your mobile device. The trend of the market is constantly evolving as electronics and technology evolve.
  • 13. IPhone is meeting that evolution head on and breaking barriers by being a trendsetter instead of a follower. With the want and need to have the latest technological advancement, the growth will continuously go up for the product unless so newer form of communication is developed that can rival the cellular phone. SWOT Analysis The SWOT Analysis for Apple both domestic and international have great strengths because they have a high increase in gained market shares as demand continues to grow. As one of the leading companies in the markets, Apple has some of the best programmers who continue to improve and offer downloadable software for customers to install and use for free as it is included in the original purchase price of the IPhone. Weaknesses The software updates can be viewed as a weakness as many consumers do not like mandatory update in order to keep their phone current. With most of the updates, comes changes to a lot of the applications and require separate downloadable patches that fixes bugs caused by the required iso updates. Apple must be careful as it is easy to infringe on other companies patents and proprietary applications. Another weakness that needs to be considered is the lack of updates on software for older model phones which could cause discontinued devises as not all customers want to purchase new iPhones on a regular basis. According to (Scientific America, 2013) “Americans buy new phones, on average, about every 22 months”. Opportunities There are many opportunities for Apple as they continue to improve models and have raising sales, they continue to gain market shares by providing better cutting edge products to consumers and expanding throughout the global market. By offering a trade in policy that will allow consumers to trade their current non Apple phone in for a discounted rebate on a new Apple iPhone purchase will expand sales and capture more of the market. Threats
  • 14. The threats that Apple must be cautious about are ensuring that their new iPhone is appealing to all demographics of consumers. The limitations on designs and software cannot be too confusing to non-technological consumers as there are much cheaper phones for them to purchase that does not require much knowledge or skills to operate. Having too much technology on the devise can be just as damaging to the launching of the new product just as much as not having enough technology. Competition With modern technology advancement and electronic companies expanding the cell phone competition is fierce. Consumers want the best possible product for the lowest prices. There are many options for consumers to choose from when deciding to purchase or upgrading their cell phone. Besides Apple, some of the options consumers have to choose from are Samsung and Motorola. Product Offering Many manufactures have the same type of product and services so it is important for Apple to distinguish themselves apart from competitors. What sets Apple products apart from the other cell phone manufacturing companies is that the new iPhone will offer a 5.5 inch LED-backlit widescreen Multi Touch display with IPS technology and Retina HD display. The phone has a 1920-by-1080-pixel resolution at 401 ppm, Fingerprint-resistant coating on front, support for Successful Launching The key to a successful launching of the new iPhone will be getting consumers educated about the different applications and latest technology on the iPhone and showing them the importance of having the ability to do more with their phone compared to the regular cellphone offered by other companies. Apple will need to hire teams that will give demonstrations and allow customers to view, test and see the new iPhone in action to get the full effect of the importance of owning an Apple IPhone compared to other leading brands. Critical Areas of Interest
  • 15. Some of the critical areas of interest are ensuring all glitches are worked out on the different applications on the iPhone, make sure all the software is up to date and there are plenty of demonstration sites available that covers a wide range of demographics, targeting all consumers alike. The demonstration sites will also give consumers the ability to preorder the new iPhone and fill out surveys. This will allow Apple to get feedback from customers about what they like and don’t like about the product which will help the development team make improvements to future products and upgrades. Also by allowing preordering, Apple will have statistics as to what the demographics of their customers are and help the marketing team determine where they need to focus that will target potential new customers. Mission Bringing the world closer together through our technology with giving our users the ability to use applications for almost every task. Marketing Objectives Making our products easy to use right out of the box, and having knowledgeable staff to provide customer service to help them understand as to how to use the products, and how to add content and applications to our products. Manufacture the IPhone to meet the needs of the people, and provide enough hard drive space to meet everyone’s personal needs. Financial Objectives After the current third quarter of 2015, the Apple Company is looking to improve revenue by an additional 15% for the following years, and a 3% increase by next quarter though the sales of the IPhone. The quarter gave 49.6 billion dollars in revenue as a company with IPhone taking the lead in the amount of revenue made. We are looking to improve all of our products to increase overall revenue as well as the market shares. Positioning While the IPhone will be marketed even in those of the same markets as other competitor’s, the ability to make the phones
  • 16. more user friendly and meet the needs of the customer will help to set us apart from that of the other companies. Strategies The company’s product mix needs to make sure that the products that the company produces are equal to the demand in not just the targeted market, but also in regards to the financial ability of those that live in the communities of using the right marketing tools by which to offer products within each communities price ranges as well. Marketing Program Pricing is a necessity to be able to get customers to choose the products over that of the competitors, and coming up with new ways for a customer to be able to purchase the items with a payment plan or an incentive, will draw customers in and boost additional sales. The placement of the products, also need to be taken into consideration as to not just offer them in the areas by which the products sell, but also to bring the product to areas to where the competitor might be taking the market shares of in possibly drawing customers to buying an IPhone. Marketing Research The ability of using information from previous model sales, will allow for the company to be able to evaluate the company’s strong and weak points in regards to their sales and their products. It will also allow for the research of making sure whether or not a market is strong enough to continue to offer the products or to create a new product mix in the area. Also, using information of selected locations of the sales of the company’s products and that of the competitors, will help in knowing as to how to improve on design and use and to get an edge over the competitor. Financial Analysis The break-even analysis indicates that $9,623,000 will be required in quarterly sales revenue to reach the break-even point. Break-Even Analysis (Huguet, 2015)
  • 17. Break-Even Analysis: Quarterly Units Break-Even 14827 Quarterly Sales Break-Even $9,623,000 Assumptions: Average Per-Unit Revenue $359 Average Per-Unit Variable Cost $227 Estimated Quarterly Fixed Costs $3,600,000 Sales Forecast (in billions) Apple feels that sales will continue to increase with over the next year with the introduction of the IPhone 7 in 2016. Apple has continually increased it marketing budget to be more competitive with Samsung. (Adnan, 2015) Apple is very conservative with only seeking a 15 percent increase for the upcoming years. Table Sales Forecast Sales Forecast 2015
  • 18. 2016 2017 Sales 207.70 241.15 277.33 Direct Cost of Sales 117.56 123.44 129.61 Gross Income 90.14 117.71 147.72 Marketing Expense Budget Apple has steadily increased the marketing expense budget to stay competitive. Apple over the last three years has only increased the marketing expense budget by 10% each year. “Apple only spends about 1 percent of total sales on advertising.” (Ovidijus, 2015) This means Apple’s marketing strategy yields a greater return without the necessity of increased spending. (Ovidijus, 2015) Table Marketing Expense Budget (in Billions) Marketing
  • 19. 2015 2016 2017 Total Marketing 1.3 1.4 1.5 Controlled Test Marketing of the iPhone The company with the new product specifies the number of stores and geographic locations it wants to test (Kotler & Keller, 2012, pg. 596). Apple, Inc. controls iPhones through stores and pricing, positioning, and promotions. This action exposed the iPhones and its features to their smartphones competitor’s for scrutiny. The five types of marketing controls used by Apple, Inc. Types Responsibility Purpose Tactics I. Yearly Top and Middle management Examine results Sales Market projections Expense Financials II. Profits/Losses Controllers Examine profits and losses Profits:
  • 20. Products Territories Customers III. Efficiency Controllers and salespersons Evaluate improvements and spending Efficiency of: Sales force Advertising Sales promotion Distribution IV. Strategy Top management And auditors Examine opportunities within channels Effectiveness Audit Reviews Ethics Test Markets Apple, Inc. iPhone Test cities? Five to ten cities Which cities? Small, medium and large cities Length of test? Three - twelve months What information to collect? Consumers brand loyalty. Surveys attitudes and satisfaction What action to take?
  • 21. Launch iPhones globally Implementation The effective implementation and control of the iPhone provide the marketing plan that defines the progress towards the goals are measured. Managers typically use budgets, schedules, and marketing metrics for monitoring and evaluating results (Kotler & Keller, 2012, pg. A-2). The forecasted measurements concerning the iPhone will be used as a tool for corrections and control of the implementation process. Marketing Organization FUNCTIONAL Functional specialists report to the marketing vice president. GEOGRAPHIC National sales manager, regional sales managers, zone managers, district sales managers, and salespeople. PRODUCT Long-term goals and strategies. MARKET Development managers, market and industry specialists. MATRIX Provide information to top management PROS CONS Complete organizational leadership throughout Apple, Inc. to the support the iPhone brand and increase revenue for the company. Development of a national strategy. Contingency Planning The process of developing such a plan involves convening a team representing all sectors of the organization, identifying critical resources and functions and establishing a plan for recovery based on how long the company can function without specific functions. The plan must be documented and tested
  • 22. until it works effectively. Difficulties and Risks of iPhone Worst-Case Risks of iPhone Visibility Competitors Financial problems Problems with iPhones/Recalls References Adnan, M. (2015, October 5). Tech Grape Vine. Retrieved from Iphone 7 Release Date, Features, Price, Rumors, Concepts Images: http://www.itechwhiz.com/2011/08/apple-iphone-7- release-date-and-price.htm Huguet, K. (2015, January 27). Apple Library. Retrieved from Apple.com: http://www.apple.com/pr/library/2015/01/27Apple- Reports-Record-First-Quarter-Results.html Ovidijus, J. (2015, April 18). Strategic Management Insight. Retrieved from Apple SWOT Analysis 2015: http://www.strategicmanagementinsight.com/products/swot- analyses/apple-swot-analysis-2014.html https://www.apple.com/pr/library/2015/07/21Apple-Reports- Record-Third-Quarter-Results.html
  • 23. Kotler, P., & Keller, K. L. (2012). Marketing Management (14th ed.). Upper Saddle River, NJ: Pearson Prentice Hall. Scientific America, (August 20, 2013), Should You Upgrade Your Phone Every Year?—Not Anymore, Scientific America.com, retrieved from: http://www.scientificamerican.com/article/should-you-upgrade- your-phone-every-year-not-anymore/