Question

Shell Programming USA College wants you to create a simple application. The program will enter the...

Shell Programming

USA College wants you to create a simple application. The program will enter the student name, student id, Student Level, Enter the marks for four (4) courses. Calculate the total marks and the SGPA. If the SGPA less than 2.0 then students will enter into probation.display the appropriate output.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Check out the solution and let me know if you need any other info through COMMENTS.

________

#!/bin/sh   

# read the user input by printing appropriate messages
echo "Enter Student Name : "
read stud_name
echo "Enter Student ID : "
read stud_id
echo "Enter Student Level : "   
read stud_level   
echo "Enter marks of 4 courses : "
read marks[0]   
read marks[1]   
read marks[2]   
read marks[3]   
  
# sum of all 4 marks
sum=$(echo "${marks[0]} + ${marks[1]} + ${marks[2]} + ${marks[3]}"|bc)

# initialize required variables
i=0   
gradepoints=0   
# traverse through the marks of all 4 courses
# assuming credits of individual course is 4
while [ $i -lt 4 ]
do
   # if marks >= 90 then assume the credit is 4
if [ ${marks[i]} -ge 90 ]   
then
       # so multiply "gained credit * course credit"
gp1=$(echo "4 * 4"|bc)
   # if marks >= 70 AND marks < 90 then assume the credit is 3   
elif [ ${marks[i]} -ge 70 -a ${marks[i]} -lt 90 ]   
then
gp1=$(echo "3 * 4"|bc)
   # if marks >= 50 AND marks < 70 then assume the credit is 2
elif [ ${marks[i]} -ge 50 -a ${marks[i]} -lt 70 ]   
then
gp1=$(echo "2 * 4"|bc)
   # if marks >= 35 AND marks < 50 then assume the credit is 1
   elif [ ${marks[i]} -ge 35 -a ${marks[i]} -lt 50 ]   
then
gp1=$(echo "1 * 4"|bc)
   # if marks < 35 then credit = 0
else
gp1=$(echo "0 * 4"|bc)
fi
   # add all 'gp1' of 4 courses to get the gradepoints
gradepoints=$(echo "$gradepoints + $gp1"|bc)   
   # increment the initializer 'i' by 1   
i=$(( $i + 1))
done
# end of WHILE   
# finding the SGPA by dividing the gradepoints by total course credits (4+4+4+4 = 16)
SGPA=$(echo "$gradepoints / 16.0"|bc)   

# display the results as required
echo "Student Name : $stud_name"
echo "Student ID : $stud_id"
echo "Student Level : $stud_level"
echo "Total marks : $sum"   

# check out SGPA and print the message accordingly
if [ $SGPA -lt 2 ]
then
echo "SGPA : $SGPA"   
echo "Student enters to PROBATION"
else
echo "SGPA : $SGPA"   
echo "Congrats!!!!"   
fi
  
echo ""   
echo "Program terminated!!!"
------------------------------------------------------------

Add a comment
Know the answer?
Add Answer to:
Shell Programming USA College wants you to create a simple application. The program will enter the...
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
  • Create an application that allows you to enter student data that consists of an ID number,...

    Create an application that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Depending on whether the student’s grade point average is at least 2.0, output each record either to a file of students in good standing (located at StudentsGoodStanding.txt) or those on academic probation (located at StudentsAcademicProbation.txt).

  • Create an application that allows you to enter student data that consists of an ID number,...

    Create an application that allows you to enter student data that consists of an ID number, first name, last name, and grade point average. Depending on whether the student’s grade point average is at least 2.0, output each record either to a file of students in good standing (located at StudentsGoodStanding.txt) or those on academic probation (located at StudentsAcademicProbation.txt). Enter ZZZ to Quit. This is in Java

  • create an application that calculates the grades of students Wilbur Wright College CIS 142 C++ Programming...

    create an application that calculates the grades of students Wilbur Wright College CIS 142 C++ Programming Language Prof. Gustavo Alatta Lab #4 Points: 100 1.1. Create an application that calculates the grades of a group of students. The program must follow these specifications: - You need to declare 2 arrays: 1 single String array to contain the name of the students and the second a double two-dimensional to hold the grades of the students. - The program must allow the...

  • A small private college offers online courses and wants you to develop a C program that...

    A small private college offers online courses and wants you to develop a C program that calculates total tuition and fees for their students. User will input the number of hours; the program should calculate the total cost. For full-times students taking greater than 15 hours of courses, the fees per credit hour is $44.50. For part-time students taking 15 hours or less, the fees per credit hour is $67.50. In-state tuition is $1250.00 and Out-of-statetuition is $2476.80. Modularize the...

  • PYTHON Programming Exercise 2: Create a Simple Cost Calculator Write a program that displays input fields...

    PYTHON Programming Exercise 2: Create a Simple Cost Calculator Write a program that displays input fields (item name and cost) and calculates and displays the calculated costs. The program should do the following: Provide data entry areas for item name and cost. Calculate and display the subtotal of all items. Adds a sales tax of 6% and calculate and displays the total cost. Enter the following values into your program. Mother Board $200. RAM $75. Hard Drive $72. Video Graphics...

  • You are asked to build and test the following system using Java and the object-oriented concepts ...

    You are asked to build and test the following system using Java and the object-oriented concepts you learned in this course: Project (20 marks) CIT College of Information technology has students, faculty, courses and departments. You are asked to create a program to manage all these information's. Create a class CIT to represents the following: Array of Students, each student is represented by class Student. Array of Faculty, each faculty is represented by class Faculty. Array of Course, each course...

  • Suppose a local college has tasked you to develop a database that will keep track of...

    Suppose a local college has tasked you to develop a database that will keep track of students and the courses that they have taken. In addition to tracking the students and courses, the client wants the database to keep track of the instructors teaching each of the courses. Database Design Diagram Use any drawing package or any other application you know such as Visio, Word, PowerPoint, or another tool to create the Database Design Diagram. Otherwise, you may draw the...

  • Create a GUI program (a Windows Forms Application) called GooseEggCalculator that lets a user enter the...

    Create a GUI program (a Windows Forms Application) called GooseEggCalculator that lets a user enter the number of eggs produced by each of four geese. Your program should provide textboxes with labels for the user to enter the values. When the user clicks a Calculate button, your app should sum the textboxes, then display the total number of eggs, as well as the number of eggs in dozens and remaining eggs, as shown on the example. Feel free to make...

  • Less than 200 F. 200-250 D / D + 250-300 C/ C + 300-350 B /...

    Less than 200 F. 200-250 D / D + 250-300 C/ C + 300-350 B / B + 350-400 A / A + Q2. Develop an Application in C++ that will Prepare Final Grade sheet of Students with the following Guidelines: (10 Marks) Develop an Application in C++ that will Create Final Grade sheet of Students with the following Guidelines: User will choose number of students he want to store in Arrays ii. First array will store Students ID Second...

  • In Java Programming: Create a flow chart for a program that prompts for an integer N...

    In Java Programming: Create a flow chart for a program that prompts for an integer N (number of students) and M (number of test scores for each students), and allows the user to N*M real numbers. The program then calculates the average for each student and class average. (1) Prompt the user to input N students and M test scores, then display the inputs. Enter number of students: You entered: 2 Enter number of test scores: You entered: 3 Enter...

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