Question

Assignment: To design a program "Student Query Tool (SQT)" SUMMARY The overall goal of this SQT...

Assignment:

To design a program "Student Query Tool (SQT)"

SUMMARY

The overall goal of this SQT program is to read student records from a file (the content of the file is copies in below----), and let the user enter queries

in order to see a detail or summary report.

PROGRAM INPUTS

The student input file has the following fields:

Student ID #

Last name

First name

Graduating year (e.g, 2019)

Graduating term (Fall, Spring, Summer)

Degree program (e.g., MSBA, MBA, etc.)

This input file (please refer to below data:"students",  has a header record (a first line describing the fields in the file). Each field is separated by a

tab. Example files to use (e.g, students.txt) will be posted on Blackboard.

PROGRAM PROCESSING

The program should read each record of the file once into a data structure (e.g., list, dictionary).

The program should keep the instance of the data in memory for the duration of the program, i.e., it should

not re-read the data from the file for each user query.

The program should allow queries to be entered, regarding the student list.

Types of queries include:

Display all student records

Display students whose last name begins with a certain string (case insensitive)

Display all records for students whose graduating year is a certain year

Display a summary report of number and percent of students in each program, for students

graduating on/after a certain year

The exact way to get user input and display the results will be decided by the group. The user interface

should be via the console (screen and keyboard).

The program should anticipate and handle a number of potential errors related to user input or the file

data.

Your final .py file(s) for the program as well as a “Read me” word document for basic instructions need to

be submitted.

-------------------------------------------------------------------------------------------------------------------

The content of The input file "Students.txt" is as below:

ID      Last    First   GradYear        GradTerm        DegreeProgram
101010  Lee     Shane   2019    Spring  MSA
101020  Zhang   Eve     2019    Summer  MSSD
101030  Anthony Daisy   2020    Fall    MSBA
101040  Ware    Tyson   2019    Spring  MSGF
101050  Shea    Marley  2019    Summer  MSIT
101060  Duke    Matteo  2019    Fall    MSM
101070  Blackwell       Savannah        2020    Spring  MSMI
101080  Estrada Rose    2021    Summer  MSMM
101090  Lewis   Alexis  2021    Fall    MSGF
101100  Reeves  Reagan  2021    Spring  MST
101110  Obrien  Jovan   2020    Summer  MSSC
101120  Brennan Haylie  2019    Fall    MSBA
101130  Proctor Reagan  2020    Spring  MSBA
101140  Walker  Yesenia 2020    Summer  MSBA
101150  Fletcher        Craig   2021    Fall    MSGF
101160  Mills   Braedon 2021    Spring  MSGF
101170  Cook    Naima   2019    Summer  MSGF
101180  Cruz    Nyla    2019    Fall    MBA
101190  Pollard Kaleigh 2020    Spring  MBA
101200  Larson  Daniela 2019    Summer  MSSD
101210  Herrera Richard 2019    Fall    MSBA
101220  Stewart Marshall        2019    Spring  MSGF
101230  Campbell        Amiyah  2020    Summer  MSSD
101240  Smith   Michaela        2021    Fall    MSBA
101250  Joyce   Izabella        2020    Spring  MSGF
101260  Holland Cyrus   2021    Summer  MSA
101270  Sharp   Adrian  2020    Fall    MSSD
101280  Gentry  Annalise        2019    Spring  MSBA
101290  Finley  Kelsey  2020    Summer  MSGF
101300  Fox     Gia     2020    Fall    MSIT
101310  Duarte  Steven  2021    Spring  MSM
101320  Schultz Jacob   2020    Summer  MSMI
101330  Wiley   Hazel   2019    Fall    MSMM
101340  Castaneda       Ronin   2019    Spring  MSGF
101350  Villanueva      Jace    2020    Summer  MST
101360  Cantu   Mara    2019    Fall    MSSC
101370  Moran   Mike    2019    Spring  MBA
101380  Singleton       Riley   2019    Summer  MBAP
101390  Baxter  Xzavier 2020    Fall    MBAE
101400  Newman  Cristina        2021    Spring  MSBA
101410  Yu      Alejandra       2021    Summer  MSGF
101420  Bennett Tony    2021    Fall    MSIT
101430  Pham    Alan    2020    Spring  MSM
101440  Crawford        Emilio  2019    Summer  MSMI
101450  Melton  Abbey   2020    Fall    MSMM
101460  Diaz    Clarissa        2020    Spring  MSGF
101470  Blake   Pedro   2021    Summer  MST
101480  Jimenez Mikayla 2020    Fall    MSSC
101490  Juarez  Myla    2019    Spring  MBA
101500  Mayo    Jazmyn  2019    Summer  MBAP
101510  Saunders        Ireland 2020    Fall    MBAE
101520  Henderson       Jakob   2019    Spring  MSA
101530  Ibarra  Melissa 2019    Summer  MSSD
101540  Jarvis  David   2019    Spring  MSBA
101550  House   Dennis  2020    Summer  MSGF
101560  Kelley  Nikolas 2021    Spring  MSIT
101570  Cordova Riley   2020    Summer  MSM
101580  Poole   Morgan  2021    Fall    MSMI
101590  Hood    Makhi   2020    Spring  MSMM
101600  Odonnell        Marlene 2019    Summer  MSGF
101610  Compton Joshua  2020    Fall    MST
101620  Crane   Chance  2020    Spring  MSSC
101630  Palmer  Walter  2021    Summer  MSBA
101640  Preston Hadley  2020    Fall    MSBA
101650  Marsh   Davian  2019    Spring  MSBA
101660  Spence  Kenny   2019    Summer  MSGF
101670  Morris  Haleigh 2020    Fall    MSGF
101680  Harrington      Mila    2019    Spring  MSGF
101690  Lara    Raul    2019    Summer  MBA
101700  Cooley  Maria   2019    Fall    MBA
101710  Orr     Orion   2020    Spring  MSSD
101720  Rice    Maritza 2021    Summer  MSBA
101730  Reynolds        Jordan  2019    Fall    MSGF
101740  Chase   Tatum   2021    Spring  MSSD
101750  Hoffman Addison 2020    Summer  MSBA
101760  Novak   Braylon 2019    Fall    MSGF
101770  Rasmussen       Emanuel 2020    Spring  MSA
101780  Haas    Alfred  2020    Summer  MSSD
101790  Nicholson       Carlos  2021    Fall    MSBA
101800  Watson  Marco   2019    Spring  MSGF
101810  Forbes  Dillan  2019    Summer  MSIT
101820  Morse   Emmett  2019    Fall    MSM
101830  Richmond        Cruz    2020    Spring  MSMI
101840  Roman   Zaiden  2019    Summer  MSMM
101850  Singh   Julius  2019    Fall    MSGF
101860  Camacho Jamya   2019    Spring  MST
101870  Franklin        Dexter  2020    Summer  MSSC
101880  Boone   Raegan  2021    Fall    MBA
101890  Meyer   Efrain  2019    Spring  MBAP
101900  Keith   Aaron   2021    Summer  MBAE
101910  Ho      Joaquin 2020    Fall    MSBA
101920  Duffy   Jett    2019    Spring  MSGF
101930  Knox    Daniel  2020    Summer  MSIT
101940  Villarreal      Felicity        2020    Fall    MSM
101950  Sawyer  Zion    2021    Spring  MSMI
101960  Banks   Mariam  2019    Summer  MSMM
101970  Pugh    Samuel  2019    Fall    MSGF
101980  Ayers   Taniya  2019    Spring  MST
101990  Cherry  Gage    2020    Summer  MSSC
102000  Adkins  Davon   2019    Fall    MBA
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

l=[]
temp_list=[] #declaration of lists that are used in program
d={}
id=[]
last=[]
first=[]
year=[]
term=[]
degree=[]
def display(temp_list): #function that displays students records
for i in temp_list: #For each record in list
print(i,end='') #print data
  
def lastname(): #function that prints records based on last name
global l,last,id,first,year,term,term,degree
str=input("Enter certain string") #Read pattern from user
str=str.lower()
for i in range(len(last)): #For each record in list
last[i]=last[i].lower() #store data in lower case
print(l[0])
for i in range(len(last)): #for each record in list
if str in last[i]: #check if entered substring is in main string
print(id[i],end=" ") #If present then print that record
print(last[i].title(),end="\t") #print data of that record from lists
print(first[i],end="\t")
print(year[i],end="\t")
print(term[i],end="\t")
print(degree[i])
def grad_year(): #method to print record based on year
y=int(input("Enter year")) #Read input from user
  
for i in range(len(year)): #For each record in list
if y==int(year[i]): #check for year
print(id[i],end=" ") #If year is found then print that record
print(last[i],end="\t") #print data of that record from lists
print(first[i],end="\t")
print(year[i],end="\t")
print(term[i],end="\t")
print(degree[i])
def summary(): #method that displays summary
total=len(id)
degree_set=list(set(degree)) #identify unique degrees from list
for i in degree_set: #For each unique degree in list
print("Number of students in degree",end=' ') #print number of students
print(i,end=':')
print(degree.count(i))
print("Percent of students in degree",end=' ') #print percent of students in that degree
print(i,end=':')
print((degree.count(i)*100)/total)

def main(): #main method definition
global l,last,id,first,year,term,term,degree
f=open("Students.txt","r") #open file in read mode
l=list(f.readlines()) #store data into list
temp_list=l[:]
for i in range(len(l)): #For each record in list, obtain data in required format.
l[i]=l[i][:-1]
  
l[i]=l[i].replace(" "," ")
  
l[i]=" ".join(l[i].split())
  
for i in range(1,len(l)): #For each record, store the details in relevant lists
temp=l[i].split(" ")
id.append(temp[0])
last.append(temp[1])
first.append(temp[2])
year.append(temp[3])
term.append(temp[4])
degree.append(temp[5])
while(1): #print menu until user inputs 5.
print("1.display all student records") #print choices on console
print("2.display student whose last name begins with")
print("3.display students whose graduation year is:")
print("4.Summary report")
print("5.quit")
ch=int(input("Enter choice")) #Read choice from user
if ch==1:
display(temp_list) #Call display() if ch is 1
elif ch==2:
lastname() #call lastname() if ch is 2
elif ch==3:
grad_year() #call grad_year() if ch is 3
elif ch==4:
summary() #call summary() if ch is 4
elif ch==5:
exit(0) #exit if input is 5
else:
print("Enter valid input")
continue
main() #call the main method to start the execution

Screenshots:

The screenshots are attached below for reference.

Please follow them for proper indentation.

Add a comment
Know the answer?
Add Answer to:
Assignment: To design a program "Student Query Tool (SQT)" SUMMARY The overall goal of this SQT...
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
  • Program in C Student Data using Structs In this assignment you will create a program (using...

    Program in C Student Data using Structs In this assignment you will create a program (using multiple .c files) to solve the following problem: You have been hired by the university to create a program that will read in input from a .txt file. This input will contain a student name, student id #, their age and their current gpa. You should use the following struct for your student data: struct Student{                 char name[50];                 int id;                 float...

  • Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student...

    Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student gradebook using a two-dimensional array. It should allow the user to enter the number of students and the number of assignments they wish to enter grades for. This input should be used in defining the two-dimensional array for your program. For example, if I say I want to enter grades for 4 students and 5 assignments, your program should define a 4 X 5...

  • CIS 22A C++ Project Exam Statistics Here is what your program will do: first it welcomes...

    CIS 22A C++ Project Exam Statistics Here is what your program will do: first it welcomes the user and displays the purpose of the program. It then prompts the user to enter the name of an input file (such as scores.txt). Assume the file contains the scores of the final exams; each score is preceded by a 5 characters student id. Create the input file: copy and paste the following data into a new text file named scores.txt DH232 89...

  • Must be written in JAVA Code Write a program that will read in a file of student academic credit data and create a list of students on academic warning. The list of students on warning will be written...

    Must be written in JAVA Code Write a program that will read in a file of student academic credit data and create a list of students on academic warning. The list of students on warning will be written to a file. Each line of the input file will contain the student name (a single String with no spaces), the number of semester hours earned (an integer), the total quality points earned (a double). The following shows part of a typical...

  • Description: This Java program will read in data from a file students.txt that keeps records of...

    Description: This Java program will read in data from a file students.txt that keeps records of some students. Each line in students.txt contains information about one student, including his/her firstname, lastname, gender, major, enrollmentyear and whether he/she is a full-time or part-time student in the following format. FIRSTNAME      LASTNAME        GENDER              MAJORENROLLMENTYEAR FULL/PART The above six fields are separated by a tab key. A user can input a keyword indicating what group of students he is searching for. For example, if...

  • Java program Program: Grade Stats In this program you will create a utility to calculate and...

    Java program Program: Grade Stats In this program you will create a utility to calculate and display various statistics about the grades of a class. In particular, you will read a CSV file (comma separated value) that stores the grades for a class, and then print out various statistics, either for the whole class, individual assignments, or individual students Things you will learn Robustly parsing simple text files Defining your own objects and using them in a program Handling multiple...

  • Using the program segment and sample txt file below, write a program that contains a linked...

    Using the program segment and sample txt file below, write a program that contains a linked list of students. The program should allow the user to: 1. initialize list of students 2. add additional student to front of list 3. add additional student to rear of list 4. delete student 5. sort students alphabetically 6. sort students by idNum 7. show number of students in list 8. print students 9. quit program XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The program should be divided into the...

  • Student ID: 123 Write a C+ program with the following specifications: a. Define a C++ function (name it function_Student...

    Student ID: 123 Write a C+ program with the following specifications: a. Define a C++ function (name it function_StudentlD where StudentID is your actual student ID number) that has one integer input (N) and one double input (x) and returns a double output S, where N S = n 0 and X2 is given by 0 xeVn n 0,1 Хл —{2. nx 2 n 2 2 m2 x2 3 (Note: in the actual quiz, do not expect a always, practice...

  • In this assignment, you will write a program in C++ which uses files and nested loops...

    In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...

  • Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...

    Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...

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