Question

NEW YORK CITY COLLEGE OF TECHNOLOGY THE CITY UNIVERSITY OF NEW YORK Department of Computer Engineering Technology 300 Jay Str
using linux terminal
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Script is as follows:

************************************************************************************************************************************

#!/bin/sh

#getScore Function
getScore(){
   printf "\nEnter a score : " #prompt for score
   read score #read the score
   while [ $score -lt 0 ] || [ $score -gt 100 ] #while score is less than 0 or greater than 100
   do
       echo "Score should be between 0 and 100 only" #show the message
       printf "Enter a score:" #ask score again
       read score #read score upto which the condition is unsatisfied
   done
}


#display grade Functions
displayGrade(){
   printf "Enter the course name : " #prompt for course name
   read course #read the course name
   #case statements for grade check and print  
   case $score in
       100) echo "Your grade for $course is A" ;;
       9[3-9]) echo "Your grade for $course is A" ;;
       9[0-2]) echo "Your grade for $course is A-" ;;
       8[7-9]) echo "Your grade for $course is B+" ;;
       8[3-6]) echo "Your grade for $course is B" ;;
       8[0-2]) echo "Your grade for $course is B-" ;;
       7[7-9]) echo "Your grade for $course is C+" ;;
       7[0-6]) echo "Your grade for $course is C" ;;
       6[0-9]) echo "Your grade for $course is D" ;;
       *) echo "Your grade for $course is F" ;;
   esac
  
}


course="EMT2390L" #course variable assigned to EMT2390L
declare -i score #declare a score varible
declare -i numGrades #declare numGrades variable
printf "\nEnter the number of grades to process : " #prompt for umber of grades to process
read numGrades #get the number of grades
for i in $(seq 1 $numGrades); #for loop for number of grades
do
   getScore #call getscore
   displayGrade   #call displayGrade
done
printf "\n"

************************************************************************************************************************************

Screenshot of the code:

Activities Text Editor Thu 20:20 A wer.sh -/Desktop Save 3 - 0 Open - #!/bin/sh X #getScore Function getScore({ printf \nEnt

Output:

aakash@aakash-HP-Notebook :-/Desktop bash wer.sh Enter the number of grades to process : 5 Enter a score : 95 Enter the cours

Add a comment
Know the answer?
Add Answer to:
using linux terminal NEW YORK CITY COLLEGE OF TECHNOLOGY THE CITY UNIVERSITY OF NEW YORK Department...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using Javascript, I have two radio buttons, depending on the value of the radio button 1...

    Using Javascript, I have two radio buttons, depending on the value of the radio button 1 or 2, you will send a different form to the user. So, if radio button is value "1" send new form1 or if value "2" send new form 2.  New form will ask for letter grades for four courses in textboxes. Onsubmit of new form letter grades A,B,C,D need to be changed to numeric values 1,2,3,4 so an average grade for the four couses can...

  • MEDGAR EVERS COLLEGE OF THE CITY UNIVERSITY OF NEW YORK Department of Chemistry and Environmental Science...

    MEDGAR EVERS COLLEGE OF THE CITY UNIVERSITY OF NEW YORK Department of Chemistry and Environmental Science CHM 201-002 Exam 2 B November 7, 2019 Dr. Harini Patel Names actuacks Section A: (Circle or bubble the correct answer with PEN) 1 Which solution of a base contains the smallest number of moles of a base? a) 5.0 L of 4.0 M b ) 0.50 L of 4.0 M €) 4.0 L of 0.40 M d) 0.50 L of 0.40 M What...

  • this code is not working for me.. if enter 100 it is not showing the grades...

    this code is not working for me.. if enter 100 it is not showing the grades insted asking for score again.. #Python program that prompts user to enter the valuesof grddes . Then calculate the total scores , #then find average of total score. Then find the letter grade of the average score. Display the #results on python console. #grades.py def main(): #declare a list to store grade values grades=[] repeat=True #Set variables to zero total=0 counter=0 average=0 gradeLetter='' #Repeat...

  • MEDGAR EVERS COLLEGE he City University of New York Basic Physics PHY 114 - W-01 Department...

    MEDGAR EVERS COLLEGE he City University of New York Basic Physics PHY 114 - W-01 Department of Physical and Computer Sciences Medgar Evers College Assignment 2 Name: Write or type work and solutions on a separate paper. If written, write legibly. 1. Find the magnitude and direction (polar coordinates) of the difference vector 20 m due east and B 10 m due north. 2. Find the vector components (rectangular coordinates) of 2A +v3B where 3. Use the graphical tail-to-head technique...

  • Assume the following declarations have been made in main(): int howmany; Scanner kb = new Scanner(System.in);...

    Assume the following declarations have been made in main(): int howmany; Scanner kb = new Scanner(System.in); Random r = new Random(); Write code to do the following: Use a while loop to prompt the user for how many numbers are to be entered. If the user does not enter a positive number (a number greater than 0), display a message saying the number must be positive and to try again. Store this value in the howmany variable. Declare an integer...

  • Jubail University College Computer Science & Engineering Department Assessmen Assignment Course Code CS120/C5101 t Type: 1...

    Jubail University College Computer Science & Engineering Department Assessmen Assignment Course Code CS120/C5101 t Type: 1 Semester: 403 Course Title Programming Submission 27-06-2020 Total Points 8 Date Submission Instructions: • This is an individual assignment. • Please submit your program (Java fle) in Blackboard. You can create one java project, named as Assignment1_id and add separate java file for each question. You can name your javá files as 01.02.... etc. • Make sure that you include your student ID name...

  • i would like help to write a program to run the following application in visual studio C++, CLR empty project Borough of Manhatan Community College The City University of New York SCIENCE DEPA...

    i would like help to write a program to run the following application in visual studio C++, CLR empty project Borough of Manhatan Community College The City University of New York SCIENCE DEPARTMENT Laboratory Experiment ACCELERATION DUE TO GRAVITY USING A SIMPLE PENDULUM To calculate the value of the acceleration due to gravity by measuring the period of a pendulum with four different lengths. Apparatus Drilled steel ball, string, clamp, support to hold pendulum apparatus, meter stick, and timer Theory:...

  • C++ Programming

    PROGRAM DESCRIPTIONIn this project, you have to write a C++ program to keep track of grades of students using structures and files.You are provided a data file named student.dat. Open the file to view it. Keep a backup of this file all the time since you will be editing this file in the program and may lose the content.The file has multiple rows—each row represents a student. The data items are in order: last name, first name including any middle...

  • Declare and initialize 4 Constants for the course category weights: The weight of Homework will be...

    Declare and initialize 4 Constants for the course category weights: The weight of Homework will be 15% The weight of Tests will be 35% The weight of the Mid term will be 20% The weight of the Fin al will be 30% Remember to name your Constants according to Java standards. Declare a variable to store the input for the number of homework scores and use a Scanner method to read the value from the Console. Declare two variables: one...

  • GPA calculator: Assume the user has a bunch of courses they took, and need to calculate...

    GPA calculator: Assume the user has a bunch of courses they took, and need to calculate the overall GPA. We will need to get the grade and number of units for each course. It is not ideal to ask how many courses they took, as they have to manually count their courses. Programming is about automation and not manual work. We will create a textual menu that shows 3 choices. 1. Enter course grade and units. 2. Show GPA. 3....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT