Write My Paper Button

WhatsApp Widget

CSY2002 Operating Systems- Linux Bash Shell Script

$20 Bonus + 25% OFF

Securing Higher Grades Costing Your Pocket?
Book Your Assignment at The Lowest Price
Now!

Students Who Viewed This Also Studied

CSY2002 Operating Systems

Task

This assignment (assignment 2) is worth 50% of the overall marks for the subject.

The following programs should be completed and documented and submitted as a portfolio, with the front sheet supplied filled in. The documentation supplied with each program is explained in the section labeled “How to Document Shell Scripts”, on page 3 of this document.

All the programs should be written in bash ( or similar e.g sh, korn) shell scripting language although it will be acceptable to embed some Python code (this should not exceed 15% of each program).

A brief outline of the 4 programs to write are outlined below :

  1. Write a script to prompt the user for two numbers, representing width and height of a rectangle in cm, and display the area of the rectangle both in square centimetres and in square inches. See page 10 for full brief.
  2. Personalise your bash prompt – this must be inserted into .bashrc or .bash_profile so that it is permanent. All assignments must show this prompt. See page 11 for full brief.
  3. Write a Linux Bash shell script to compute the bonus for a car salesperson. See page 12 for full brief.
  4. Write a shell script the play the card game Blackjack. See page 14 for full brief.

Style

Your shell script should be easy to read. This means that the flow of control should be obvious,  the names of the variables descriptive and the design as simple as possible.

Proper style requires the use of consistent indentation and white space.

You should also ask yourself the following questions:

  • Is your solution well designed?
  • Did you complete one part of the task before starting another?
  • Are your error messages and other output done consistently and are they understandable?
  • Did you give the user sufficient information to readily correct the problem?

Calculating the area of a rectangle

1. Write a script to prompt a user for two numbers, representing width and height of a rectangle and to then calculate and display the value of the area of the rectangle.

a. The user should be prompted to input the data both in square centimetres and in square inches ( 1 inch = 2.54 cm).

b. The user should be prompted to display the area either in square metres and in square inches

c. The user should have the opportunity to either quit the program or input different data.

d. Extra marks will be awarded for well written programs and the use of dialogue boxes where appropriate.

e. Name this script “area.sh”.

Save these practical’s as they will be handed in as part of a portfolio.

Remember to use regular expressions for error checking. i.e when you prompt the user to enter a value you should test to see if it a number in the correct format. The format could be a floating point number (3.142) or an integer (12) – you should test for both.

You will need to use bc found in Topic 5 in the tutorial section, named More Shell Scripting (Tutorial 9). This  deals with floating point mathematics and constructs including  if – then – else loops, which you will need to revise.

