Course Project for Introduction to Linux and Shell Scripting (DSE 4313) at the Manipal Institute of Technology, Manipal, India

Problem Statement

Jack Nash wishes to create the Power calculator interface in Linux. He must implement a shell script to perform the following tasks

Task 1: Alpha Power

  1. Create a shell script that begins with a banner "Unleash the Power Calculator" displayed and a menu with the options:
    • Alpha Power (AP):
      • Accept a word and number from the user. Ensure the entered word is between the range of 7 to 9 characters.
      • Choose middle letter and display the word with middle letter as many times as number indicates. (Hint: abcdefg, 3-> abcdddefg)
      • Store in file Alpha.txt with fields word, number, and modified word for every try.
    • Expo Power (EP): Read Task 2
    • Exit (9): Check if user wishes to terminate or continue.

Task 2: Expo Power Time

  1. The script must prompt "Enter the base number:" (base). Only positive integers allowed with a range between 2 and 6.
  2. Next prompt "Enter exponent:". (expo). Both positive and negative exponents allowed.
  3. Next prompt "What's your guess for (base) to the power of (expo)?". Accept the guess.
  4. Calculate the base (expo) and compare if guessed value and calculated value are the same. If found same, message "Congratulations, you are power player!" otherwise, the game terminates with appropriate message "Game Over, you lose, low on power, time to recharge!" and terminate.
  5. Store valid data in a text file LiPowerFile.txt before terminating or choosing another option.

Note: LiPowerFile.txt must contain the following fields serial_no, basenumber, exponent, guess, matches. Each try must be recorded.