Write a program that stores and retrieves student records. When started the program should ask the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that stores and retrieves student records. When started the program should ask the user if they would like to list students or add students. Use any input you'd like to represent these options (though, numbers would probably be best -- i.e. Enter 1 to list students, 2 to add student (3 to exit). Your interface should be robust and re-ask the user for data if they enter invalid data. Use exception handling to do this. If the user chooses to list the students, then read the student data file (students.txt) and display all students. Be sure to protect against issues if the file is missing; if it's missing, simply create a blank file and display that there are currently no students to list. If the user chooses to add a user, then ask the user for a first name, then last name, and then student ID, and finally, current average. Save this information in a textile called students.txt. As students are added, the file should contain information like the following (be sure that each student is represented on one line, with the fields separated by commas). Tim, Smith, 100134, 97.7 John, Doe, 120134, 71.1 Julie, Jones, 103456, 99.1 etc.. NOTE: When writing to the file, you will need to append to the file (ensuring that previous information is not overwritten). Write a program that stores and retrieves student records. When started the program should ask the user if they would like to list students or add students. Use any input you'd like to represent these options (though, numbers would probably be best -- i.e. Enter 1 to list students, 2 to add student (3 to exit). Your interface should be robust and re-ask the user for data if they enter invalid data. Use exception handling to do this. If the user chooses to list the students, then read the student data file (students.txt) and display all students. Be sure to protect against issues if the file is missing; if it's missing, simply create a blank file and display that there are currently no students to list. If the user chooses to add a user, then ask the user for a first name, then last name, and then student ID, and finally, current average. Save this information in a textile called students.txt. As students are added, the file should contain information like the following (be sure that each student is represented on one line, with the fields separated by commas). Tim, Smith, 100134, 97.7 John, Doe, 120134, 71.1 Julie, Jones, 103456, 99.1 etc.. NOTE: When writing to the file, you will need to append to the file (ensuring that previous information is not overwritten).
Expert Answer:
Answer rating: 100% (QA)
Python import os class Student def initself firstname lastname studentid currentaverage selffirstname firstname selflastname lastname selfstudentid studentid selfcurrentaverage currentaverage def list... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these computer network questions
-
Vaughn Company manufactures two products, Board 12 and Case 165. Vaughn's overhead costs consist of setting up machines, $2720000; machining, $4850000; and inspecting, $1830000. Information on the...
-
A small consulting company wants to make the switch to QuickBooks Online. All of their expenses are paid at the time they are incurred, so there is no need to track bills in the system. There is only...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
1. The two taxes paid on most purchases are the amount of each tax is % and and the % respectively. 2. Use the "10% + 5%" method of estimating total cost. Estimated Rounded Cost Item Cost 10% 5%...
-
PackMan Corporation has sertiannual bonds outstanding with nine years to maturity and the bonds are currently priced at 754.08$. if the bonds have a coupon rate of 7.25%, then what is the after-tax...
-
Dmitri Chekov has made an investment of $25,000, and it promises to pay him 8 percent simple interest per year for 10 years. Determine how much interest he will earn in the: a. First year b. Ninth...
-
What are the key components of corporate governance? Discuss how these components differ in private and public firms.
-
K. Gillan, C. Coduri, and C. Tate share income on a 5 : 3 : 2 basis. They have capital balances of $30,000, $26,000, and $18,000, respectively, when Cap Harkness is admitted to the partnership....
-
1. Assume you have a table named course with columns: course ID, name, description, Offered In Fall, Offered In Spring, Offered Summer One, Offered Summer Two. Does this break rules for 1NF, 2NF, or...
-
In Figure 6.5, what rate of output (a) Maximizes total revenue? (b) Maximizes profit per unit? (c) Maximizes total profit? (Choose the higher level of output.) $18 Marginal cost 16 p = MC Profits...
-
XYZ has received a firm commitment from its underwriter to purchase 1.5 million shares of stock that will be marketed to the general public at $60 per share. The underwriter's spread is $3.00 per...
-
ITEMS OF INCOME Net income - business* Interest income on customer notes IN 10,000,000 145,000 OUT 15,000,000 260,000 Interest income RECEIVED on 6-year bank deposits 10,000 5,000 Interest income...
-
Consider a landowner that uses water as a primary input into the production of food. Similar to the problem above, suppose the land has a general production function of f(w) - aw - w, where w is the...
-
When someone quotes you a "spot rate," when would borrowing or lending begin? O now O in the future O in the past
-
Question 2 An individual has a utility function described by U(Y)=In(Y). There exists a risky asset that is forecasted to pay either of two returns 72 > 1 with probabilities and 1- respectively. Let...
-
Solve 8. 3 [(-3v + 4) dv J2
-
The price of a bond is determined by: a. taking the present value of the bond's final payment and subtracting the coupon payments. b. taking the present value of the coupon payments and adding this...
-
Find i 0 (t) for t > 0 in the circuit in Fig. 16.72 . 2 + Vo 1 7.5e-2t u(t) V ( +) 4.5[1 u(t)]V 0.5v. 1H
-
Define DiscountPolicy as an interface instead of the abstract class described in Exercise 10. Exercise 10. Create an abstract class DiscountPolicy. It should have a single abstract method...
-
Write a program that converts degrees from Fahrenheit to Celsius, using the formula DegreesC = 5(DegreesF 32)/9 Prompt the user to enter a temperature in degrees Fahrenheit as a whole number without...
-
Develop an algorithm for a simple game of guessing at a secret five-digit code. When the user enters a guess at the code, the program returns two values: the number of digits in the guess that are in...
-
Prove: 'Bernoulli's equation is a restrictive form of energy equation'.
-
What are the assumption made for the establishment of Bernoulli's equation?
-
A pipe, through which water is flowing, has diameters \(30 \mathrm{~cm}\) and \(15 \mathrm{~cm}\) at crosssections 1 and 2 respectively. The discharge velocity of the pipe is \(40 \mathrm{~L} /...
Study smarter with the SolutionInn App