When this is submitted as part of a portfolio you will need to include the following:

  • Program code with comments
  • Flowcharts
  • User guide
  • Description of how the code works
  • Evidence of testing
  • Screenshots of outputs – this should show your personalised prompt (this is covered in Topic 15 .

Personalised prompt

Personalise your bash prompt – this must be inserted into .bashrc or .bash_profile so that it is permanent. All assignments must show this prompt.

Bonus Scripting Problem

Write a Linux Bash shell script to compute the bonus for salespersons who are working at Mercedes Benz dealership who sell the following  models:

A class – £24,095 – £38,095 (average £31,095)

B Class – £28,045 – £38,280 (average £33,162)

C Class – £34,670 – £50,405 (average £42,537)

E Class – £39,680 – £69,015 (average £54,437)

AMG C65 – £78,103 – £81,217 (average £31,095)

Each salesperson earns a basic salary of £2,000 per month. However:

  • If he or she achieves £200,000 worth of sales they will earn a bonus of £1,000 per month.
  • If he or she sells more than £300,000 worth of sales they will earn a bonus of £1,500 per month.
  • If he or she sells more than £400,000 worth of sales they will earn a bonus of £2,000 per month.
  • If he or she sells more than £500,000 worth of sales they will earn a bonus of £2,500 per month.
  • If he or she sells more than £650,000 worth of sales they will earn a bonus of £3,000 per month.

Design a program which calculates, each salespersons salary per month.

Calculate the tax each salesperson pays and hence calculate their total salary after tax.

Inputs

  • Enter Month
  • Enter Salespersons name
  • Models he/she sold
  • Save the data
    • File name
    • File path

Outputs

  • How to display results
    • Name order
    • Salary
    • Name with associated net salary

The program should work for between 3 and 20 salespersons.

Sorting

You should employ a bubblesort (no marks will be awarded for the use of the bash sort command) to display a list of the SalesPersons.  All inputs should be checked for valid data.

Tax Rates

Personal allowance- £12,500 – this is the amount you can earn before you start paying tax.

Basic Rate – £12,501 to £50,00 is taxed at 20%

Higher Rate- £50,001 to £150,000 is taxed at 40%

Save this practical as it will be handed in as part of a portfolio.

Remember to use regular expressions for error checking. i.e when you prompt the user to enter a value you should test to see if it a number/s or character/s are in the correct format.

When this is submitted as part of a portfolio you will need to include the following:

  • Program code with comments
  • Flowcharts
  • User guide
  • Description of how the code works – this is the implementation section (it is not a description of program when it is running).
  • Evidence of testing
  • Screenshots of outputs – this should show your personalised prompt (this is covered in Topic 15 .
  • Objectives

Blackjack Program

Write a shell script to play the card game Blackjack. There must be one dealer and at least one player. Name the program blackjack.sh.

This is the final program which will be included in the portfolio.

To get the highest mark the game should be as close as possible to the game described below. You will need to:

  • use arrays and
  • determine how to ensure that a card which is dealt to one user is removed from the pack so that it is not available to other users.
  • make the program user friendly.

Rules of the game

At the start of a blackjack game, the players and the dealer will receive two cards each. The players’ cards are normally dealt face up, while the dealer has one face down (called the hole card) and one face up.

The aim of the game is to accumulate a higher point total than the dealer, but without going over 21. You compute your score by adding the values of your individual cards.

The cards 2 through 10 have their face value, J, Q, and K are worth 10 points each, and the Ace is worth either 1 or 11 points (player’s choice).

The best possible blackjack hand is an opening deal of an ace with any ten-point card. This is called a “blackjack”, or a natural 21, and the player holding this automatically wins unless the dealer also has a blackjack. If a player and the dealer each have a blackjack, the result is a push for that player. If the dealer has a blackjack, all players not holding a blackjack lose.

After the cards have been dealt, the game goes on with each player taking action – in clockwise order starting to dealer’s left.

Each player can keep his hand as it is (stand) or take more cards from the deck (hit), one at a time, until either the player judges that the hand is strong enough to go up against the dealer’s hand and stands, or until it goes over 21, in which case the player immediately loses (busts).

In most places, players can take as many cards as they like, as long as they don’t bust (exceed 21).

When all players have finished their actions, either decided to stand or busted, the dealer turns over his hidden hole card.

If the dealer has a natural 21 (blackjack) with his two cards, he won’t take any more cards. All players lose, except players who also have a blackjack, in which case it is a push – the bet is returned to the player.

If the dealer doesn’t have a natural, he hits (takes more cards) or stands depending on the value of the hand. Contrary to the player, though, the dealer’s action is completely dictated by the rules. The dealer must hit if the value of the hand is lower than 17, otherwise the dealer will stand.

If the dealer goes bust, all players who are left in the game win. Otherwise players with higher point totals than the dealer win, while players with lower totals or equal to that of the dealer lose.

Players with a blackjack win a bet plus a bonus amount, which is normally equal to half their original wager. A blackjack hand beats any other hand, also those with a total value of 21 but with more cards.

As described above, if the dealer has a blackjack, players with blackjack make a push, while all other players lose.

A points system could be used to determine an overall winner of the game.

Definitions

Push is when you and the dealer have the same hand value.  When this happens your bet will be returned.  You don’t win anything and you don’t lose anything.

Busthaving a total over 21, resulting in an automatic loss

Hit – To ask for another card. If that extra card makes the total over 21, then the player busts

Stick or stand – To stop asking for more cards

Five card trick/Charlie – Reaching five cards in one hand without busting; although increasingly uncommon, casinos may offer a 2:1 bonus for achieving it.

Save these practical’s as they will be handed in as part of a portfolio on 24th April 2016.

When this is submitted as part of a portfolio you will need to include the following:

  • Program code with comments
  • Flowcharts
  • User guide
  • Description of how the code works
  • Evidence of testing
  • Screenshots of outputs – this should show your personalised prompt (this is covered in Topic 15 .

CSY2002 Operating Systems

Answer in Detail


Solved by qualified expert

Get Access to This Answer

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

57 More Pages to Come in This Document. Get access to the complete answer.

More CSY2002 CSY2002 Operating Systems: Questions & Answers

Management

Create a list of mobile devices and manufacturers targeted for the application. You should state what mobile devices where used to test the application and what version of Android is supported. …

View Answer

Management

This coursework will allow you to investigate some of the issues involved in writing threaded programs.You are to write a series of simple programs in C/C++ that will run under Linux, to illustrate how multithreading may be used to partition a processing task. Designs should be presented and all cod …

View Answer

Management

Sliding Mode Control with a Lemniscate-Based Sliding Surface …

View Answer

ICTWEB411 Produce Basic Client-side Script for Dynamic Web Pages

Create a user registration page that takes information from the user and provides clear error messages for incorrect input and use regular expressions to accept the correct input. Create the regular expressions to validate the form for:a)The first name and last name input as characters.b)Avalid emai …

View Answer

Content Removal Request

If you are the original writer of this content and no longer wish to have your work published on Myassignmenthelp.com then please raise the
content removal request.

Choose Our Best Expert to Help You

Jane Mac

professor of social science in the University of Southern California.

950 – Completed Orders

Hire Me

Mamie Dunn

Observant Operations & Supply Chain Expert

1411 – Completed Orders

Hire Me

Still in Two Minds? The Proof is in Numbers!

33845 Genuine Reviews With a Rating of 4.9/5.

Assignment

Essay: 1 Page, Deadline:
3 days

Hello, Thanks for the quick delivery. And the job well done. looking forward to do more.

User ID: 5***06 Canada

Management

Essay: 4 Pages, Deadline:
4 days

Thanks for quick delivery. I will go through it and see what you have done. Yet to be graded

User ID: 5***06 Canada

Statistics

Course Work: 7 Pages, Deadline:
1 day

Great work- Job well done!! Work was completed before schedule.I Would highly recommend this service to others.

User ID: 8***59 United States

It Write Up

Assignment: 10 Pages, Deadline:
11 days

thank you a lot for helping me with the assignment and doing this so on time . you did exactly what i wanted you to do. i am very satisfied .

User ID: 8***43 Netherlands

Programing

Programming: 1 Page, Deadline:
10 days

thanks i had a good grade although it took so many back and forth i hope it wont happen again

User ID: 6***09 Philippines

Healthcare

Assignment: 1 Page, Deadline:
9 hours

Thanks for helping me understand my assignment and also helping me with the write up.

User ID: 8***87 United States

Accounting

Programming: 6.4 Pages, Deadline:
6 days

Excellent Service, Professional and Complete Writing. Will sure contact for further future assignments.

User ID: 8***38 Australia

Finance

Home Work: 2 Pages, Deadline:
3 days

Thankfully, I received one of the best marks awarded for the kind of work given. I am grateful to my assignment help team for their assistance

User ID: 2***85 Ghana

Business Law

Home Work: 1 Page, Deadline:
1 hour

Thank you for your service. Really appreciate that you make my assignment within time

User ID: 7***52 Canada

Management

Assignment: 2 Pages, Deadline:
7 days

Thank you Expert, my professor regraded my work and gave me a good grade this time. but he also mention that going forward i should be more detailed i …

User ID: 2***97 Upper Marlboro, United States

Medical

Programming: 4 Pages, Deadline:
4 days

Really thanks to your efforts. excellent work. It’s well written and well organized and well explained as following instructions. Thanks a lot.

User ID: 6***55 Upper Marlboro, Canada

Marketing

Assignment: 3 Pages, Deadline:
4 days

Well I must say I was delighted by the timelines and great work. The assignment was top notch with excellent results. I got a A+!!!!!

User ID: 8***30 Upper Marlboro, United States

Economics

Home Work: 1 Page, Deadline:
2 days

Great performance by expert which got reflected on the result 9/10. Iam totally satisfied by the performance and result.

User ID: 8***42 Upper Marlboro, Bahrain

Management

Assignment: 6 Pages, Deadline:
1 day

The writer did an amazing job I am pleased with it gave the work to me in time I am happy with it will do more works with them

User ID: 3***40 Chennai, Great Britain

Economics

Programming: 10 Pages, Deadline:
16 days

A legend, a legend, dear expert. The work is excellent and distinct. It contains all the important and accurate details. I thank you for the professio …

User ID: 9***3 Chennai, Kuwait

Nursing

Essay: 8 Pages, Deadline:
12 days

Excellent work! I attained HD on the subject and is one of my highest scores. Thank You!!!

User ID: 6***30 Chennai, Australia

Civil Engineering

Programming: 16 Pages, Deadline:
20 days

was able to submit my assignment early. happy with the service provided. Will use this platform often if i need any other assignments done.

User ID: 7***56 Chennai, Singapore

Nursing

Assignment: 4 Pages, Deadline:
30 days

The paper shows a good grasp of some of the basic points made in the literature, weaving together a number of overlapping ideas.

User ID: 7***96 Chennai, United States

Healthcare

Essay: 4 Pages, Deadline:
18 days

I hope in my next coming assignment you can improve more in order to excellent in A . Thank you for your hard work

User ID: 7***47 Chennai, Singapore

Civil Law

Home Work: 4 Pages, Deadline:
5 hours

Thanks a lot for a quality work I like this expert’s writing structure. I always get help from this site. Customer services is also very good.

User ID: 7***54 Blackburn, Great Britain

Assignment

Essay: 1 Page, Deadline:
3 days

Hello, Thanks for the quick delivery. And the job well done. looking forward to do more.

User ID: 5***06 Canada

Management

Essay: 4 Pages, Deadline:
4 days

Thanks for quick delivery. I will go through it and see what you have done. Yet to be graded

User ID: 5***06 Canada

Statistics

Course Work: 7 Pages, Deadline:
1 day

Great work- Job well done!! Work was completed before schedule.I Would highly recommend this service to others.

User ID: 8***59 United States

It Write Up

Assignment: 10 Pages, Deadline:
11 days

thank you a lot for helping me with the assignment and doing this so on time . you did exactly what i wanted you to do. i am very satisfied .

User ID: 8***43 Netherlands

Programing

Programming: 1 Page, Deadline:
10 days

thanks i had a good grade although it took so many back and forth i hope it wont happen again

User ID: 6***09 Philippines

Healthcare

Assignment: 1 Page, Deadline:
9 hours

Thanks for helping me understand my assignment and also helping me with the write up.

User ID: 8***87 United States

Accounting

Programming: 6.4 Pages, Deadline:
6 days

Excellent Service, Professional and Complete Writing. Will sure contact for further future assignments.

User ID: 8***38 Australia

Finance

Home Work: 2 Pages, Deadline:
3 days

Thankfully, I received one of the best marks awarded for the kind of work given. I am grateful to my assignment help team for their assistance

User ID: 2***85 Ghana

Business Law

Home Work: 1 Page, Deadline:
1 hour

Thank you for your service. Really appreciate that you make my assignment within time

User ID: 7***52 Canada

Management

Assignment: 2 Pages, Deadline:
7 days

Thank you Expert, my professor regraded my work and gave me a good grade this time. but he also mention that going forward i should be more detailed i …

User ID: 2***97 Upper Marlboro, United States

Medical

Programming: 4 Pages, Deadline:
4 days

Really thanks to your efforts. excellent work. It’s well written and well organized and well explained as following instructions. Thanks a lot.

User ID: 6***55 Upper Marlboro, Canada

Marketing

Assignment: 3 Pages, Deadline:
4 days

Well I must say I was delighted by the timelines and great work. The assignment was top notch with excellent results. I got a A+!!!!!

User ID: 8***30 Upper Marlboro, United States

Economics

Home Work: 1 Page, Deadline:
2 days

Great performance by expert which got reflected on the result 9/10. Iam totally satisfied by the performance and result.

User ID: 8***42 Upper Marlboro, Bahrain

Management

Assignment: 6 Pages, Deadline:
1 day

The writer did an amazing job I am pleased with it gave the work to me in time I am happy with it will do more works with them

User ID: 3***40 Chennai, Great Britain

Economics

Programming: 10 Pages, Deadline:
16 days

A legend, a legend, dear expert. The work is excellent and distinct. It contains all the important and accurate details. I thank you for the professio …

User ID: 9***3 Chennai, Kuwait

Nursing

Essay: 8 Pages, Deadline:
12 days

Excellent work! I attained HD on the subject and is one of my highest scores. Thank You!!!

User ID: 6***30 Chennai, Australia

Civil Engineering

Programming: 16 Pages, Deadline:
20 days

was able to submit my assignment early. happy with the service provided. Will use this platform often if i need any other assignments done.

User ID: 7***56 Chennai, Singapore

Nursing

Assignment: 4 Pages, Deadline:
30 days

The paper shows a good grasp of some of the basic points made in the literature, weaving together a number of overlapping ideas.

User ID: 7***96 Chennai, United States

Healthcare

Essay: 4 Pages, Deadline:
18 days

I hope in my next coming assignment you can improve more in order to excellent in A . Thank you for your hard work

User ID: 7***47 Chennai, Singapore

Civil Law

Home Work: 4 Pages, Deadline:
5 hours

Thanks a lot for a quality work I like this expert’s writing structure. I always get help from this site. Customer services is also very good.

User ID: 7***54 Blackburn, Great Britain

Have any Query?

The post CSY2002 Operating Systems- Linux Bash Shell Script appeared first on study tools.

Don`t copy text!
WeCreativez WhatsApp Support
Our customer support team is here to answer your questions. Ask us anything!
???? Hi, how can I help?